Tuesday, December 14, 2010

building arm toolchain, compiling, and loading into flash on stm32 discovery

you need macports for this to work

to build the arm toolchain go here:
https://github.com/esden/summon-arm-toolchain

in a terminal do:
git clone https://github.com/esden/summon-arm-toolchain.git

edit summon-arm-toolchain
set SUDO=sudo
set LIBSTM32_EN=1
save and go back to terminal

follow the instructions in the README

this will take a long time and you have to type in your password a few times

add ~/sat/bin to PATH in your .bash_profile

download this: http://www.robsons.org.uk/blinky.zip

unzip it, edit Makefile and everywhere it says arm-elf change it to arm-none-eabi
make
now run openocd and telnet localhost 4444

run these commands in telnet:
halt
stm32x unlock
reset
halt
flash erase_sector 0 0 last
flash write_bank 0 ~/Downloads/blinky/blinky.bin 0
reset init

the green led should blink, the blue led should blink twice as fast, and when you hold the usr button the green led should stop blinking.

hooray!

No comments:

Post a Comment