2017-02-13 05:03 AM
Short description: I can load .dfu file from DFU_Standalone code sample, but cannot load my own .dfu file.
Details:
I am trying to work with DFU_Standalone code sample. It works with STM32469I_EVAL_SysTick_0x08008000.dfu file provided in Binary directory.
So, I open STM32469I-EVAL_USBD-FS project (full path STM32Cube_FW_F4_V1.14.0\Projects\STM32469I_EVAL\Applications\USB_Device\DFU_Standalone\SW4STM32\STM32469I-EVAL_USBD-FS) in the System Workbench for STM32, build and execute it. Then I run DfuSeDemo application and see 'STM Device in DFU mode'. After this I click 'Choose' button in 'Upgrade' box, select STM32469I_EVAL_SysTick_0x08008000.dfu file, click 'Upgrade'. Finally, I execute 'Leave DFU mode'. STM32469I_EVAL_SysTick_0x08008000 is activated, I see 4 LEDs animation on the board.Now I want to load another application, instead of STM32469I_EVAL_SysTick_0x08008000. So, I open GPIO_IOToggle code sample in the System Workbench (full path is STM32Cube_FW_F4_V1.14.0\Projects\STM32469I_EVAL\Examples\GPIO\GPIO_IOToggle\SW4STM32) and build it. Result is STM32469I_EVAL.bin file. Then I execute DfuFileMgr.exe, and generate STM32469I_EVAL.dfu file from STM32469I_EVAL.bin. In Multi Bin injection I fill Address value with 08008000. Finally, I run DfuSeDemo, upgrade STM32469I_EVAL.dfu file and click 'Leave DFU mode'. Application is not loaded, DFU_Standalone program remains active. No LED animation, and DfuSe Demo stlll shows 'STM Device in DFU mode'.
So, how can I make .dfu file from my own project, which is loadable by DFU_Standalone bootloader? In the file DFU_Standalone\Binary\readme.txt I see: The offset address of this binary is 0x08008000 which matches the definition in DFU application 'USBD_DFU_APP_DEFAULT_ADD'.
How can I set this offset in GPIO_IOToggle project? What changes exactly should I make in any project, to make a binary loadable by DFU_Standalone and DfuSeDemo programs?
Environment:
OS: Windows 10 x64
Board: STM32469I-EVALSTM32Cube_FW_F4_V1.14.0STM32 Workbench v.1.8DfuSe_Demo_V3.0.5_Setup#dfu #linker #offset #firmware-upgradeSolved! Go to Solution.
2017-02-13 05:56 AM
You'd have to physically build the file for the 0x08008000 address. The linker would need to create the output at this address (typically via linker script or settings), and any code setting the vector table address (SystemInit) would also need to be configured to this address also.
Simply loading a .BIN at the specified address isn't sufficient. A .HEX would contain the address as output by the linker. You could review the .MAP to confirm the address the linker is building the image at.
2017-02-13 05:25 AM
Hello
Farber.Alex
,What's the state of BOOT0 pin?
Make sure you have BOOT0 pulled low
on your board to execute your code.Regards
Imen
2017-02-13 05:56 AM
You'd have to physically build the file for the 0x08008000 address. The linker would need to create the output at this address (typically via linker script or settings), and any code setting the vector table address (SystemInit) would also need to be configured to this address also.
Simply loading a .BIN at the specified address isn't sufficient. A .HEX would contain the address as output by the linker. You could review the .MAP to confirm the address the linker is building the image at.
2017-02-13 06:58 AM
Hello Imen,
SW1 and SW2 are in the left position, PIN0 is low. My guess is that pins are OK, something is wring in the file I want to load. .dfu file from code sample is OK, and my own file is not working.
2017-02-13 07:08 AM
Hello Clive,
I am trying to do this. In the project .ld file I found the line:
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K
Tried to replace 0x8000000 with 0x08008000, still doesn't work. Probably I need to do something else, but I don't know exactly what to change.
2017-02-13 07:36 AM
There is also SystemInit function which has the line:
SCP->VTOR = FLASH_BASE | VECT_TAB_OFFSET;
FLASH_BASE is defined as 0x8000000U. I replaced FLASH_BASE with 0x08008000 in this line, this doesn't help.
2017-02-13 09:14 AM
Then you are likely going to need to review and debug the code insitu.
Perhaps you can diff the project that is functional vs the one that isn't
2017-02-14 04:25 AM
Got it working when changed the program in 3 places:
1.DFU program reads int value from 0x8008000 address and tests it for some condition. This is always false when I burn my own application, so I just excluded this check for now.
2. Application project, .ld file:
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K
replace with
FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 2048K
3. Application project, SystemInit function:
SCP->VTOR = FLASH_BASE | VECT_TAB_OFFSET;
replace with
SCP->VTOR = 0x08008000 | VECT_TAB_OFFSET;
Now I can build the application project, convert .bin to .dfu and burn it to device. It is activated successfully.
It is also a good idea to generate .hex file, as described here:
http://www.openstm32.org/forumthread925
.hex file is more convenient to convert to .dfu.
2017-02-16 09:07 AM
In Keil you can also run command line tools, and get it to auto-generate a .DFU file
https://community.st.com/0D50X00009XkeovSAB
2020-03-30 01:40 AM
where is systminit function in stmcubeide?