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 init code and main() function be executed upon
power up of the microcontroller. And this would be the case if I only
flash the bootloader’s .elf onto the flash (0xFFFE pointing to
bootloader’s main() function).

But when I then program the application’s image onto the flash the
0xFFFE will point to the application’s reset vector which is not a
bootloader anymore. I'd like to configure my application so that it
always fills 0xFFFE with a fixed address (0x4400).

The rest of the story is that when bootloader is started 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,
Tomek

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to