Compiling openocd-esp32 on Raspberry Pi

cjsm74x
Posts: 12
Joined: Wed Nov 25, 2015 10:16 pm

Compiling openocd-esp32 on Raspberry Pi

Postby cjsm74x » Tue Feb 28, 2017 2:47 am

Is there any news on this topic? I tried installing openocd-esp32 on a Pi Zero but compiling fails. Compiling the 'generic' openocd version actually succeeds however?

Code: Select all

cc1: all warnings being treated as errors
Makefile:479: recipe for target 'librtos_la-rtos_freertos_stackings.lo' failed
make[4]: *** [librtos_la-rtos_freertos_stackings.lo] Error 1
make[4]: Leaving directory '/home/pi/openocd-esp32/src/rtos'
Makefile:607: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/pi/openocd-esp32/src'
Makefile:443: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/pi/openocd-esp32/src'
Makefile:502: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/pi/openocd-esp32'
Makefile:409: recipe for target 'all' failed
make: *** [all] Error 2

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Comping openocd-esp32 on Raspberry Pi

Postby ESP_Angus » Tue Feb 28, 2017 2:53 am

Hi,

I split your post off into a new topic because it relates to compiling rather than running openocd-esp32.

The extract of the build output you posted doesn't go quite far back enough to see the original error. If you copy some more of it then we may have some better clues.

It may come down to a build dependency missing. If you're on Raspbian, running "sudo apt-get build-dep openocd" (install build dependencies for Debian's openocd package) may help. Also it may help to re-run "./configure" and look for any warnings in the output.


Angus

cjsm74x
Posts: 12
Joined: Wed Nov 25, 2015 10:16 pm

Re: Compiling openocd-esp32 on Raspberry Pi

Postby cjsm74x » Tue Feb 28, 2017 7:16 am

I forgot to enable the putty log file...oops! I started over and here is the resulting log: http://pastebin.com/dl/rUjWFruV It is not the same as the first time though. Now the problem seems to clearly visible.
This seems to be the offending line:

Code: Select all

rtos_freertos_stackings.c: In function 'rtos_freertos_esp108_stack_read_voluntary':
rtos_freertos_stackings.c:375:22: error: cast increases required alignment of target type [-Werror=cast-align]
  uint32_t *stackregs=(uint32_t *)stack_data; //alias so we can read/write entire words. Little-endian hosts only!

cjsm74x
Posts: 12
Joined: Wed Nov 25, 2015 10:16 pm

Re: Compiling openocd-esp32 on Raspberry Pi

Postby cjsm74x » Wed Mar 01, 2017 5:55 am

I changed the '__CLANG__' code in rtos_freertos_stackings.c to get it to compile with GCC. Unfortunately, after compilation I am running into the same problem as bbx10node in the original topic. The output is 100% consistent after several tries.

Code: Select all

Open On-Chip Debugger 0.10.0-dev-g90071eb-dirty (2017-02-28-22:15)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
BCM2835 GPIO config: tck = 11, tms = 25, tdi = 10, tdo = 9
BCM2835 GPIO config: srst = 24
srst_only separate srst_gates_jtag srst_push_pull connect_deassert_srst
adapter speed: 200 kHz
force hard breakpoints
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : JTAG only mode enabled (specify swclk and swdio gpio to add SWD mode)
Info : clock speed 200 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32.cpu0: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32.cpu1: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32.cpu1: Core was reset (pwrstat=0x5F, after clear 0x0F).
Error: esp32.cpu1: esp108_fetch_all_regs (line 649): DSR (FFFFFFFF) indicates target still busy!
Error: esp32.cpu1: esp108_fetch_all_regs (line 649): DSR (FFFFFFFF) indicates DIR instruction generated an exception!
Error: esp32.cpu1: esp108_fetch_all_regs (line 649): DSR (FFFFFFFF) indicates DIR instruction generated an overrun!
Error: esp32.cpu1: esp108_fetch_all_regs (line 673): DSR (FFFFFFFF) indicates target still busy!
Error: esp32.cpu1: esp108_fetch_all_regs (line 673): DSR (FFFFFFFF) indicates DIR instruction generated an exception!
Error: esp32.cpu1: esp108_fetch_all_regs (line 673): DSR (FFFFFFFF) indicates DIR instruction generated an overrun!
Error: Exception reading pc!

Info : esp32.cpu1: Target halted, pc=0x00000000

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: Compiling openocd-esp32 on Raspberry Pi

Postby ESP_Sprite » Wed Mar 01, 2017 9:37 am

That actually looks somewhat sane, believe it or not. You probably interrupted the processor at a point where only CPU0 was running, causing all kinds of problems trying to get info from CPU1. Aside from these, OpenOCD seems happy.

cjsm74x
Posts: 12
Joined: Wed Nov 25, 2015 10:16 pm

Re: Compiling openocd-esp32 on Raspberry Pi

Postby cjsm74x » Thu Mar 02, 2017 8:33 am

Oke, I adjusted the esp32.cfg file and OpenOCD is happy now. Using the Pi-Zero as an RNDIS/Ethernet Gadget, I can now run debug commands from Visual Studio Code on my W10 laptop. Thanks for the help!

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Compiling openocd-esp32 on Raspberry Pi

Postby ESP_igrr » Thu Mar 02, 2017 11:00 am

Which plugin for VS Code are you using to set up remote debugging? I'm eager to try it, but the only plugin I found was very much alpha quality at this point.

cjsm74x
Posts: 12
Joined: Wed Nov 25, 2015 10:16 pm

Re: Compiling openocd-esp32 on Raspberry Pi

Postby cjsm74x » Thu Mar 02, 2017 9:33 pm

I am currently using just the 'default' ms-vscode.cpptools. Maybe I just don't know what I am missing out on since my previous c experience is limited to the Arduino IDE. :oops:

Who is online

Users browsing this forum: Bing [Bot] and 292 guests