2015-07-17 07:19 AM
I am trying to initiate a bootload via firmware from a STM32L152RET6 over USB.
When I have Boot0 and Boot1 pin configured via jumper hardware and reset processor the Dfuse program recognize the bootloader and I can download firmware over the USB port.I found several posts on this forum on how to jump to the booload section but none of them work.I have tried the following based on the forum suggestions but it does not workIn the startup file, startup_stm32l152xe.s I added the followingReset_Handler LDR R0, =0x2000FFF0 ;check for memory location LDR R1, =0xDEADBEEF ;for this magic number to determine if LDR R2, [R0, #0] ;program should start or jump to bootloader STR R0, [R0, #0] ; Invalidate CMP R2, R1 BEQ Reboot_Loader LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0Reboot_Loader LDR R0, =0x40023820 ; RCC_APB2ENR (+0x20) LDR R1, =0x00000001 ; ENABLE SYSCFG CLOCK STR R1, [R0, #0] LDR R0, =0x40010000 ; SYSCFG_CFGR1 (+0x00) LDR R1, =0x00000001 ; MAP ROM AT ZERO STR R1, [R0, #0] LDR R0, =0x1FF00000 ; ROM BASE (STM32L1xxE) ;;LDR R0, =0x00000000 ; OR GENERICALLY MAPPED AT ZERO LDR R1, [R0, #0] ; SP @ +0 MOV SP, R1 LDR R0, [R0, #4] ; PC @ +4 BX R0 In my main application when I need to initiate the bootload I have this *((unsigned long *)0x2000FFF0) = 0xDEADBEEF; HAL_NVIC_SystemReset();Is there something else that I need to set or do in order to initiate the firmware update over USB frm my application?I do not have an available spare UART on this device as all ports are being used and so all updates must be over USB.Any help would be appreciated.Thanks2015-07-17 07:48 AM
Does it actually get to this code?
If you build a test image, where you don't check the SRAM setting, and then turn OFF ''run to main()'' in the debugger, and just step through the code does it work then.Confirm you can see the ROM mapped at 0x000000002015-07-17 08:19 AM
2015-07-17 09:10 AM
I don't know, I don't have an L152 with a USB connection.
The register settings appear to be correct. It's possible the System Loader checks other things, and the BOOTx pins. You can't change those in software. I'd have to disassemble the L1 ROM to understand what it's dependencies are, not got a strong driver to do that.