intergatedcircuits / dfubootloader Goto Github PK
View Code? Open in Web Editor NEWSTM32 USB device bootloader using DFU class interface
License: Apache License 2.0
STM32 USB device bootloader using DFU class interface
License: Apache License 2.0
usbd_dfu.c
784: and 792:
itf->Address = (uint8_t*)(*(__packed uint32_t *)data);
This code is unaligned access; in the MCU with an M0(+) core, it is Fires a hardfault.
Hi,
I'm new to STM32.
I'm developing a device ith a STM32F303C MCU and I'm looking for a way to update the firmware by USB, in the easiest way possible in order to any enduser can do it (like with Arduino does: no buttons to press and connect straight to USB port).
Does your DfuBootloader helps to achieve that in any way?
Sorry if my questions seems silly, but I'm very lost with this.
Thanks in advance!
I've tried to integrate this bootloader with my STM32F303CC and it's working fine in the non-DfuSe mode. But if I try to enable it, there's quite a few problems.
First of all, the Makefile has an error:
ifdef DFUSE
C_DEFS += \
-DUSBD_DFU_ST_EXTENSION=$(DFUSE) \
-DFLASH_ERASE_TIME_ms=$(ERASE_MS) \
-DSE_FLASH_DESC_STR=DESC_STR
else
C_DEFS += -DFLASH_TOTAL_ERASE_TIME_ms=$(TOTAL_ERASE_MS)
endif
Notice how in the line -DSE_FLASH_DESC_STR=DESC_STR
the DESC_STR
is actually just a string literal, not a variable, e.g. $(DESC_STR)
. This leads to some compile errors.
After fixing that, it compiles fine and ST's DfuSe tool even picks up the device and all parameters (like flash sections). But as soon as I try to download or upload a firmware, there's this error:
$ ./DfuSeCommand.exe -c -d --fn test.dfu
1 Device(s) found :
Device [1]: STM Device in DFU Mode, having [1] alternate targets
Duration: 00:00:00
Target 00: Error Code: Bad state machine in firmware
Target: 00
Error Code: Bad state machine in firmware
TransferSize: 1024
DFU State: STATE_DFU_DOWNLOAD_SYNC
DFU Status: STATUS_OK
Request: Get Status Request.
CurrentNBlock: 0x0000
CurrentLength: 0x0005
Percent: 0
looks like something is wrong with the DfuSe protocol implementation?
Hello
I just came by and I see that the build does not work for STM32F407
make TARGET_HEADER="\<stm32f407xx.h\>" SERIES=STM32F4 APP_ADDRESS=0x08002000 APP_SIZE=24568 TOTAL_ERASE_MS=480 VID=FFFF PID=FFFF
mkdir build_FFFF_FFFF
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -DFLASH_APP_ADDRESS=0x08002000 -DFLASH_APP_SIZE=24568 -DFLASH_BYTE_PROGRAM_TIME_us=25 -DUSBD_VID=0xFFFF -DUSBD_PID=0xFFFF -DVDD_VALUE_mV=2000 -DSTM32_TARGET_HEADER=\<stm32f407xx.h\> -DFLASH_TOTAL_ERASE_TIME_ms=480 -IBSP_STM32F4xx -IMain -IUSBDevice/Include -IUSBDevice/PDs/STM32_XPD -ISTM32_XPD/CMSIS/Include -ISTM32_XPD/CMSIS/Device/ST/STM32F4xx/Include -ISTM32_XPD/STM32F4_XPD/inc -Os -Wall -fdata-sections -ffunction-sections -std=gnu11 -g -gdwarf-2 -MMD -MP -MF"build_FFFF_FFFF/bsp_io.d" -MT"build_FFFF_FFFF/bsp_io.d" -Wa,-a,-ad,-alms=build_FFFF_FFFF/bsp_io.lst BSP_STM32F4xx/bsp_io.c -o build_FFFF_FFFF/bsp_io.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -DFLASH_APP_ADDRESS=0x08002000 -DFLASH_APP_SIZE=24568 -DFLASH_BYTE_PROGRAM_TIME_us=25 -DUSBD_VID=0xFFFF -DUSBD_PID=0xFFFF -DVDD_VALUE_mV=2000 -DSTM32_TARGET_HEADER=\<stm32f407xx.h\> -DFLASH_TOTAL_ERASE_TIME_ms=480 -IBSP_STM32F4xx -IMain -IUSBDevice/Include -IUSBDevice/PDs/STM32_XPD -ISTM32_XPD/CMSIS/Include -ISTM32_XPD/CMSIS/Device/ST/STM32F4xx/Include -ISTM32_XPD/STM32F4_XPD/inc -Os -Wall -fdata-sections -ffunction-sections -std=gnu11 -g -gdwarf-2 -MMD -MP -MF"build_FFFF_FFFF/bsp_system.d" -MT"build_FFFF_FFFF/bsp_system.d" -Wa,-a,-ad,-alms=build_FFFF_FFFF/bsp_system.lst BSP_STM32F4xx/bsp_system.c -o build_FFFF_FFFF/bsp_system.o
BSP_STM32F4xx/bsp_system.c:28:15: error: 'HSE' undeclared here (not in a function); did you mean 'HSI'?
28 | .Source = HSE,
| ^~~
| HSI
BSP_STM32F4xx/bsp_system.c:29:10: error: 'HSE_VALUE_Hz' undeclared here (not in a function); did you mean 'HSI_VALUE_Hz'?
29 | .M = HSE_VALUE_Hz / 1000000,
| ^~~~~~~~~~~~
| HSI_VALUE_Hz
BSP_STM32F4xx/bsp_system.c: In function 'SystemClock_Config':
BSP_STM32F4xx/bsp_system.c:38:5: warning: implicit declaration of function 'RCC_eHSE_Config'; did you mean 'RCC_eHCLK_Config'? [-Wimplicit-function-declaration]
38 | RCC_eHSE_Config(OSC_ON);
| ^~~~~~~~~~~~~~~
| RCC_eHCLK_Config
make: *** [Makefile:167: build_FFFF_FFFF/bsp_system.o] Error 1
Using the dependencies of:
git submodule status
cb519480b8e8d954b7140ff2ccbe391de5a6730e STM32_XPD (0.1.0-58-gcb51948)
31c25dffe3ae8b7fe02010ef2549bd4ad9433f06 USBDevice (31c25df)
For an application running on an M0 that leverages this bootloader does the application need to handle relocating the vector table?
Hi there, I'm much appreciate your work. In the future, can you consider to support stm32f1 series? I have a blue pill which is based on stm32f103 and I can't find dfu bootloader for stm32cube. Thanks for consideration!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.