cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Bootloader implementation on STM32L4S5

usha
Associate

Hi,

We are working on product based on STM32L4S5 based MCU. We implemented the bootloader which are able to boot from base address (binary image starting from base address 0x08022000). Current implementation doesn't have any validation.

But due to security reason we have implemented 512 bytes of header at starting at 0x08022000 address and moved application to the address 0x08022200. We made the necessary changes in bootloader like...

unsigned long *FLASH_RST_ADDR = (unsigned long*) 0x08022204U;

unsigned long *FLASH_MSP_ADDR = (unsigned long*) 0x08022200U;

 

And in application we have changed the linker script and vector table offset values

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K

RAM2 (xrw) : ORIGIN = 0x10000000, LENGTH = 64K

RAM3 (xrw) : ORIGIN = 0x20040000, LENGTH = 384K

FLASH (rx) : ORIGIN = 0x08022200, LENGTH = 400K

}

#define VECT_TAB_OFFSET 0x08022200U.

After adding the header and changing the offset value, we are unable to run the application through bootloader.

(Its going to Hardfault).

Please help us to resolve this issue.

@stm32 

 

3 REPLIES 3
Radosław
Senior II

All what you write  lokks good,  for help you need provide more information.

 

0x08022204U  this addres seems to be out of flash range

usha
Associate

Hi Radoslaw,

     As per the memory organization of the stm32l4S5 controller the address 0x08022204 is part of the page17.

 

usha_0-1718364232444.png

I think we are missing where to change the linker address and vector address. can you please specify what more information is required from our side?

Radosław
Senior II

Hard to gess,  anu debug,  call stack,  hardfault is on booloader side or aplication. ....