Misc STM32 notes
NuttX
- NuttX is sensitive to build detritus in the tree so 'svn status' and delete untracked crap.
[ur 12:08] ~/projects/nuttx/nuttx >(cd tools && ./configure.sh fire-stm32v2/nsh)
[ur 12:10] ~/projects/nuttx/nuttx >env PATH=$PATH:/usr/local/Cellar/gcc-arm-none-eabi/20120614/bin make CONFIG_ARMV7M_TOOLCHAIN=GNU_EABI
LN: include/arch -> arch/arm/include
<snip>
AR: up_boot.o up_spi.o up_usbdev.o up_mmcsd.o up_autoleds.o up_nsh.o up_enc28j60.o up_usbmsc.o
LD: nuttx
CP: nuttx.hex
[ur 12:11] ~/projects/nuttx/nuttx >
- You can use the config make target if you have conf in your path (from nuttx/misc/tools/kconfig-frontends/frontends/conf) menuconfig (needs mconf) for Kconfig aware boards.
- It uses the hard fault handler for syscalls which you need to tell the BMP to ignore.
[ur 11:58] ~/projects >git clone https://github.com/gsmcmullin/blackmagic.git
Cloning into 'blackmagic'...
remote: Counting objects: 1099, done.
remote: Compressing objects: 100% (492/492), done.
remote: Total 1099 (delta 790), reused 906 (delta 598)
Receiving objects: 100% (1099/1099), 294.93 KiB | 113 KiB/s, done.
Resolving deltas: 100% (790/790), done.
[ur 11:59] ~/projects >cd blackmagic
[ur 12:00] ~/projects/blackmagic >git submodule init
Submodule 'libopencm3' (https://github.com/libopencm3/libopencm3.git) registered for path 'libopencm3'
[ur 12:00] ~/projects/blackmagic >git submodule update
Cloning into 'libopencm3'...
remote: Counting objects: 9903, done.
remote: Compressing objects: 100% (3162/3162), done.
remote: Total 9903 (delta 6432), reused 9776 (delta 6345)
Receiving objects: 100% (9903/9903), 1.55 MiB | 308 KiB/s, done.
Resolving deltas: 100% (6432/6432), done.
Submodule path 'libopencm3': checked out '4e4496f70d00fe24b2c5d594d6500f537eeb6478'
[ur 12:01] ~/projects/blackmagic >env PATH=/usr/local/Cellar/gcc-arm-none-eabi/20120614/bin:$PATH make
<snip>
arm-none-eabi-objcopy -O binary blackmagic_dfu blackmagic_dfu.bin
arm-none-eabi-objcopy -O ihex blackmagic_dfu blackmagic_dfu.hex
# Unplug BMP, hold button and plug in, red light should flash rapidly
[ur 12:03] ~/projects/blackmagic >/opt/local/bin/python ./scripts/stm32_mem.py src/blackmagic.bin
USB Device Firmware Upgrade - Host Utility -- version 1.1
Copyright (C) 2011 Black Sphere Technologies
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
Device : ID 0483:df11 Black Sphere Technologies - Black Magic Probe (Upgrade)
Programming memory at 0x08012C00
All operations complete!
[ur 12:03] ~/projects/blackmagic >
# Replug BMP
- OK so now we can debug NuttX...
[ur 12:12] ~/projects/nuttx/nuttx >/usr/local/Cellar/gcc-arm-none-eabi/20120614/bin/arm-none-eabi-gdb -ex "target extended-remote /dev/cu.usbmodem7FC58901" -ex "attach 1" nuttx
GNU gdb (GNU Tools for ARM Embedded Processors) 7.3.1.20120613-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/darius/projects/nuttx/nuttx/nuttx...(no debugging symbols found)...done.
Remote debugging using /dev/cu.usbmodem7FC58901
Attached to Remote target
0xfffffffe in ?? ()
(gdb) monitor jtag_scan
Target voltage: OK
Device IR Len IDCODE Description
0 4 0x3BA00477 ARM Limited: ADIv5 JTAG-DP port.
1 5 0x06414041 ST Microelectronics: STM32, High density.
Available Targets:
No. Att Driver
1 STM32, High density.
(gdb) attach 1
A program is being debugged already. Kill it? (y or n) y
Attached to Remote target
0xfffffffe in ?? ()
(gdb) load
Loading section .text, size 0x250ec lma 0x8000000
Loading section .ARM.extab, size 0x30 lma 0x80250ec
Loading section .ARM.exidx, size 0xe8 lma 0x802511c
Loading section .data, size 0x338 lma 0x8025204
Start address 0x8000321, load size 152892
Transfer rate: 18 KB/sec, 967 bytes/write.
(gdb) mon vector_catch enable nocp bus
Catching vectors: reset nocp bus hard
(gdb) mon vector_catch disable reset hard
Catching vectors: nocp bus
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /Users/darius/projects/nuttx/nuttx/nuttx
--
DanielOConnor - 26 Nov 2012