moving between PCs - THIS IS HORRIBLY BROKEN AS OF THIS COMMIT
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
<conf name="default" type="2">
|
||||
<toolsSet>
|
||||
<developmentServer>localhost</developmentServer>
|
||||
<targetDevice>PIC18F2550</targetDevice>
|
||||
<targetDevice>PIC18F4550</targetDevice>
|
||||
<targetHeader></targetHeader>
|
||||
<targetPluginBoard></targetPluginBoard>
|
||||
<platformTool>PICkit3PlatformTool</platformTool>
|
||||
@@ -98,9 +98,9 @@
|
||||
<property key="default-bitfield-type" value="true"/>
|
||||
<property key="default-char-type" value="true"/>
|
||||
<property key="define-macros" value=""/>
|
||||
<property key="disable-optimizations" value="false"/>
|
||||
<property key="disable-optimizations" value="true"/>
|
||||
<property key="extra-include-directories"
|
||||
value="..\src;..\..\common_src\framework\usb\inc"/>
|
||||
value="..\src;..\..\common_src\framework\usb\inc;..\..\common_src"/>
|
||||
<property key="favor-optimization-for" value="-speed,+space"/>
|
||||
<property key="garbage-collect-data" value="true"/>
|
||||
<property key="garbage-collect-functions" value="true"/>
|
||||
@@ -109,11 +109,11 @@
|
||||
<property key="operation-mode" value="free"/>
|
||||
<property key="opt-xc8-compiler-strict_ansi" value="false"/>
|
||||
<property key="optimization-assembler" value="true"/>
|
||||
<property key="optimization-assembler-files" value="true"/>
|
||||
<property key="optimization-assembler-files" value="false"/>
|
||||
<property key="optimization-debug" value="false"/>
|
||||
<property key="optimization-invariant-enable" value="false"/>
|
||||
<property key="optimization-invariant-value" value="16"/>
|
||||
<property key="optimization-level" value="-O1"/>
|
||||
<property key="optimization-level" value="-O0"/>
|
||||
<property key="optimization-speed" value="false"/>
|
||||
<property key="optimization-stable-enable" value="false"/>
|
||||
<property key="pack-struct" value="true"/>
|
||||
@@ -139,7 +139,7 @@
|
||||
<property key="calibrate-oscillator-value" value="0x3400"/>
|
||||
<property key="clear-bss" value="true"/>
|
||||
<property key="code-model-external" value="wordwrite"/>
|
||||
<property key="code-model-rom" value="default,-1C00-7FFF"/>
|
||||
<property key="code-model-rom" value="default,-2080-7FFF"/>
|
||||
<property key="create-html-files" value="false"/>
|
||||
<property key="data-model-ram" value=""/>
|
||||
<property key="data-model-size-of-double" value="32"/>
|
||||
@@ -163,7 +163,7 @@
|
||||
<property key="input-libraries" value="libm"/>
|
||||
<property key="keep-generated-startup.as" value="false"/>
|
||||
<property key="link-in-c-library" value="true"/>
|
||||
<property key="link-in-c-library-gcc" value="-mc90lib"/>
|
||||
<property key="link-in-c-library-gcc" value=""/>
|
||||
<property key="link-in-peripheral-library" value="false"/>
|
||||
<property key="managed-stack" value="false"/>
|
||||
<property key="opt-xc8-linker-file" value="false"/>
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
;//High priority interrupt vector remapping
|
||||
PSECT HiVector,class=CODE,delta=1,abs
|
||||
org 0x08
|
||||
goto 0x1C08 ;Resides at 0x0008 (hardware high priority interrupt vector), and causes PC to jump to 0x1C08 upon a high priority interrupt event
|
||||
goto 0x2088 ;Resides at 0x0008 (hardware high priority interrupt vector), and causes PC to jump to 0x2008 upon a high priority interrupt event
|
||||
|
||||
|
||||
;//Low priority interrupt vector remapping, as well as bootloader mode absolute
|
||||
;//entry point (located at 0x001C).
|
||||
PSECT LoVector,class=CODE,delta=1,abs
|
||||
org 0x18
|
||||
goto 0x1C18 ;Resides at 0x0018 (hardware low priority interrupt vector), and causes PC to jump to 0x1C18 upon a low priority interrupt event
|
||||
goto 0x2098 ;Resides at 0x0018 (hardware low priority interrupt vector), and causes PC to jump to 0x2018 upon a low priority interrupt event
|
||||
goto 0x30 ;Resides at 0x001C //Serves as absolute entry point from application program into the bootloader mode
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "usb.h"
|
||||
#include "usb_device_hid.h"
|
||||
|
||||
#undef uint24_t
|
||||
#define uint24_t uint32_t
|
||||
|
||||
//The bootloader version, which the bootloader PC application can do extended query to get.
|
||||
//Value provided is expected to be in the format of BOOTLOADER_VERSION_MAJOR.BOOTLOADER_VERSION_MINOR
|
||||
@@ -143,8 +145,8 @@ typedef union
|
||||
};
|
||||
} PacketToFromPC;
|
||||
|
||||
PacketToFromPC PacketFromPC __at(0x500);
|
||||
PacketToFromPC PacketToPC __at(0x550);
|
||||
PacketToFromPC PacketFromPC __at(0x42C);
|
||||
PacketToFromPC PacketToPC __at(0x46C);
|
||||
unsigned char ProgrammingBuffer[ERASE_PAGE_SIZE];
|
||||
unsigned char BootState;
|
||||
unsigned int ErasePageTracker;
|
||||
|
||||
@@ -27,18 +27,20 @@
|
||||
#ifndef BOOTLOADER_
|
||||
#define BOOTLOADER_
|
||||
|
||||
#include "memory.h"
|
||||
|
||||
void UserInit(void);
|
||||
void ProcessIO(void);
|
||||
|
||||
//Vector remapping/absolute address constants
|
||||
#define REMAPPED_APPLICATION_RESET_VECTOR 0x1C00
|
||||
//#define REMAPPED_APPLICATION_HIGH_ISR_VECTOR 0x1C08 //See VectorRemap.asm
|
||||
//#define REMAPPED_APPLICATION_LOW_ISR_VECTOR 0x1C18 //See VectorRemap.asm
|
||||
#define BOOTLOADER_ABSOLUTE_ENTRY_ADDRESS 0x001C //Execute a "goto 0x001C" inline assembly instruction, if you want to enter the bootloader mode from the application via software
|
||||
#define REMAPPED_APPLICATION_RESET_VECTOR APP_FW_MEMORY_OFFSET
|
||||
//#define REMAPPED_APPLICATION_HIGH_ISR_VECTOR APP_FW_MEMORY_OFFSET + 0x08 //See VectorRemap.asm
|
||||
//#define REMAPPED_APPLICATION_LOW_ISR_VECTOR APP_FW_MEMORY_OFFSET + 0x18 //See VectorRemap.asm
|
||||
#define BOOTLOADER_ABSOLUTE_ENTRY_ADDRESS BOOTLOADER_ENTRYPOINT //Execute a "goto 0x001C" inline assembly instruction, if you want to enter the bootloader mode from the application via software
|
||||
|
||||
#define APP_SIGNATURE_ADDRESS 0x1C06 //0x1C06 and 0x1C07 contains the "signature" WORD, indicating successful erase/program/verify operation
|
||||
#define APP_SIGNATURE_ADDRESS APP_FW_MEMORY_OFFSET + 0x06 //0x1C06 and 0x1C07 contains the "signature" WORD, indicating successful erase/program/verify operation
|
||||
#define APP_SIGNATURE_VALUE 0x600D //leet "GOOD", implying that the erase/program was a success and the bootloader intentionally programmed the APP_SIGNATURE_ADDRESS with this value
|
||||
#define APP_VERSION_ADDRESS 0x1C16 //0x1C16 and 0x1C17 should contain the application image firmware version number
|
||||
#define APP_VERSION_ADDRESS APP_FW_MEMORY_OFFSET + 0x16 //0x1C16 and 0x1C17 should contain the application image firmware version number
|
||||
|
||||
#endif /* BOOTLOADER_ */
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
//firmware, can offer better sustained bandwidth, especially for OUT endpoints.
|
||||
//------------------------------------------------------
|
||||
//#define USB_PING_PONG_MODE USB_PING_PONG__NO_PING_PONG //Not recommended
|
||||
#define USB_PING_PONG_MODE USB_PING_PONG__FULL_PING_PONG //A good all around setting
|
||||
//#define USB_PING_PONG_MODE USB_PING_PONG__EP0_OUT_ONLY //Another good setting
|
||||
//#define USB_PING_PONG_MODE USB_PING_PONG__FULL_PING_PONG //A good all around setting
|
||||
#define USB_PING_PONG_MODE USB_PING_PONG__EP0_OUT_ONLY //Another good setting
|
||||
//#define USB_PING_PONG_MODE USB_PING_PONG__ALL_BUT_EP0 //Not recommended
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifndef MEMORY_
|
||||
#define MEMORY_
|
||||
|
||||
#define APP_FW_MEMORY_OFFSET 0x2000
|
||||
#define APP_FW_MEMORY_OFFSET 0x2080
|
||||
|
||||
#define BOOTLOADER_ENTRYPOINT 0x001C
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
//#include "usb.h"
|
||||
|
||||
#ifdef PIC18F2550
|
||||
|
||||
// PIC18F2550 Configuration Bit Settings
|
||||
|
||||
// 'C' source line config statements
|
||||
@@ -91,3 +93,79 @@
|
||||
|
||||
// #pragma config statements should precede project file includes.
|
||||
// Use project enums instead of #define for ON and OFF.
|
||||
#else
|
||||
|
||||
// PIC18F4550 Configuration Bit Settings
|
||||
|
||||
// 'C' source line config statements
|
||||
|
||||
// CONFIG1L
|
||||
#pragma config PLLDIV = 3 // PLL Prescaler Selection bits (Divide by 3 (12 MHz oscillator input))
|
||||
#pragma config CPUDIV = OSC3_PLL4// System Clock Postscaler Selection bits ([Primary Oscillator Src: /3][96 MHz PLL Src: /4])
|
||||
#pragma config USBDIV = 2 // USB Clock Selection bit (used in Full-Speed USB mode only; UCFG:FSEN = 1) (USB clock source comes from the 96 MHz PLL divided by 2)
|
||||
|
||||
// CONFIG1H
|
||||
#pragma config FOSC = HSPLL_HS // Oscillator Selection bits (HS oscillator, PLL enabled (HSPLL))
|
||||
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)
|
||||
#pragma config IESO = OFF // Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled)
|
||||
|
||||
// CONFIG2L
|
||||
#pragma config PWRT = OFF // Power-up Timer Enable bit (PWRT disabled)
|
||||
#pragma config BOR = ON // Brown-out Reset Enable bits (Brown-out Reset enabled in hardware only (SBOREN is disabled))
|
||||
#pragma config BORV = 3 // Brown-out Reset Voltage bits (Minimum setting 2.05V)
|
||||
#pragma config VREGEN = ON // USB Voltage Regulator Enable bit (USB voltage regulator enabled)
|
||||
|
||||
// CONFIG2H
|
||||
#pragma config WDT = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
|
||||
#pragma config WDTPS = 32768 // Watchdog Timer Postscale Select bits (1:32768)
|
||||
|
||||
// CONFIG3H
|
||||
#pragma config CCP2MX = ON // CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
|
||||
#pragma config PBADEN = ON // PORTB A/D Enable bit (PORTB<4:0> pins are configured as analog input channels on Reset)
|
||||
#pragma config LPT1OSC = OFF // Low-Power Timer 1 Oscillator Enable bit (Timer1 configured for higher power operation)
|
||||
#pragma config MCLRE = ON // MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)
|
||||
|
||||
// CONFIG4L
|
||||
#pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
|
||||
#pragma config LVP = OFF // Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
|
||||
#pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming Port (ICPORT) Enable bit (ICPORT disabled)
|
||||
#pragma config XINST = OFF // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))
|
||||
|
||||
// CONFIG5L
|
||||
#pragma config CP0 = OFF // Code Protection bit (Block 0 (000800-001FFFh) is not code-protected)
|
||||
#pragma config CP1 = OFF // Code Protection bit (Block 1 (002000-003FFFh) is not code-protected)
|
||||
#pragma config CP2 = OFF // Code Protection bit (Block 2 (004000-005FFFh) is not code-protected)
|
||||
#pragma config CP3 = OFF // Code Protection bit (Block 3 (006000-007FFFh) is not code-protected)
|
||||
|
||||
// CONFIG5H
|
||||
#pragma config CPB = OFF // Boot Block Code Protection bit (Boot block (000000-0007FFh) is not code-protected)
|
||||
#pragma config CPD = OFF // Data EEPROM Code Protection bit (Data EEPROM is not code-protected)
|
||||
|
||||
// CONFIG6L
|
||||
#pragma config WRT0 = OFF // Write Protection bit (Block 0 (000800-001FFFh) is not write-protected)
|
||||
#pragma config WRT1 = OFF // Write Protection bit (Block 1 (002000-003FFFh) is not write-protected)
|
||||
#pragma config WRT2 = OFF // Write Protection bit (Block 2 (004000-005FFFh) is not write-protected)
|
||||
#pragma config WRT3 = OFF // Write Protection bit (Block 3 (006000-007FFFh) is not write-protected)
|
||||
|
||||
// CONFIG6H
|
||||
#pragma config WRTC = OFF // Configuration Register Write Protection bit (Configuration registers (300000-3000FFh) are not write-protected)
|
||||
#pragma config WRTB = OFF // Boot Block Write Protection bit (Boot block (000000-0007FFh) is not write-protected)
|
||||
#pragma config WRTD = OFF // Data EEPROM Write Protection bit (Data EEPROM is not write-protected)
|
||||
|
||||
// CONFIG7L
|
||||
#pragma config EBTR0 = OFF // Table Read Protection bit (Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks)
|
||||
#pragma config EBTR1 = OFF // Table Read Protection bit (Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks)
|
||||
#pragma config EBTR2 = OFF // Table Read Protection bit (Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks)
|
||||
#pragma config EBTR3 = OFF // Table Read Protection bit (Block 3 (006000-007FFFh) is not protected from table reads executed in other blocks)
|
||||
|
||||
// CONFIG7H
|
||||
#pragma config EBTRB = OFF // Boot Block Table Read Protection bit (Boot block (000000-0007FFh) is not protected from table reads executed in other blocks)
|
||||
|
||||
// #pragma config statements should precede project file includes.
|
||||
// Use project enums instead of #define for ON and OFF.
|
||||
|
||||
#include <xc.h>
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -59,7 +59,7 @@
|
||||
<conf name="bootloader_only" type="2">
|
||||
<toolsSet>
|
||||
<developmentServer>localhost</developmentServer>
|
||||
<targetDevice>PIC18F2550</targetDevice>
|
||||
<targetDevice>PIC18F4550</targetDevice>
|
||||
<targetHeader></targetHeader>
|
||||
<targetPluginBoard></targetPluginBoard>
|
||||
<platformTool>PICkit3PlatformTool</platformTool>
|
||||
@@ -94,15 +94,27 @@
|
||||
<makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines>
|
||||
<makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile>
|
||||
</makeCustomizationType>
|
||||
<item path="../../common_src/framework/usb/src/usb_device_hid.c"
|
||||
ex="true"
|
||||
overriding="false">
|
||||
</item>
|
||||
<item path="../src/dancepad.c" ex="true" overriding="false">
|
||||
</item>
|
||||
<item path="../src/interrupts.c" ex="true" overriding="false">
|
||||
</item>
|
||||
<item path="../src/padhal.c" ex="true" overriding="false">
|
||||
</item>
|
||||
<item path="../src/usb_events.c" ex="true" overriding="false">
|
||||
</item>
|
||||
<HI-TECH-COMP>
|
||||
<property key="additional-warnings" value="true"/>
|
||||
<property key="asmlist" value="true"/>
|
||||
<property key="default-bitfield-type" value="true"/>
|
||||
<property key="default-char-type" value="true"/>
|
||||
<property key="define-macros" value="LINK_FOR_BOOTLOADER"/>
|
||||
<property key="disable-optimizations" value="false"/>
|
||||
<property key="disable-optimizations" value="true"/>
|
||||
<property key="extra-include-directories"
|
||||
value="..\src;..\..\common_src\framework\usb\inc"/>
|
||||
value="..\src;..\..\common_src\framework\usb\inc;..\..\common_src"/>
|
||||
<property key="favor-optimization-for" value="-speed,+space"/>
|
||||
<property key="garbage-collect-data" value="true"/>
|
||||
<property key="garbage-collect-functions" value="true"/>
|
||||
@@ -115,7 +127,7 @@
|
||||
<property key="optimization-debug" value="false"/>
|
||||
<property key="optimization-invariant-enable" value="false"/>
|
||||
<property key="optimization-invariant-value" value="16"/>
|
||||
<property key="optimization-level" value="-Os"/>
|
||||
<property key="optimization-level" value="-O0"/>
|
||||
<property key="optimization-speed" value="false"/>
|
||||
<property key="optimization-stable-enable" value="false"/>
|
||||
<property key="pack-struct" value="true"/>
|
||||
@@ -126,11 +138,11 @@
|
||||
<property key="use-iar" value="false"/>
|
||||
<property key="verbose" value="false"/>
|
||||
<property key="warning-level" value="-3"/>
|
||||
<property key="what-to-do" value="require"/>
|
||||
<property key="what-to-do" value="ignore"/>
|
||||
</HI-TECH-COMP>
|
||||
<HI-TECH-LINK>
|
||||
<property key="additional-options-checksum" value=""/>
|
||||
<property key="additional-options-code-offset" value="1C00"/>
|
||||
<property key="additional-options-code-offset" value="2080"/>
|
||||
<property key="additional-options-command-line" value=""/>
|
||||
<property key="additional-options-errata" value=""/>
|
||||
<property key="additional-options-extend-address" value="false"/>
|
||||
@@ -141,7 +153,7 @@
|
||||
<property key="calibrate-oscillator-value" value="0x3400"/>
|
||||
<property key="clear-bss" value="true"/>
|
||||
<property key="code-model-external" value="wordwrite"/>
|
||||
<property key="code-model-rom" value="default,-0-1BFF,-1C06-1C07,-1C16-1C17"/>
|
||||
<property key="code-model-rom" value="default,-0-207F,-2086-2087,-2096-2097"/>
|
||||
<property key="create-html-files" value="false"/>
|
||||
<property key="data-model-ram" value=""/>
|
||||
<property key="data-model-size-of-double" value="32"/>
|
||||
@@ -158,7 +170,7 @@
|
||||
<property key="fill-flash-options-how" value="0"/>
|
||||
<property key="fill-flash-options-inc-const" value="1"/>
|
||||
<property key="fill-flash-options-increment" value=""/>
|
||||
<property key="fill-flash-options-seq" value=""/>
|
||||
<property key="fill-flash-options-seq" value="0"/>
|
||||
<property key="fill-flash-options-what" value="0"/>
|
||||
<property key="format-hex-file-for-download" value="false"/>
|
||||
<property key="initialize-data" value="true"/>
|
||||
|
||||
@@ -65,7 +65,7 @@ typedef union _INTPUT_CONTROLS_TYPEDEF
|
||||
} INPUT_CONTROLS;
|
||||
|
||||
// USB data must exist within the USB RAM memory space
|
||||
INPUT_CONTROLS joystick_input __at(0x500);
|
||||
INPUT_CONTROLS joystick_input __at(0x600);
|
||||
|
||||
// handle to the last data transmission - allows us to check if it completed
|
||||
USB_VOLATILE USB_HANDLE lastTransmission = 0;
|
||||
|
||||
@@ -22,35 +22,35 @@
|
||||
* @date 6 Aug 2019
|
||||
* @brief USB interface to 6-sensor DDR pads.
|
||||
*/
|
||||
const unsigned int VersionWord __at(0x1C16) = 0x0100;
|
||||
#pragma warning disable 1510
|
||||
|
||||
#include "usb.h"
|
||||
#include "padhal.h"
|
||||
#include "dancepad.h"
|
||||
//#include "usb.h"
|
||||
//#include "padhal.h"
|
||||
//#include "dancepad.h"
|
||||
#include "memory.h"
|
||||
|
||||
//#ifdef LINK_FOR_BOOTLOADER
|
||||
// only define this if building fw to be used with the bootloader
|
||||
|
||||
const unsigned int VersionWord __at(APP_FW_VERSION_ADDRESS) = 0x0100;
|
||||
//#endif
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// initialize sensor HAL & the dancepad driver
|
||||
PADHAL_Initialize();
|
||||
/*PADHAL_Initialize();
|
||||
DANCEPAD_Initialize();
|
||||
|
||||
// initialize the USB framework
|
||||
USBDeviceInit();
|
||||
USBDeviceAttach();
|
||||
USBDeviceAttach();*/
|
||||
|
||||
while(1)
|
||||
{
|
||||
// do nothing if: not connected to USB host, or the host put us in suspend state
|
||||
if((USBGetDeviceState() < CONFIGURED_STATE) | USBIsDeviceSuspended())
|
||||
continue;
|
||||
//if((USBGetDeviceState() < CONFIGURED_STATE) | USBIsDeviceSuspended())
|
||||
// continue;
|
||||
|
||||
// run application specific tasks
|
||||
DANCEPAD_Tasks();
|
||||
//DANCEPAD_Tasks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
//(ex: USBDeviceTasks()) must be called periodically by the application firmware
|
||||
//at a minimum rate as described in the inline code comments in usb_device.c.
|
||||
//------------------------------------------------------
|
||||
//#define USB_POLLING
|
||||
#define USB_INTERRUPT
|
||||
#define USB_POLLING
|
||||
//#define USB_INTERRUPT
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/* Parameter definitions are defined in usb_device.h */
|
||||
|
||||
Reference in New Issue
Block a user