moving between PCs - THIS IS HORRIBLY BROKEN AS OF THIS COMMIT

This commit is contained in:
2019-08-13 18:18:51 -04:00
parent 5c2d710bc2
commit 1ced4e1b78
11 changed files with 135 additions and 41 deletions

View File

@@ -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"/>

View File

@@ -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

View File

@@ -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;

View File

@@ -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_ */

View File

@@ -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
//------------------------------------------------------------------------------