-deleted-
7 years, 4 months ago.

Dynamic Link Address at Compile Time

This library is especially awesome when using it together with the Bootloader_K64F library: http://developer.mbed.org/users/Sissors/code/Bootloader_K64F/wiki/Homepage

Is there a way to use dynamic #define logic to combine these libraries so that the available Flash sectors are maximized to use the upper most sectors depending on the Kinetis MCU, K64F or K22F?

One simple example is something like:

#define ARM_LRA_BOOTLOADER      ".ARM.__at_0x10000"  //ARM Load Region Address

__attribute__((section(ARM_LRA_BOOTLOADER))) void bootloader(void)
{

Perhaps this can be dynamic, in that compiler automatically knows the flash size and therefore the upper address region and then dynamically maps functions below each other. Perhaps this is overly complex and not worthwhile?

Question relating to:

IAP code for Freescale platforms

1 Answer

7 years, 4 months ago.

There are two problems: The first one is knowing the flash size. When making FreescaleIAP I was not able to figure out any method to find the flash size, outside of making a table (so #ifdef TARGET_K64F, #define FLASH_SIZE ...) at compile time. In the end I settled for doing it at runtime, where I was able to do it by reading registers back, but that won't work for your question here.

Second problem is getting the bootloader to recide at the correct location. From how you posted it here it should be doable, however there are other functions (in the FreescaleIAP) code which needs to be moved, with a relative offset. And I have not been able to get it to do more than create compiler errors when doing that. (So effectively I wanted to replace your ARM_LRA_BOOTLOADER define by something like ARM_LRA_BOOTLOADER(location, offset)).

Accepted Answer

Thanks Erik, I understand the complexity after reviewing the K64F Reference Manual which describes the Memory Map and page 631 describes the Flash Memory Controller (FMC): /media/uploads/ebowles/k64p144m120sf5rm.pdf#page=631

posted by -deleted- 01 Apr 2015