Loading...
 

System Workbench for STM32


Bootloader re-entry point from app on STM32F072

France

Hi everyone,

I’m using a custom board with STM32F072CB on board.
I’m using a custom bootloader and a simple app that make blink a led.

I modified the linker script of app to start at the right address.
-----------------------------------
linker script of app:
---------
/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = 0x20004000; /* end of RAM */

_Min_Heap_Size = 0; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */

/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x200000C0, LENGTH = 16K - 0xC0
ROM (rx) : ORIGIN = 0x08002000, LENGTH = 128K - 0x2000
}
...
-----------------------------------
in my bootloader, i would like create an re-entry point (hot start) from app, so i try to modified the linker script to avec a start section like this:

/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = 0x20002000; /* end of 8K RAM on AHB bus*/

/* Generate a link error if heap and stack don’t fit into RAM */
_Min_Heap_Size = 0; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */

/* Specify the memory areas */
MEMORY
{
FLASH (rx)  : ORIGIN = 0x08000000, LENGTH = 16K - 16
RESTART (rx)  : ORIGIN = 0x08001FFC, LENGTH = 4
RAM (xrw)  : ORIGIN = 0x20000000, LENGTH = 8K
MEMORY_B1 (rx)  : ORIGIN = 0x60000000, LENGTH = 0K

}

/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH

.restart_vector :
{
. = ALIGN(4);
KEEP(*(.restart_vector)) /* ReStartup code */
. = ALIGN(4);
} >RESTART
-----------------------------------
in my code i added this section:
// The vector table.
// This relies on the linker script to place at correct location in memory.
typedef void (* const pRestart)(void);

attribute ((section(“.restart_vector”),used))
pRestart Restart_Vectors[] = { (pRestart) Restart };

anyone could help me ?
thanks