cleanup of all memory address-critical code so changing the location of the application code is more straightforward

This commit is contained in:
2019-08-14 01:52:10 -04:00
parent a90344ef4c
commit 568f42676f
4 changed files with 37 additions and 21 deletions

View File

@@ -18,24 +18,48 @@
*************************************************************************/
/**
* @file memory.
* @file memory.h
* @author Justin Byers
* @date August 11, 2019
* @brief
* @brief Program flash memory addresses of data relocated to work with the bootloader.
*
*/
#ifndef MEMORY_
#define MEMORY_
/**
* When changing the location of the application in flash memory these files and settings
* must be updated.
* In bootloader project:
* VectorRemap.asm HiVector goto -> APP_FW_MEMORY_OFFSET + 0x08
* LoVector goto -> APP_FW_MEMORY_OFFSET + 0x18
* Configuration > Linker > Memory Model > ROM space -> default,-APP_FW_MEMORY_OFFSET-7FFF
* In application project:
*
*/
/**
* The base address of the application memory space. The application's reset vector will be
* at this address.
*/
#define APP_FW_MEMORY_OFFSET 0x2000
#define BOOTLOADER_ENTRYPOINT 0x001C
/**
* The address in application memory space that stores the application's version number.
*/
#define APP_FW_VERSION_ADDRESS (APP_FW_MEMORY_OFFSET + 0x16)
#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 APP_FW_VERSION_ADDRESS //0x1C16 and 0x1C17 should contain the application image firmware version number
/**
* The address in application memory space that stores the signature word written by
* the bootloader after a sucessful flash of application firmware.
*/
#define APP_SIGNATURE_ADDRESS (APP_FW_MEMORY_OFFSET + 0x06)
/**
* The absolute address of the bootloader entrypoint. The application can jump to the
* bootloader by executing a "goto" instruction with this address.
*/
#define BOOTLOADER_ENTRYPOINT 0x001C
#endif /* MEMORY_ */