elua/elua — pull request #5 by bikeNomad (2011-10-18 17:33:59+00:00)
Title: Add STM32F2 and STM32F4 changes from Zhanjun Dong <yystype@yahoo.ca> 

see http://dd.homeunix.com/home/space.php?uid=1&do=blog&id=90
From that blog post:

Experience:
1. ST link reports "No target connected"
Refer to my another blog
The existing STM32F1xx support set all GPIO ports to input by default, this caused the SWD pin not function as SWD purpose. Code added to setup SWD pins to SWD functionality.
2. _fini referenced but not defined
Fixed by modify the ld script
3. STM32F4 has 8M crystal, clock settings should be changed.
4. Peripheral pin need to be set with additional GPIO_PinAFConfig call.
5. As MCU running in 168Mhz, the default SYSTICKHZ(10) will cause SysTick_Config out of range, set to 100 to get override, feel free to change to other value. Additional error check added to report "Sys tick reload value out of range" on this situation.
6. STM32F2/F4 UART has no FIFO, running at 115200 in polling mode might lost characters.

Current status:
Runs on STM32F4 discovery board.
UART, GPIO, timer works, led.lua can flash the led
Working on:
STM32F2 support: eLua runs on STM32F2 too. UART, GPIO, timer works

All of aboved code could be downloaded here. The zip file contains all my stm32f4 and stm32f2 platform support files. Get the latest elua files first,copy stm32f2 and stm32f4 folder into platform folder, copy the SConstruct file to the elua root folder and replace the old one which do not have the F4/F2 and board entrys. You may also copy the led.lua into romfs folder to save into MCU flash.

Once folder setup correctly, run
scons board=STM32F4DSCY prog
And program the elua_lua_stm32f407vg.hex to the board.