fixed issue with bootloader not correctly reading application version word from program flash memory

This commit is contained in:
2019-08-22 01:02:32 -04:00
parent cb90e4f40a
commit 7dd18d2772
5 changed files with 10 additions and 8 deletions

View File

@@ -102,7 +102,7 @@
<property key="opt-xc8-compiler-strict_ansi" value="false"/>
<property key="optimization-assembler" value="true"/>
<property key="optimization-assembler-files" value="false"/>
<property key="optimization-debug" value="false"/>
<property key="optimization-debug" value="true"/>
<property key="optimization-invariant-enable" value="false"/>
<property key="optimization-invariant-value" value="16"/>
<property key="optimization-level" value="-O0"/>
@@ -172,6 +172,7 @@
value="Press to browse for a specific firmware version"/>
<property key="ToolFirmwareOption.UseLatestFirmware" value="true"/>
<property key="debugoptions.useswbreakpoints" value="false"/>
<property key="firmware.download.all" value="false"/>
<property key="hwtoolclock.frcindebug" value="false"/>
<property key="memories.aux" value="false"/>
<property key="memories.bootflash" value="true"/>

View File

@@ -69,8 +69,6 @@
#define REQUEST_DATA_BLOCK_SIZE 0x3A //Number of data bytes in a standard request to the PC. Must be an even number from 2-58 (0x02-0x3A). Larger numbers make better use of USB bandwidth and
//yeild shorter program/verify times, but require more micrcontroller RAM for buffer space.
/** USB Packet Request/Response Formatting Structure **********************************************************/
typedef union
{
@@ -397,7 +395,7 @@ void ProcessIO(void)
//in this firmware and is available for requesting by the host software.
PacketToPC.Command = QUERY_EXTENDED_INFO; //Echo the command byte
PacketToPC.BootloaderVersion = ((unsigned int)BOOTLOADER_VERSION_MAJOR << 8)| BOOTLOADER_VERSION_MINOR;
PacketToPC.ApplicationVersion = *(const unsigned int*)APP_FW_VERSION_ADDRESS;
memcpy(&PacketToPC.ApplicationVersion, (void*)APP_FW_VERSION_ADDRESS, 2);
PacketToPC.SignatureAddress = APP_SIGNATURE_ADDRESS;
PacketToPC.SignatureValue = APP_SIGNATURE_VALUE;
PacketToPC.ErasePageSize = ERASE_PAGE_SIZE;

View File

@@ -17,7 +17,10 @@
* IF YOU FLASH BROKEN APPLICATION FIRMWARE YOU WILL HAVE A BRICK!!
* At that point the device can only be reprogrammed by a dedicated programmer such as the ICD or Pickit 3.
*/
#define ENABLE_HARDWARE_MODE_OVERRIDE
// Yep, I'm disabling it anyway. the boards aren't designed to accomodate another pull-up resistor
// or pushbutton. a jump from application code is sufficient since you shouldn't be flashing modified or
// untested firmware without a pickit anyway.
//#define ENABLE_HARDWARE_MODE_OVERRIDE
/* Private prototypes */
void main(void);

View File

@@ -168,7 +168,7 @@
<property key="use-iar" value="false"/>
<property key="verbose" value="false"/>
<property key="warning-level" value="-3"/>
<property key="what-to-do" value="ignore"/>
<property key="what-to-do" value="require"/>
</HI-TECH-COMP>
<HI-TECH-LINK>
<property key="additional-options-checksum" value=""/>

View File

@@ -30,8 +30,8 @@
#include "memory.h"
#ifdef LINK_FOR_BOOTLOADER
// only define this if building fw to be used with the bootloader
const uint16_t VersionWord __at(APP_FW_VERSION_ADDRESS) = 0x0100;
// the version word of this application - will be read and displayed by the firmware flash utility
const unsigned int VersionWord __at(APP_FW_VERSION_ADDRESS) = 0x0100;
#endif
void main(void)