AnsweredAssumed Answered

AN2295 Section specification for bootloader code

Question asked by Roger Pease on May 25, 2015
Latest reply on Jan 7, 2016 by Mark Butcher

I am using an MK10DX64VLH7 processor and trying to use the Developer's Serial Bootloader in AN2295.


We are using Processor Expert with GCC.

 

My main code is split into roughly three sections....

 

GeneratedCode/*.{h,c} <--- Stuff Processor expert generates

 

Sources/Bootloader/bootloader.c    <---- Stuff leveraged from Common_source of the AN2295 distribution

Sources/Bootloader/flash_kinetis.c

Sources/Bootloader/flash_kinetisRamFuncs.c

Sources/Bootloader/crc.c

Sources/Bootloader/rs232.c

 

Sources/*.{c,h}  <---- Application code I have written.

 

My understanding of the requirements is:

1) I need to use the AN2295 interrupt vectors (which are defined for CodeWarrior, ARMCC and IAR). I

presume I should just use whatever is used with CodeWarrior since I'm not using a Keil or IAR compiler. 

2) I need to keep the bootloader in the first 0x2000 bytes of the flash. The idea is that at powerup the Bootloader will run first and decide that if it needs to run bootloader code or my application code. If the bootloader needs to do an update it will update 0x2000-0xFFFF.

 

So my main question is in GCC what is the best way to guarantee that my Sources/Bootloader/* .text code appears in 0x0400-0x2000 and the rest of my code appears in 0x2000-0xFFFF?

 

I tried this:

 

MEMORY {

...

m_bootloader      (RX) : ORIGIN = 0x00000410, LENGTH = 0x00001BE0

...

}

 

  .bootloader :

  {

  *bootloader.o (.text);

    *flash_kinetis.o (.text);

    *flash_kinetisRamFunc.o (.text);

    *crc.o (.text);

    *rs232.o (.text);

  } > m_bootloader

 

Following embedded - Put gcc libs .data in specific section? - Stack Overflow but that doesn't seem to have done the trick.

 

Do I need to put section attributes on all the Bootloader functions (or all my application and PE functions)? From what I've also read gcc doesn't support or recommend section pragmas.

 

Or is there a better way to do all of this i am not aware of?

 

Thanks,


Roger

Outcomes