Monday, July 6, 2015

Phase 1: openocd woes - resolution

I printed the openocd 0.10.0 manual and decided to log unto IRC ' #freenode server and #openocd channel to get some pointers in the right direction.

As luck would have it I met up with Paul Frertser, as I happened to be reading his response to another openocd user's question on lpc17xx configuration at:
comments.gmane.org/gmane.comp.debugging.openocd.devel/25169

Actually I posted my question on the main channel (#openocd) and he responded and during that conversation I was able to point to my blog and entries related to script file setup for openocd. I sent him a copy of the section of EGWU schematic where the ft2232 ' channel 0 is interfaced to the lpc1788' JTAG lines

He responded with the following suggestions
1. replace my current ftdi_layout_init assignment with
ftdi_layout_init 0x0008 0x000b
ftdi_layout_signal nTRST -data 0x0010
use reset_config trst_only in the board script

*** this worked
openocd_ftdi
Open On-Chip Debugger 0.9.0 (2015-07-05-17:44)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
adapter speed: 10 kHz
adapter_nsrst_delay: 1000
jtag_ntrst_delay: 1000
cortex_m reset_config sysresetreq
cortex_m reset_config sysresetreq
Info : clock speed 10 kHz
Info : JTAG tap: lpc1788.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : lpc1788.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Error: Target not halted
undefined debug reason 7 - target needs reset
Info : JTAG tap: lpc1788.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


2. use "extended-remote" in .gdbinit script and replace arm-linux-gnueabi-gdb with gdb-arm-none-eabi as the latter is more stable and caters to what I am doing and will lively resolve the error messages about unknown architecture in file

***this worked
as a side note
apt-get install gdb-arm-none-eabi also installs
arm-none-eabi-binutils
arm-none-eabi-gcc
arm-none-eabi-ld
libnewlib-arm-none-eabi

so I am going to modify my Makefile to use the above instead of the linux-eabi
versions

also gdb-arm-none-eabi ./app.out
JTAG tap: lpc1788.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
Reading symbols from app.out...done.
(gdb) load
Loading section .data, size 0xe0 lma 0x10000000
Loading section .text, size 0x1ca8 lma 0x100000e0
Start address 0x10000f48, load size 7560
Transfer rate: 1 KB/sec, 2520 bytes/write.
(gdb) start
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Temporary breakpoint 1 at 0x10000f4c: file app/main.c, line 29.


3. dispense with running openocd as root ... copy contrib/99-openocd.rules into my /etc/udev/rules.d

*** to be done tomorrow


4. consider adding the following flags to CFLAGS/LDFLAGS
-ffunction-sections -fdata-sections -Wl, --gc-sections

*** to be done tomorrow
I hadnt looked at the gcc/ld manual for over 3 years. So the current CFLAGS/LDFLAGS were created from when I worked on the arm7tdmi but later modified slightly to support the cortex-m3 which has no arm (thumb2 only) mode


As I just returned from the laundromat (30 mins ago) and in need of some serious sleep (still wanted to test out these suggestions)  ... its time to pack it in for the night

No comments:

Post a Comment