Dobrica Pavlinušić's random unstructured stuff
STM32discovery: Revision 12


STM32F100RBT6B

dpavlin@blue:~$ lsusb | grep ST
Bus 003 Device 006: ID 0483:3744 SGS Thomson Microelectronics STLINK Pseudo disk

Install toolchain

dpkg --add-architecture i386
apt-get install libc6-i386
#wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2012-q4-major/+download/gcc-arm-none-eabi-4_7-2012q4-20121208-linux.tar.bz2
wget https://sourcery.mentor.com/GNUToolchain/package4463/public/arm-none-eabi/arm-2009q1-161-arm-none-eabi-i686-pc-linux-gnu.tar.bz2


Install openocd

dpavlin@blue:~$ sudo apt-get install openocd
dpavlin@blue:~$ dpkg -l openocd
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version          Architecture     Description
+++-=======================-================-================-====================================================
ii  openocd                 0.6.1-1          amd64            Open on-chip JTAG debug solution for ARM and MIPS sy

start openocd

Disable STLINKv1 SCSI emulation, see https://github.com/texane/stlink

root@blue:~# modprobe -r usb-storage && modprobe usb-storage quirks=483:3744:i

root@blue:~# sudo openocd -f /usr/share/openocd/scripts/board/stm32vldiscovery.cfg
Open On-Chip Debugger 0.6.1 (2012-12-05-01:32)
Licensed under GNU GPL v2
For bug reports, read
       http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints

Open another window and connect with telnet:

dpavlin@blue:~$ telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset init
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08000b4c msp: 0x20000400

summon toolchain

openocd

dpavlin@blue:~/sat$ sudo openocd -f /usr/share/openocd/scripts/board/stm32vldiscovery.cfg
[sudo] password for dpavlin: 
Open On-Chip Debugger 0.6.1 (2012-12-05-01:32)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection from 4444
Warn : target was in unknown state when halt was requested
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x080001ce msp: 0x20001ff0

From different terminal

dpavlin@blue:~/sat$ telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> halt
target was in unknown state when halt was requested
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x080001ce msp: 0x20001ff0
> 

> flash write_image erase /virtual/stm32discovery/libopencm3/examples/stm32/f1/stm32vl-discovery/fancyblink/fancyblink.hex
auto erase enabled
device id = 0x10016420
flash size = 128kbytes
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20001ff0
wrote 2048 bytes from file /virtual/stm32discovery/libopencm3/examples/stm32/f1/stm32vl-discovery/fancyblink/fancyblink.hex in 0.192207s (10.405 KiB/s)


Using Arduino IDE

http://forums.leaflabs.com/topic.php?id=630