2020-03-31 02:53 AM
Hi everyone,
I'm following the LWIP_IAP application in STM32756G_EVAL 's Repository. The bootloader work fine, but I don't know how to config the application firmware to boot from a specify address flash.
Is this the right way to config flash memory of app firmware via .ld file like this
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x8019000, LENGTH = 924K
}
I spend 100Kb for bootloader.
One more question, could I use ST-Link Utility to program my application firmware. For testing purpose, in case my bootloader doesn't work correctly?
Thanks in advance
2020-03-31 04:28 AM
Need to also change address programmed into SCB->VTOR in SystemInit()
Yes, can write App via ST-LINK
2020-03-31 06:33 AM
I think your user program start is not on a page boundary. This will give trouble. Either you erase the end of the bootlaoder or your can not erase the start of the user program!
2020-03-31 07:34 PM
Thank both of you. I followed your instructions, but my app still failed to start.
Here is the code to jump into apps from bootloader
if (((*(__IO uint32_t*)USER_FLASH_FIRST_PAGE_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (USER_FLASH_FIRST_PAGE_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) USER_FLASH_FIRST_PAGE_ADDRESS);
Jump_To_Application();
/* do nothing */
while(1);
}
#define USER_FLASH_FIRST_PAGE_ADDRESS 0x08020000
I changed my STM32F767VGTX_FLASH.ld file:
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x8020000, LENGTH = 896K
}
Also set SCB->VTOR :
#define VECT_TAB_OFFSET 0x20000
void SystemInit(void){
...
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
}
I don't know if I still missing something?
Thanks
2020-04-01 10:57 PM
One more strange thing:
The value store in address 0x8020000 is 0x20080000 which mean if (((*(__IO uint32_t*)USER_FLASH_FIRST_PAGE_ADDRESS) & 0x2FFE0000 ) == 0x20000000) will return false condition. That 's why my bootloader can't jump to my app.
2020-04-27 02:02 AM
Hi clive1,
Could you help me point out what I have done wrong. I followed all your instructions, but I still cannot jump to my app. I compiled the code in Keil C, it works well. Here is some clues:
One more strange thing:
The value store in address 0x8020000 is 0x20080000 which mean if (((*(__IO uint32_t*)USER_FLASH_FIRST_PAGE_ADDRESS) & 0x2FFE0000 ) == 0x20000000) will return false condition. That 's why my bootloader can't jump to my app.
Thank you.
2020-04-27 01:30 PM
Don't post the same content multiple times!
> The value store in address 0x8020000 is 0x20080000 which mean if (((*(__IO uint32_t*)USER_FLASH_FIRST_PAGE_ADDRESS) & 0x2FFE0000 ) == 0x20000000) will return false condition. That 's why my bootloader can't jump to my app.
So you already know where the problem is. Why don't you solve it? Have you answered to yourself what that code does?
2020-04-27 06:06 PM
Sorry, my bad. I tried to change mask value from 0x2FFE0000 to 0x2FF00000 , so I can jump from bootloader to app. But I don't think it is correct way.
BTW, If I compile the code in Keil C, I have different first 4 bytes in flash (0x20008098) which is satisfy bootloader requirement (0x20008098 & 0x2FFE0000 =0x20000000). Isn't it weird?
Thank you.
2020-04-28 12:57 AM
You still haven't answered the following questions:
By the way, as everything with ST's software, this booting approach is terrible anyway. Read my description of a much better and simpler approach here: