cancel
Showing results for 
Search instead for 
Did you mean: 

Set boot address on stm32f446 nucleo

NGros
Associate III

Hi there!

I want so offset the application in the flash at 0x08004000, so that I can use the first sector 0 for individual persistent data. I found out that I have to change the following lines:

FLASH (rx)   : ORIGIN = 0x8004000, LENGTH = 496K (Linker Script)

#define VECT_TAB_OFFSET 0x4000 (system file of stm32f446)

So direct after flashing, the program is running (blinking led), but after power-cycling the stm, it does not start again. Could it be that the bootloader is still configured to start the application at 0x08000000? If this is the last problem I have here, how can I modify the address there?

With help of the stm utility tool, I can open the option bytes but it seems that the BOOT_ADD0 option is locked ! (See picture in attachment)

Is it this address ofset there which has also to be 0x4000?

In the datasheet, I can also not see an option to set an address for the bootloader in the FLASH_OPTCR Register. There are only options which I already can edit in the option bytes window of the stm utility tool.

I really would appreciate your help! Thanks.

Best Regards

5 REPLIES 5
TDK
Guru

The STM32F4 does not have a BOOT_ADD0 setting.

You need to put a program at 0x08000000 which jumps to your program at 0x08004000.

If you feel a post has answered your question, please click "Accept as Solution".
NGros
Associate III

Thanks for that helpful answer! I honestly don't know how to do that, do you have a good reference for it?

TDK
Guru

Here's an example that jumps to the bootloader. Do this, except jump to your program instead.

https://stm32f4-discovery.net/2017/04/tutorial-jump-system-memory-software-stm32/

You'll need to make a small program that does this and place it at the flash boot address.

If you feel a post has answered your question, please click "Accept as Solution".
NGros
Associate III

Thanks!! Btw.: The shematic shows that BOOT0 Pin is pulled down to ground, that means (according to datasheet), Main Flash memory is selected as the boot area. How is it possible then to flash a custom bootloader at 0x08000000 without overwriting the actual bootloader?

The system bootloader is not at 0x08000000, and it is in ROM so cannot be erased.
There is nothing at 0x08000000 on a brand new chip, hence the need to put something there if you want to run user code.
If you feel a post has answered your question, please click "Accept as Solution".