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:

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
now run openocd and telnet localhost 4444

run these commands in telnet:
stm32x unlock
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.


1 comment:

  1. Hi there! Do you use Twitter? I'd like to follow you if that would be okay. I'm undoubtedly enjoying your blog and look forward to new updates. outlook sign in