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.
eLua on STM32F4DISCOVERY
An initial port has been posted on Zhanjun's blog.
The port has now been merged into the main branch of elua and can be built with the following command:
lua build_elua.lua board=stm32f4discovery prog
and the resulting bin file can be loaded using dfuse dfu-util.
Debugging/Programming using STLink
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):
- USART3(PB10/11 and PC10/11)
- 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)
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