Skip to main content
XYZ123
Associate
July 3, 2019
Question

If the bootloader can jump to any flash address? in other words, if the app address must meet some alignment requirements? My test is it only works when app address offset is multiple of 0x8000, is it right?

  • July 3, 2019
  • 3 replies
  • 1261 views

..

This topic has been closed for replies.

3 replies

Piranha
Principal III
July 3, 2019

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646a/Ciheijba.html

Therefore alignment depends on specific MCU, but it definitely isn't as high as 0x8000 bytes.

XYZ123
XYZ123Author
Associate
July 3, 2019

according to link, it seems should work as long as the app address's least 7 bits are 0.

Tesla DeLorean
Guru
July 3, 2019

It is usually a function of the vector table size in a given implementation. Take the last vector and round to the next binary multiple​, on most STM32 likely 512 byte boundaries.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
XYZ123
XYZ123Author
Associate
July 4, 2019

thank for your reply. for stm32f303, my app scatter file is

LR_IROM1 0x0800C000 0x00032000 {  ; load region size_region

 ER_IROM1 0x0800C000 0x00032000 { ; load address = execution address

  *.o (RESET, +First)

  *(InRoot$$Sections)

  .ANY (+RO)

  .ANY (+XO)

 }

 RW_IRAM1 0x20000000 0x0000C000 { ; RW data

  .ANY (+RW +ZI)

 }

 RW_IRAM2 0x10000000 UNINIT 0x00002000 {

  mode_keys.o (+RW)

  exception_mem.o (+RW)

 }

}

my bootloader jump process is

        typedef void (*pFunction)(void);

pFunction Jump = (pFunction) (*(uint32_t*)(FLASH_ONCHIP_APP + 4));

        SCB->VTOR = FLASH_ONCHIP_APP;

        __set_MSP(*(uint32_t*)FLASH_ONCHIP_APP);

        Jump();

Why it does not work?

XYZ123
XYZ123Author
Associate
July 4, 2019

fixed. I forgot set VECT_TAB_OFFSET