Showing results for 
Search instead for 
Did you mean: 

"After system reset, the bootloader cannot find the app."

Associate II

Hi everyone,
My bootloader is located at address 0x08000000,

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 32K

#define VECT_TAB_OFFSET 0x00000000U

and the app is at 0x08008000.

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K
FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 480K

#define VECT_TAB_OFFSET 0x00008000U

After using HAL_NVIC_SystemReset(), the system restarts, runs the bootloader, and jumps to address 0x08008000 to begin executing the app. However, it shows that the app cannot be found at address 0x08008000. Is my app deleted from flash memory, or is there another reason?


Can't you check via programmer / debugger what's stored in flash?

It's always nice to have some printf / UART / terminal for debugging, for bootloader and app.

I'm currently working on a bootloader and this helps to check flash - or any other memory area.

But beware, wrong address and the MCU hangs...

#define PTR_TEST_RD_LEN		1024

	uint32_t i = 0;
	uint32_t u32MemAddr = 0;
	uint32_t u32RdLen = 0;

	/* get start address and read length */
	sscanf((char *)u8UartDbgRxBuf, "%*s %*s %lx %lx", &u32MemAddr, &u32RdLen);

	/* check length */
	if( u32RdLen == 0 ) u32RdLen = PTR_TEST_RD_LEN;
	if( u32RdLen > PTR_TEST_RD_LEN ) u32RdLen = PTR_TEST_RD_LEN;

	/* check address */

	uart_printf("u32MemAddr = %08lX\n\r", u32MemAddr);
	uart_printf("u32RdLen   = %08lX = %lu\n\r", u32RdLen, u32RdLen);

/* 8 bit pointer */
	uint8_t *pu8MemAddr = (uint8_t *)u32MemAddr;

	uart_printf("pu8MemAddr = %08lX\n\r", (uint32_t)pu8MemAddr);

	uart_printf("### ATTENTION: MCU might hang if no memory at addr ###\n\r");

/* read memory and display */
	uint32_t j = 0;

	for( i = 0; i < u32RdLen; i++ )
		if( i % 16 == 0 )
			uart_printf("\n\r%08lX:  ", (u32MemAddr + i));
			for( j = 0; j < 16; j++ ) uart_printf("%02X ", pu8MemAddr[i + j]);
			for( j = 0; j < 16; j++ )
				if( (pu8MemAddr[i + j] >= ASCII_PRINT_MIN) && (pu8MemAddr[i + j] <= ASCII_PRINT_MAX) )
					uart_printf("%c", (char)pu8MemAddr[i + j]);
	uart_printf("%lu bytes read\n\r", u32RdLen);

Thank you. I just confirmed that the data at the app address (0x08008000) is correct. I think there might be an error in the bootloader's function for entering the app.


You have defined VECT_TAB_OFFSET for the app - but do you actually set the register SCB->VTOR?

That's what I forgot at first... 

Instrument your code and dump memory so you might see code flow, decisions and content, via serial port.

Double check the image validity criteria, see if the initial SP and RAM addresses make sense. 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Evangelist III

Try to change your app ld file like this:


 FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 480K
 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K


Associate II

Thanks guys,

I've discovered that the function responsible for jumping to the app in my bootloader had an error. It's necessary to disable interrupts for it to succeed.

Adding __disable_irq() in the function resulted in success!!