Skip to main content
Stephan Scherer
Associate III
Jan 31, 2017 7:21 AM UTC
Solved

STM32F427 DFU-Mode

Posted on January 31, 2017 at 08:21

Hello,

I try to implement a bootloader via dfu mode.

In my applicationi write a magic value and perform a reset.

In the bootlaoder i read the magic value and try to jump to the system memory.

Therefore i try this:

Bootloader_Dev PROC

    EXPORT  Bootloader_Dev    ; bootloader via USB device

    LDR  R0, =0x40013800    ; SYSCFG_MEMRMP register laden

    LDR  R2, [R0]

    LDR  R1, =0x00000001

    ORR  R2, R1

    LDR  R0, =0x40013800

    STR  R2, [R0]

    

    LDR     R0, =0x00000000

                LDR     SP,[R0, #0]

                LDR     R0,[R0, #4]

                BX      R0

                ENDP

Sadly it didn't work. I have to switch off and on the power supply to enter the dfu mode.

Anyone know what I make wrong?

    This topic has been closed for replies.
    Sean Park
    Sean ParkBest answer
    ST Employee
    Jan 31, 2017 7:42 AM UTC
    Posted on January 31, 2017 at 08:42

    I shared the jump to user application using HAL base source..

    // Jump IAP or System BOOT

    HAL_RCC_DeInit();

    HAL_DeInit();

    __HAL_REMAPMEMORY_SYSTEMFLASH();

    __set_MSP(*((uint32_t*) 0x00000000));

    // Application Interrupt and Reset Control :: resetting the peripherals, change the value to 0x05FA0001

    {

       #define SCB_AIRCR_VECTKEY_RESET (0x05FA0001)

       SCB->AIRCR = SCB_AIRCR_VECTKEY_RESET;

    }

    ((void (*)(void)) *((uint32_t*) 0x00000004))();

    while (1);

    Please refer to source.

    2 replies

    Sean Park
    Sean ParkBest answer
    ST Employee
    Jan 31, 2017 7:42 AM UTC
    Posted on January 31, 2017 at 08:42

    I shared the jump to user application using HAL base source..

    // Jump IAP or System BOOT

    HAL_RCC_DeInit();

    HAL_DeInit();

    __HAL_REMAPMEMORY_SYSTEMFLASH();

    __set_MSP(*((uint32_t*) 0x00000000));

    // Application Interrupt and Reset Control :: resetting the peripherals, change the value to 0x05FA0001

    {

       #define SCB_AIRCR_VECTKEY_RESET (0x05FA0001)

       SCB->AIRCR = SCB_AIRCR_VECTKEY_RESET;

    }

    ((void (*)(void)) *((uint32_t*) 0x00000004))();

    while (1);

    Please refer to source.

    Stephan Scherer
    Associate III
    Jan 31, 2017 9:21 AM UTC
    Posted on January 31, 2017 at 10:21

    Thx Sean, it works.