Now i'm using the stm32l072CBT6 mcu to do a bootloader, but I cannot jump from bootloader code to application code. Is there any demo code for such solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 6:40 AM
I set the application code @0x08004000 in the icf files and also set the invect table to this address. i shut down all ISR before jump, but it still fail to jump my app code.
- Labels:
-
Bootloader
-
STM32L0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 7:38 AM
Hi ZXiao.1,
You can refer to the STM32CubeL0 and try the DFU_Standalone project existing under Projects/$Board_Name$Applications/USB_Device/ directory.
Best Regards,
Ons.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 8:08 AM
Use the Debugger, walk the transition, but understand the "not working".
If you disable interrupts you'll need to re-enable them.
The clocks and buses will already be viable, decide if you need to re-initialize. Watch for expectations of reset conditions.
With the CM0+ you can set VTOR, check what the SystemInit() code is doing (unnecessarily complication and cumbersome in my opinion)
Have the app side Reset_Handler manage the stack setting.
Look also at IAP examples for the CM0/CM0+ parts, the former relocates the vector table to RAM, which might have advantages for those who want to dynamically configure interrupt handlers.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 3:56 PM
Thank you for your reply, where can i get the IAP examples for the CM0/CM0+ parts. You mentioned "Have the app side Reset_Handler manage the stack setting." and how to manage the stack setting when I jump to app in Reset_Handler of app?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 4:14 PM
Thank you for your reply, i use the similar code below to jump, but it still failed, i will check the code.
/* Check if the KEY Button is pressed */
if (BSP_PB_GetState(BUTTON_KEY) == 0x00)
{
/* Test if user code is programmed starting from address 0x08007000 */
if (((*(__IO uint32_t*)USBD_DFU_APP_DEFAULT_ADD) & 0x2FFE0000 ) == 0x20000000)
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (USBD_DFU_APP_DEFAULT_ADD + 4);
JumpToApplication = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) USBD_DFU_APP_DEFAULT_ADD);
JumpToApplication();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 4:59 PM
Reset_Handler:
LDR R0,=_estack
MOVS SP, R0
..
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 4:59 PM
Is this from a interrupt handler or callback ?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 7:01 PM
like this? it will occur the error below, how to find the stack name?
Error[50]: Undefined symbol:'_estack' C:\workfile\ongoingProject\shadow_temp\src\trunk\STM32Boot_app_test\EWARM\startup_stm32l072xx.s 117
​
Reset_Handler
LDR R0,=_estack
MOVS SP, R0
LDR R0, =SystemInit
BLX R0
LDR R0, =__iar_program_start
BX R0
