Preliminary discussion of resources for getting the STM32F4DISCOVERY and related hardware running with eLua and open tools.
This board sports an STM32F407VG from the ARM Cortex-M4 family of MCUs.
Docs
STM32F407VG Datasheet (pdf)
eLua on STM32F4DISCOVERY
An initial port has been posted on Zhanjun's blog.
An in-progress merge of the port can be found on github.
This port can be built with the following command
scons board=STM32F4DSCY prog
and the resulting bin file can be loaded using dfuse dfu-util.
Debugging/Programming using STLink
stm32 discovery line linux programmer
Debugging/Programming using DFU(OTG)/UART
The STM32F4-series MCUs have a built-in bootloader that supports programming of flash memory using the following serial interfaces (from page 59 of the Reference Manual):
- USART1(PA9/PA10)
- USART3(PB10/11 and PC10/11)
- CAN2(PB5/13)
- USB OTG FS(PA11/12) in Device mode (DFU: device firmware upgrade).
The USART peripherals operate at the internal 16 MHz oscillator (HSI) frequency, while the CAN and USB OTG FS require an external clock (HSE) multiple of 1 MHz (ranging from 4 to 26 MHz). The embedded bootloader code is located in system memory. It is programmed by ST during production. For additional information, refer to application note AN2606.
Programming over the UART interfaces should be possible using one of the following tools (these have been confirmed with STM32F10x parts):
Programming over USB OTG DFU is possible using one of these utilities:
dfu-util (as of 0.5 now includes support for DFuSe extensions)
dfuse-dfu-util branch of dfu-util that adds support for ST's DfuSe extensions, should work with STM32F4 (main changes now integrated into main dfu-util)
Getting into DFU Mode
Holding BOOT0 high and BOOT1=PB2 low during reset, and keeping the USART and CAN lines quiescent, should bring up a DFU bootloader on the USB micro-AB port.
Then dfuse-dfu-util can be used to load an image with the micro USB port connected:
dfu-util -d 0483:df11 -c 1 -i 0 -a 0 -s 0x08000000 -D elua_lua_stm32f407vg.bin
