The ARMstrap Module
ARMstrap Eagle is an very nice OpenSource development board with a ARM Cortex-M4 STM32F4[012]7 CPU running at 168 MHz. The main feature of this board is the Black Magic Probe embedded debug interface.
STM32 Development with Eclipse
Since the ARMstrap Eagle documentation is not very chatty about on how to get everything done on Linux, here are additional important notes on setting up Eclipse for ARMstrap:
Build Environment
A popular repository is GNU Tools for ARM Embedded Processors.
- Extract the files to your desired directory i.e.
/opt
or${eclipse_home}
. - Modify your PATH environment variable:
echo 'export PATH=/opt/gcc-arm-none-eabi-4_8-2014q1/bin:"$PATH"' >> ~/.bashrc
UDEV Settings
ARMstrap eagle uses the Vendor-ID from OpenMoko:
~$ lsusb Bus 004 Device 018: ID 1d50:6018 OpenMoko, Inc. Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Here are my settings:
# /etc/udev/rules.d/55-armstrap.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6018", RUN+="/sbin/modprobe cdc-acm", GROUP="plugdev", MODE="0660", SYMLINK+="eagle%n"
After you created the 55-armstrap.rules
file, you need to reload udev
udevadm control --reload
The udev
devices will finally appear as:
# ls -l /dev/eagle*
lrwxrwxrwx 1 root root 7 May 16 19:03 /dev/eagle1 -> ttyACM1
lrwxrwxrwx 1 root root 7 May 16 19:03 /dev/eagle2 -> ttyACM2
lrwxrwxrwx 1 root root 15 May 16 19:03 /dev/eagle4 -> bus/usb/004/019
and
# for n in /dev/eagle*; do ls -l /dev/$(readlink $n); done
crw-rw-r-- 1 root plugdev 189, 1 May 16 19:03 /dev/ttyACM1
crw-rw-r-- 1 root plugdev 189, 2 May 16 19:03 /dev/ttyACM2
crw-rw-r--+ 1 root plugdev 189, 402 May 16 19:03 /dev/bus/usb/004/019
You may also take a look at the README of the Black Magic Debugger.
Eclipse Settings
Following modules should be allready inistalled. They are installable via Help->Install new software
- C/C++ GCC Cross Compiler Support
- C/C++ GDB Hardware Debugging
In
Project->Properties->C/C++ Build->Configuration->Manage Configurations
select
New…->Import predefined-> “Executable >Cross GCC > Release”
and mark it as active configuration. For convenience you may also select
Multiple configurations for debug and release.
The GCC needs to have some different settings in Project->Properties->C/C++-Build->Settings
Cross GCC Assembler->General
-mcpu=cortex-m4 -mthumb -mno-warn-deprecated -mfloat-abi=hard
Cross G++ Linker->Miscellaneous
-mcpu=cortex-m4 -mthumb -mno-warn-deprecated -mfloat-abi=hard
Cross GCC Compiler->Miscellaneous
-c -fmessage-length=0 -march=armv7e-m -mcpu=cortex-m4 -fno-common -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -MD -ffunction-sections -fno-builtin
Cross GCC Compiler->Debugging
-g3 -ggdb
An important step -ggdb. Without it you wont see any source int the debugger.
GDB Hardware Debugging
Rename the first line to:
target extended-remote /dev/eagle1
Serial Console
I belive /dev/eagle2
is the serial console. I need to check this.
Flashing/Uploading the Code
The debugging configuration flashes already and starts debugging.
To have only only flashing without debugging I created a small script
# /path/gdbupload.cmd
set print pretty
set auto-load safe-path /
target extended-remote /dev/eagle1
mon swdp_scan
attach 1
load
detach
quit
In eclipse select Project->Properties and got to:
C/C++-Build->Settings
select Configuration->Release
In Post-build steps->Command insert
arm-none-eabi-gdb -batch -x /opt/armstrap/gdbupload.cmd ${ProjName}.elf
The output for relase build
includes/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_adc.o
includes/STM32F4xx_StdPeriph_Driver/src/misc.o
arm-none-eabi-gdb -batch -x /opt/armstrap/gdbupload.cmd blinky.elf
Target voltage: 4.9V
Available Targets:
No. Att Driver
1 STM32F4xx
0x08000366 in loop ()
Loading section .isr_vector, size 0x188 lma 0x8000000
Loading section .text, size 0x3a0 lma 0x8000188
Start address 0x8000288, load size 1320
Transfer rate: 3 KB/sec, 660 bytes/write.
Detaching from program: /opt/armstrap/workspace/blinky/Debug/blinky.elf, Remote target
19:29:02 Build Finished (took 513ms)
Comments are closed, but trackbacks and pingbacks are open.