Hi,
My use case is the following: I have a bootloader (up to 4K in size, residing at 0x4400 to 0x5400) that has a main() function and application (starting from 0x4800) – they are organized as 2 separate projects (I want the bootloader to be flashed only once and not changed later).
I am using mspgcc.
Bootloader and application linker scripts are defined so that their .text sections (that go to “rom” memory region) are separated but they use the same “vector” memory region for .vector section (although the bootloader does not use any interrupts other than reset):
bootloader’s linker script excerpt:
MEMORY { … rom (rx) : ORIGIN = 0x4400, LENGTH = 0x1000 /* END=0x5400, size 4K - bootloader code */ rom_app (rx) : ORIGIN = 0x5400, LENGTH = 0xab80 /* END=0xff80, size 43904 - the field-updatable application */ vectors : ORIGIN = 0xff80, LENGTH = 0x0080 /* END=0x10000, size 128 as 64 2-byte segments */ … }
and the application’s linker script excerpt:
MEMORY { … rom (rx) : ORIGIN = 0x5400, LENGTH = 0xab80 /* END=0xff80, size 43904 */ vectors : ORIGIN = 0xff80, LENGTH = 0x0080 /* END=0x10000, size 128 as 64 2-byte segments */ … }
I need the bootloader’s main() function to be executed upon power up of the microcontroller. And this would be the case if I only flashed the bootloader’s .elf onto the flash (0xFFFE pointing to bootloader’s main() function).
But when I program the application’s image onto the flash the 0xFFFE will point to the application’s reset vector which is not a bootloader anymore.
Then of course the bootloader needs to jump to and execute the application’s entry point (0x5400) including the app's watchdog preparation, stack init etc.
Is that doable? How can I define in the application’s code that the reset vector (0xFFFE) shall contain the bootloader’s init code (0x4400)?
Best Regards,
tml