Other Parts Discussed in Thread: MSP430F5529,
Hi everyone,
I want to design Main Memory Bootloader and I am taking reference from slaa600d and MSP430F5529_Examples for Main Memory Bootloader.
I have a requirement where I have Bootloader, Application1 and Application2 sharing the MSP430F5438A flash. And MSP430F5438A should be able to reprogram itself in Application2 area using Bootloader without any external event and interference. Application1 is the backup Application which will be untouched by Bootloader. So basically the MSP430 receives the new code to be programmed from an external processor over CAN and stores it in a serial SPI flash. Then it resets itself to go to bootloader. Bootloader reads the code from serial SPI flash and downloads the new code to the Application2 area. In case of any problem, we have the default backup application in Application1 area which is untouched and Bootloader can jump to it if any problem and corruption in Application2.
So there is no need for me to use Communication Interface Code.
I am not using custom BSL because it restricts the Bootloader code to 2KB. For the time being, I am putting my bootloader in the lower flash and divide the upper flash into two regions for Application1 and Application2.
Also, I am putting the proxy reset vectors in the lower flash and the proxy vector addresses are shared by Application1 and Application2 both. Is it possible? I am not using Vector redirection to RAM because there is always a possibility of RAM corruption even though I know with vector redirection to RAM, proxy vector addresses will be logically separated.
I am still in the idea stage and I have attached my three linker command files in the text format. They are Bootloader.txt, App1.txt, and App2.txt. I would like to know if there are any potential problems in the linker cmd files. Please have a look at it.
Any suggestions, possible point of failures and workarounds will be helpful for me.
P.S. I am using almost all lower flash almost 40 KB for the bootloader and 216 KB upper flash for Application1 + Application2 for testing purposes at the initial stage.
Thanks and Regards,
Ankit
/******************************************************************************/
/* LINKER COMMAND FILE FOR MSPBoot BOOTLOADER USING msp430f5529 */
/* File generated with MSPBoot_linkergen_Flash.pl on 06-22-2017 */
/*----------------------------------------------------------------------------*/
/****************************************************************************/
/* SPECIFY THE SYSTEM MEMORY MAP */
/****************************************************************************/
/* The following definitions can be changed to customize the memory map for a different device
* or other adjustments
* Note that the changes should match the definitions used in MEMORY and SECTIONS
*
*/
/* RAM Memory Addresses */
__RAM_Start = 0x1C00; /* RAM Start */
__RAM_End = 0x5BFF; /* RAM End */
/* RAM shared between App and Bootloader, must be reserved */
PassWd = 0x1C00; /* Password sent by App to force boot mode */
StatCtrl = 0x1C02; /* Status and Control byte used by Comm */
/* Unreserved RAM used for Bootloader or App purposes */
_NonReserved_RAM_Start = 0x1C03; /* Non-reserved RAM */
/* Flash memory addresses */
/* App area : 4400-F3FF & 10000-149FF*/
/* Download area: 14A00-243FF*/
/* Boot area : F400-FFFF*/
_Appl1_Start = 0x10000; /* Start of Application1 area */
_Appl1_End = 0x2ADFF; /* End of Application1 area */
_Appl2_Start = 0x2AE00; /* Start of Application2 area */
_Appl2_End = 0x45BFF; /* End of Application2 area */
/* Reserved Flash locations for Bootloader Area */
__Boot_Start = 0x5CFE; /* Boot flash */
__Boot_Reset = 0xFFFE; /* Boot reset vector */
__Boot_VectorTable = 0xFF80; /* Boot vector table */
//__Boot_SharedCallbacks_Len = 6; /* Length of shared callbacks (2 calls =4B(msp430) or 8B(msp430x) */
//__Boot_SharedCallbacks = 0xFF7A; /* Start of Shared callbacks */
_Appl_Proxy_Vector_Start = 0x5C00; /* Proxy interrupt table */
/* Reserved Flash locations for Application Area */
_Appl1_Checksum_Checksum = (_Appl1_Start); /* CRC16 of Application */
_Appl1_Start_Memory = (_Appl1_Start+2); /* Application Area */
_Appl1_CRC_Size1 = (_Appl1_End - _Appl1_Start_Memory +1); /* Number of bytes in lower memory calculated for CRC */
_Appl2_Checksum = (_Appl2_Start); /* CRC16 of Application */
_Appl2_Start_Memory = (_Appl2_Start+2); /* Application Area */
_Appl2_CRC_Size1 = (_Appl2_End - _App2_Start_Memory +1); /* Number of bytes in lower memory calculated for CRC */
_Appl_Reset_Vector = (__Boot_Start - 2);
/* MEMORY definition, adjust based on definitions above */
MEMORY
{
SFR : origin = 0x0000, length = 0x0010
PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0
PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100
// RAM from _NonReserved_RAM_Start - __RAM_End
RAM : origin = 0x1C03, length = 0x3FFC
// Flash from __Boot_Start -( __Boot_SharedCallbacks or INT_VECTOR_TABLE)
FLASH : origin = 0x5CFE, length = 0xA282
// Shared callbacks from __Boot_SharedCallbacks + Len (when used)
//BOOT_SHARED_CALLBACKS : origin = 0xFF7A, length = 6
// Boot vector Table from __Boot_VectorTable- __Boot_Reset
INT_VECTOR_TABLE : origin = 0xFF80, length = 0x7E
// Boot reset from __Boot_Reset-_Flash_End
RESET : origin = 0xFFFE, length = 0x0002
}
/****************************************************************************/
/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
/****************************************************************************/
SECTIONS
{
.bss : {} > RAM /* GLOBAL & STATIC VARS */
.data : {} > RAM /* GLOBAL & STATIC VARS */
.sysmem : {} > RAM /* DYNAMIC MEMORY ALLOCATION AREA */
.stack : {} > RAM (HIGH) /* SOFTWARE SYSTEM STACK */
.text : {} >> FLASH /* CODE */
.cinit : {} > FLASH /* INITIALIZATION TABLES*/
.const : {} >> FLASH /* CONSTANT DATA */
.cio : {} > RAM /* C I/O BUFFER */
.BOOT_APP_VECTORS : {} > BOOT_SHARED_CALLBACKS
/* MSP430 INTERRUPT VECTORS */
.BOOT_VECTOR_TABLE : {} > INT_VECTOR_TABLE
.reset : {} > RESET /* MSP430 RESET VECTOR */
}
/****************************************************************************/
/* INCLUDE PERIPHERALS MEMORY MAP */
/****************************************************************************/
-l msp430f5438a.cmd
/******************************************************************************/
/* LINKER COMMAND FILE FOR MSPBoot BOOTLOADER USING msp430f5529 */
/* File generated with MSPBootLinkerGen.pl on 06-22-2017 */
/*----------------------------------------------------------------------------*/
/****************************************************************************/
/* SPECIFY THE SYSTEM MEMORY MAP */
/****************************************************************************/
/* The following definitions can be changed to customize the memory map for a different device
* or other adjustments
* Note that the changes should match the definitions used in MEMORY and SECTIONS
*
*/
/* RAM Memory Addresses */
__RAM_Start = 0x1C00; /* RAM Start */
__RAM_End = 0x5BFF; /* RAM End */
/* RAM shared between App and Bootloader, must be reserved */
PassWd = 0x1C00; /* Password sent by App to force boot mode */
StatCtrl = 0x1C02; /* Status and Control byte used by Comm */
/* Unreserved RAM used for Bootloader or App purposes */
_NonReserved_RAM_Start = 0x1C03; /* Non-reserved RAM */
/* Flash memory addresses */
__Flash_Start = 0x10000; /* Start of Application area */
/* Reserved Flash locations for Bootloader Area */
__Boot_Start = 0x5CFE; /* Boot flash */
__Boot_Reset = 0xFFFE; /* Boot reset vector */
__Boot_VectorTable = 0xFF80; /* Boot vector table */
//__Boot_SharedCallbacks_Len = 6; /* Length of shared callbacks (2 calls =4B(msp430) or 8B(msp430x) */
//__Boot_SharedCallbacks = 0xFF7A; /* Start of Shared callbacks */
//_BOOT_APPVECTOR = __Boot_SharedCallbacks; /* Definition for application table */
_Appl_Proxy_Vector_Start = 0x5C00; /* Proxy interrupt table */
/* Reserved Flash locations for Application Area */
/* MEMORY definition, adjust based on definitions above */
MEMORY
{
SFR : origin = 0x0000, length = 0x0010
PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0
PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100
// RAM from _NonReserved_RAM_Start - __RAM_End
RAM : origin = 0x1C03, length = 0x3FFC
// Info Mem Sections
INFOA : origin = 0x1980, length = 0x80
INFOB : origin = 0x1900, length = 0x80
INFOC : origin = 0x1880, length = 0x80
INFOD : origin = 0x1800, length = 0x80
// Flash from _App_Start -> (APP_PROXY_VECTORS-1)
FLASH : origin = 0x10000, length = 0x1AE00
// Interrupt Proxy table from _App_Proxy_Vector_Start->(RESET-1)
APP_PROXY_VECTORS : origin = 0x5C00, length = 252
// App reset from _App_Reset_Vector
RESET : origin = 0x5CFC, length = 0x0002
}
/****************************************************************************/
/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
/****************************************************************************/
SECTIONS
{
.bss : {} > RAM /* GLOBAL & STATIC VARS */
.data : {} > RAM /* GLOBAL & STATIC VARS */
.sysmem : {} > RAM /* DYNAMIC MEMORY ALLOCATION AREA */
.stack : {} > RAM (HIGH) /* SOFTWARE SYSTEM STACK */
.text:_isr : {} > FLASH /* Code ISRs */
.text : {} >> FLASH /* CODE */
.cinit : {} > FLASH /* INITIALIZATION TABLES*/
.const : {} >> FLASH /* CONSTANT DATA */
.cio : {} > RAM /* C I/O BUFFER */
.infoA : {} > INFOA /* MSP430 INFO FLASH Memory segments */
.infoB : {} > INFOB
.infoC : {} > INFOC
.infoD : {} > INFOD
.APP_PROXY_VECTORS : {} > APP_PROXY_VECTORS /* INTERRUPT PROXY TABLE */
.reset : {} > RESET /* MSP430 RESET VECTOR */
}
/****************************************************************************/
/* INCLUDE PERIPHERALS MEMORY MAP */
/****************************************************************************/
-l msp430f5438a.cmd
/******************************************************************************/
/* LINKER COMMAND FILE FOR MSPBoot BOOTLOADER USING msp430f5529 */
/* File generated with MSPBootLinkerGen.pl on 06-22-2017 */
/*----------------------------------------------------------------------------*/
/****************************************************************************/
/* SPECIFY THE SYSTEM MEMORY MAP */
/****************************************************************************/
/* The following definitions can be changed to customize the memory map for a different device
* or other adjustments
* Note that the changes should match the definitions used in MEMORY and SECTIONS
*
*/
/* RAM Memory Addresses */
__RAM_Start = 0x1C00; /* RAM Start */
__RAM_End = 0x5BFF; /* RAM End */
/* RAM shared between App and Bootloader, must be reserved */
PassWd = 0x1C00; /* Password sent by App to force boot mode */
StatCtrl = 0x1C02; /* Status and Control byte used by Comm */
/* Unreserved RAM used for Bootloader or App purposes */
_NonReserved_RAM_Start = 0x1C03; /* Non-reserved RAM */
/* Flash memory addresses */
__Flash_Start = 0x2AE00; /* Start of Application area */
/* Reserved Flash locations for Bootloader Area */
__Boot_Start = 0x5CFE; /* Boot flash */
__Boot_Reset = 0xFFFE; /* Boot reset vector */
__Boot_VectorTable = 0xFF80; /* Boot vector table */
//__Boot_SharedCallbacks_Len = 6; /* Length of shared callbacks (2 calls =4B(msp430) or 8B(msp430x) */
//__Boot_SharedCallbacks = 0xFF7A; /* Start of Shared callbacks */
//_BOOT_APPVECTOR = __Boot_SharedCallbacks; /* Definition for application table */
_Appl_Proxy_Vector_Start = 0x5C00; /* Proxy interrupt table */
/* Reserved Flash locations for Application Area */
/* MEMORY definition, adjust based on definitions above */
MEMORY
{
SFR : origin = 0x0000, length = 0x0010
PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0
PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100
// RAM from _NonReserved_RAM_Start - __RAM_End
RAM : origin = 0x1C03, length = 0x3FFC
// Info Mem Sections
INFOA : origin = 0x1980, length = 0x80
INFOB : origin = 0x1900, length = 0x80
INFOC : origin = 0x1880, length = 0x80
INFOD : origin = 0x1800, length = 0x80
// Flash from _App_Start -> (APP_PROXY_VECTORS-1)
FLASH : origin = 0x2AE00, length = 0x1AE00
// Interrupt Proxy table from _App_Proxy_Vector_Start->(RESET-1)
APP_PROXY_VECTORS : origin = 0x5C00, length = 252
// App reset from _App_Reset_Vector
RESET : origin = 0x5CFC, length = 0x0002
}
/****************************************************************************/
/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
/****************************************************************************/
SECTIONS
{
.bss : {} > RAM /* GLOBAL & STATIC VARS */
.data : {} > RAM /* GLOBAL & STATIC VARS */
.sysmem : {} > RAM /* DYNAMIC MEMORY ALLOCATION AREA */
.stack : {} > RAM (HIGH) /* SOFTWARE SYSTEM STACK */
.text:_isr : {} > FLASH /* Code ISRs */
.text : {} >> FLASH /* CODE */
.cinit : {} > FLASH /* INITIALIZATION TABLES*/
.const : {} >> FLASH /* CONSTANT DATA */
.cio : {} > RAM /* C I/O BUFFER */
.infoA : {} > INFOA /* MSP430 INFO FLASH Memory segments */
.infoB : {} > INFOB
.infoC : {} > INFOC
.infoD : {} > INFOD
.APP_PROXY_VECTORS : {} > APP_PROXY_VECTORS /* INTERRUPT PROXY TABLE */
.reset : {} > RESET /* MSP430 RESET VECTOR */
}
/****************************************************************************/
/* INCLUDE PERIPHERALS MEMORY MAP */
/****************************************************************************/
-l msp430f5438a.cmd