AnsweredAssumed Answered

STM32L152RET6 usb dfu bootload

Question asked by mike on Jul 17, 2015
Latest reply on Jul 17, 2015 by Clive One
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 work


In the startup file, startup_stm32l152xe.s I added the following


Reset_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      R0


Reboot_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.
Thanks

Outcomes