The runtime system is realized in C++. It consists of the following main components:
These resources are structured as:
runtime/
lpc1768_landtiger the main entry for the build process for the specific target system
common/ the plattform independent part of the runtime system
cortexM/ the plattform specific 3rd party packages
CMSIS/ the Cortex-M System Interface Software (from ARM)
LPCOpen/ the processor support library from NXP
FreeRTOS/ the FreeRTOS specific parts like
FreeRTOS/ FreeRTOS itself without most of the supplied ports
PEARL/ the FreeRTOS specific parts of the runtime system
This directory structure enables easy ports to other processors and boards.
As development board a NXP LPC1768 based HY-LandTiger board was used:
Documentation
Distributors
A native ArchLinux-system in a VirtualBox-VM with 4GB RAM (due to the use of JVM/Eclipse), 40GB hard disc and the latest VirtualBox extension package for USB 2.0 support for external debugging purposes is used.
Other distributions should work! (e.g. the same distribution as decribed in the linux trunk of OpenPEARL)
This part uses NXP/LPCOpen V2.x, ARM/CMSIS, FreeRTOS and other source libraries. The license agreements are ok to integerate them into the repository.
Debugging with Segger-JLINK-Emulation
...
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
Hardware: V7.00
Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...
J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x4BA00477 (Cortex-M3)
Connected to target
Waiting for GDB connection...
abort the program with ^C
setup jlinkgdbserver as external tool in eclipse
create a debug configuration in eclipse for jlink-debugging
Initialization commands:
target remote localhost:2331
# stop CPU
monitor reset halt
# wait for 200ms
monitor sleep 200
# write compiled binary file
monitor flash device=lpc1768
monitor interface swd
monitor sleep 200
load
monitor sleep 200
monitor reg r13 = (0x0000)
monitor sleep 200
monitor reg pc=(0x0004)
monitor sleep 200
monitor flash breakpoints = 1
# wait for 200ms
monitor sleep 200
# reset CPU
monitor reset
# wait for 200ms
monitor sleep 200
Distributors of JTAG probes (incomplete list)
download and install Open On-Chip Debugger (OpenOCD 0.7.0-3) (link)
Step-1: Configure OpenOCD
# Example: lpc1768.cfg & Olimex ARM-USB-TINY
#
# JTAG interface (ARM-USB-TINY)
source [find interface/olimex-arm-usb-tiny-h.cfg]
# CPU type
source [find cpu/arm/cortex_m3.tcl]
# CPU variant
source [find target/lpc1768.cfg]
# monitor port (default)
telnet_port 4444
# GDB listener port (default)
gdb_port 3333
# JTAG transmission speed
adapter_khz 500
Next you can start OpenOCD from command line with the corresponding configuration ...
$ openocd -f lpc1768.cfg
Open On-Chip Debugger 0.7.0 (2013-11-25-15:57)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter_nsrst_delay: 200
jtag_ntrst_delay: 200
adapter speed: 10 kHz
cortex_m3 reset_config vectreset
adapter_nsrst_assert_width: 10
adapter_nsrst_delay: 2
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
adapter speed: 500 kHz
Info : max TCK change to: 30000 kHz
Info : clock speed 500 kHz
Info : JTAG tap: lpc1768.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : lpc1768.cpu: hardware has 6 breakpoints, 4 watchpoints
[...]
If no errors occur OpenOCD can communicate with the development board. Now you can connect via telnet to the OpenOCD monitor port 4444:
$ telnet localhost 4444
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset init
JTAG tap: lpc1768.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x1fff0080 msp: 0x10001ffc
[...]
For other configuration settings or monitor commands you should read the latest OpenOCD manual.
Step-1: External Tool Configuration
To get OpenOCD work together with Eclipse a remote debugging plugin for GDB debugger has to be installed. The Zylin CDT plugin can be installed using the Eclipse Update Manager.
http://opensource.zylin.com/zylincdt
Next you have to configure OpenOCD in the "External Tools" tab (screenshot)
Following settings must be made in the main tab (screenshot):
If you have started the external configuration from Eclipse you should see similar to the following output (screenshot):
Step-2: Debug configuration
Once you have successfully integrated OpenOCD into Eclipse the actual debug configuration (using the Zylin CDT) must be configured (screenshot):
To create a new debug configuration you have to select the main tab, enter a new project name and select the appropriate application (screenshot):
Within the debugger tab you have to select the cross-chain-debugger (e.g. arm-none-eabi-gdb) which you want to use for debugging purposes (screenshot)
At the top of the commands tab (initialize) you have to insert the basic debugger settings. At the bottom (run) the OpenOCD debug monitor settings are made. Monitor commands can be executed with the prefixed command "monitor"
Example settings
# stop CPU
monitor reset halt
# wait for 200ms
monitor sleep 200
# write compiled binary file
monitor flash write_image erase ./FLASH_RUN/main.bin 0x0 bin
# wait for 200ms
monitor sleep 200
# reset CPU
monitor reset
# wait for 200ms
monitor sleep 200
# re-initialize CPU
monitor reset init
With this configuration the compiled project (main.bin) is flashed to MCU and a debug session will be launched (screenshot):