2023-10-12 01:50 AM
I'm working on a bootloader with an STM32F072 device. At the end of the programming process, I followed the steps in the link below to switch to the user application:
I applied these steps to both the user application and the bootloader application (the transition should have been from the user application to the bootloader application). After doing this, I can easily write data to the 0x08004000 address, but the problem starts here. Without optimization, I write data to the 0x08003800 address, and after a while, when it reaches the page boundaries, it stops writing data. This only happens for values below the 0x08004000 address. The HAL_FLASH_PROGRAM command gets corrupted when it reaches the page boundaries. What is your solution?
#define USER_APP_BASE_ADDR 0x08004000UL
.ram_vector :
{
*(.ram_vector)
} >RAM
Solved! Go to Solution.
2023-10-12 08:28 AM
It is about address problem, double check your base adress.
2023-10-12 04:51 AM
Hello @lmuratsimsek ,
not sure to well understand but are you sure that the memory at address 0x08004000 is erased before trying to write into it ?
Address 0X08004000 is the starting address of sector 4, page 8 and seems to be the first address of your application.
If you have already written your application code here, You first have to erase it before writing the new one. Or you have to use "multiple start address" with an APP1 at an address and APP2 at another address to guaranteed that you always have a valid application loaded in case of "power issue".
Best regards
Mikael
2023-10-12 05:38 AM
Yes, I am erasing all pages from the final address of the application, "Bootloader." The final address of my "Bootloader" application is 0x08002400, and I can only write my application starting from the address 0x08000400. When I try to load at lower addresses, such as 0x08000300, before 0x08000400, some data is being written. When it reaches the page boundaries, it jumps a page or sector and continues writing. I am sure that all of my pages are erased. I am using the STM32F072RB processor, and when jumping from one application to another for this processor, I perform vector table relocation operations as mentioned in the link above. However, I haven't been able to solve the problem. I need to save space in terms of size and write applications on top of each other, but the page gaps in between are causing issues.
2023-10-12 08:28 AM
It is about address problem, double check your base adress.