This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

flash sector management for bootloader and main program

Genius 5910 points

I want to make a bootloader function in my application.

My starting point is example  f28069_flash_kernel  that is pretty straight forward.
Only I  want to split the bootloader and main program in flash.

 I want to dedicate flash sector A of H for the bootloader and the rest of my main program.

 I was thinking something like this:

void main (void)

{

 Init hardware.

if (runbootloader == true)

{

 copy  bootloader to memory;

 start bootloader function

restart;

}

start main program.

}

My question is: how do I keep the code separated in FLASH?

Thanks!