0
votes

I have an steval-stwinkt1 board, that i am trying to enable support for DFU mode.

I flashed costume boot loader firmware on to the the start of the flash (0x8000000) that lets you load into another firmware that was uploaded by the DFU mode or to stay in the current program to flash new firmware throw the USB.

i used this st tutorial- https://www.youtube.com/watch?v=n_LDXOQHerU

I tried the .dfu package that comes with the STM32Cube and i saw that the program ran successfully so i assume that the bootloader works.

but when i try to make my own DFU package from my software the software never loads and i get hard fault. i moved the software according to the ST totorial & some research i done to 0x800C000 by changin the following lines:

in the FLASH.ld file:

    FLASH    (rx)    : ORIGIN = 0x8000000,   LENGTH = 2048K

to:

    FLASH    (rx)    : ORIGIN = 0x800C000,   LENGTH = 2048K

and in the stm32l4r9xx.h changed FLASH_BASE to:

    #define FLASH_BASE            (0x0800C000UL)

on another try i tried instead of changing FLASH_BASE to change VECT_TAB_OFFSET but it still didnt work.

to make the dfu package i use dfu-tool (i use linux) and use this command:

    dfu-tool convert dfuse software.bin software.dfu

also tried to convert the hex int dfu package using the official tool that is used in the tutorial i used and still didnt work

what do i need to change to make my software works when i load the dfu package?

thanks

itay

1
still needs help, if some one have experienced with thatFinci
please need helpFinci

1 Answers

-1
votes

It appears to me that you have overlooked the fact that your application-dedicated flash size is not going to be 2048K anymore, since your custom bootloader is now placed at the start of the flash. Therefore, you need to subtract the app's flash origin from the total flash size:

 FLASH    (rx) : ORIGIN = 0x800C000,    LENGTH = 2048K - (ORIGIN(FLASH) - 0x8000000)

In such cases, a suggestion would be to try to debug the hard fault using the HardFault_Handler() and a bit of coding. You will then be able to extract and analyze the link register, program counter, program status register, etc. at the moment when hard fault occurred.