This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32F411VEtx enabling DFU mode from Application code

Hello All,
Am trying to make the STM32f411VEtx board into DFU mode from the Application code, so am trying to write the bootloader code, If any one is having code please share or please help me how to write the code and how to flash as well.
i took a reference code from git and tried to adopt the code for STM32f4 but unable to flash the code via ST flash loader tool

Thanks

  • Surely, ST would be the place to go for that?

    ST certainly have Application Notes showing how to do bootloaders.

    Hint: look for "IAP" (In-Application Programming).

  • Thanks for responding
    Will this IAP supports DFU via Micro USB.
    I tried to flash the code via UART1(PA9)using USB-TTY (COM port)

  • IAP will do whatever you program it to do, that's the genius of writing software. ST has DFU USB examples, and USART ones

    The following C and Assembler provide a means to execute the boot ROM of STM32F2 and F4 parts. It sets a value in RAM and then resets, the reset catches this value and remaps the ROM and jumps into it.

    startup.s

    ; Keil based example - Reset into boot loader - sourcer32@gmail.com
    ; From C
    ;  extern void SystemReset(void);
    ;  *((unsigned long *)0x2001FFF0) = 0xDEADBEEF; // Write a scratch location at end of RAM (or wherever)
    ;  SystemReset(); // or NVIC_SystemReset();
    
    
    Reset_Handler   PROC
        EXPORT  Reset_Handler
        IMPORT  __main
    
    
        ;...
    
    
        LDR     R0, =0x2001FFF0 ; Address for RAM signature
        LDR     R1, =0xDEADBEEF
        LDR     R2, [R0, #0] ; Read current
        STR     R0, [R0, #0] ; Invalidate
        CMP     R2, R1
        BEQ     Reboot_Loader
    
        ; Add other choices
    
    
        ;...
    
    
        ; Normal startup path
    
        LDR     R0, =SystemInit
        BLX     R0
    
        LDR     R0, =__main
        BX      R0
    
        ENDP
    
        ;...
    
    
        ; Vector into System Loader
    
    
    Reboot_Loader   PROC
        EXPORT  Reboot_Loader
    
        LDR     R0, =0x40023844 ; RCC_APB2ENR
        LDR     R1, =0x00004000 ; ENABLE SYSCFG CLOCK
        STR     R1, [R0, #0]
        LDR     R0, =0x40013800 ; SYSCFG_MEMRMP
        LDR     R1, =0x00000001 ; MAP ROM AT ZERO
        STR     R1, [R0, #0]
        LDR     R0, =0x1FFF0000 ; ROM BASE
        LDR     SP,[R0, #0]     ; SP @ +0
        LDR     R0,[R0, #4]     ; PC @ +4
        BX      R0
    
        ENDP ; sourcer32@gmail.com
    
    
    SystemReset     PROC
        EXPORT  SystemReset
    
        ldr     r1, =0xE000ED0C ; NVIC Application Interrupt and Controller
        ldr     r0, =0x05FA0004 ; Magic
        str     r0, [r1, #0]    ; Reset
    
        b       .
    
        ENDP
    
        ;...
    

    Now accepting PayPal, Venmo and Amazon Gift Cards..

  • So I need to merge the DFU example code into IAP right?
    The flash loader tool is expecting a bin file which am not able to generate.
    UART1 tx,rx is connected with USB-TTY (com port) and trying to access the device but tool is not responding