Debugging the Parallella

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Debugging the Parallella

Postby skinner » Fri Jun 05, 2015 9:43 pm

Hi everyone !

I'm not quite sure this is the right place to post this but at least it seems to have some activity aournd here ^^

I have a few questions about programming the Epiphany Chip and how to efficiently debug it.

I'm working with the headless version of the distribution with the 3.14.12 kernel and the eSDK 2015.1 (on both the board and my laptop). My Laptop is running Ubuntu 14.10 with 3.16 kernel. For now, everytime i want to use the Parallella, i use a ssh pipe between the board and my laptop. Since i'm able to cross-compile everything from my laptop, i mostly use the board for running my programs.

Until now everything was fine because i didn't encounter any kind of problem while coding stuff on the epiphany chip. But recently i tried to do some communication between the main board and the Epiphany chip using the shared memory. The program is quite simple :

1. The host initialize a shared memory area.
2. The host writes a message into this area.
3. The device connects itself to the memory area (using e_shm_attach()).
4. The device retrieves the data.
5. The device then writes some other stuff into the same shared memory (same offset, so it ovverides what was written by the host).
6. The host retrieves and display what was placed in the memory by the Epiphany.

However, there seems to be a bug in the epiphany part since the buffer retrieved by the host is the same that it previously wrote (meaning that nothing was overriden).

I then tried to use e-run locally on my laptop but i didn't find out a way to emulate the shared memory and the system loading the .srec file into the virutal eCore so it wasn't very useful. Same for the host program, obviously don't running on the laptop.

So i tried to use the tools directly on the epiphany : i set up three ssh sessions : the first one running the e-server utility, the second one running e-gdb with my epiphany program and the last one using gdb on the host program (without the "loading the .srec" part).

My idea was to run the e-server, then run step by step the host program with gdb in order to properly initialize the shared memory and so one. Then i could be able to run e-gdb step by step by manually loading the epiphany program.

Nevertheless, everytime i try to connect to the e-server using
Code: Select all
(gdb) target remote:510000


Everything freezes on the Parallella and i lose control of the board...

In despair i even tried to connect to the e-server with my laptop using
Code: Select all
(gdb) target remote parallella_ip:510000


But i had the same behaviour...

So my questions are as follow :

* Is there a better way to debug both the host and epiphany side of a system when (for example) there is shared memory involved ?
* Is the e-server/e-gdb system working ? (it wasn't clear while reading some posts on the forum)
* Can i emulate the shared memory and do all the debugging from my laptop ?
* Some question about the e-hal API : viewtopic.php?f=13&t=2500

Thanks in advance and sorry for my english, hope everything is clear !

Regards,

Thomas.
skinner
 
Posts: 21
Joined: Mon Jun 01, 2015 11:14 pm

Re: Debugging the Parallella

Postby skinner » Mon Jun 08, 2015 2:10 pm

Up !

Any help would be very appreciated !

Thomas.
skinner
 
Posts: 21
Joined: Mon Jun 01, 2015 11:14 pm

Re: Debugging the Parallella

Postby Anthony » Tue Jun 09, 2015 1:56 am

Hi,Thomas!
i'm quite new in debug on epiphany,so i just give out my personal opinion if it can help u

1.i think e-gdb works,but i'm not quite sure since i haven't use debug so far
2.when you use e-gdb to debug your project "target remote:510000" shows the connection to your core,i think you should next use "load' to load program to the core memory ,since gdb is executed manully just as the epiphany_sdk_ref.pdf says.
3.i donnt understand what you mean,why not directly debug on the board using ssh as you mentioned
4.e_alloc function works well,but what is e_shm_alloc,i cant find it in pdf file

Regards

Anthony
Anthony
 
Posts: 16
Joined: Thu May 28, 2015 7:59 am

Re: Debugging the Parallella

Postby skinner » Tue Jun 09, 2015 2:58 pm

Hi Anthony and thanks for your reply.

The problem was that the whole board was freewing everytime I tried using gdb on it. I figured out it was a problem of heat since the thermal deamon of the parallella shut down the epiphany chip if the heat is above 75 degrees and mine was over 75... There was also another issue, as seen in the eSDK 2015.1 update notes : i didn't use the e_reset_system function prior to use gdb and the e-server.

Now I'm able to to use it but I'm stuck with another problem : every time i use the "next" or "nexti" commands, gdb is halting and i got no response from it. the e-server however is yelling some reading errors from other cores even though I only use one core. I tried to launch the e-server with the "--check-hw-address" option and it crashes right after the first "next", due to an access to unmapped addresses...

Besides, when I step into my program, the other cores also seem to execute some instructions even though everything used by my program (data + code) can fit into only the targeted core and that I put the standard libraries into the external memory. Can someone explain this to me ? I may have missed a critical point here.

Thanks,

Thomas.

EDIT : similar issue : viewtopic.php?f=13&t=1643&p=10229&hilit=gdb&sid=8f0f1aad2eba35beaae29c7191414025#p10126
skinner
 
Posts: 21
Joined: Mon Jun 01, 2015 11:14 pm

Re: Debugging the Parallella

Postby skinner » Tue Jun 09, 2015 11:25 pm

Here are some more information about my problem. As i saidm i use three ssh sessions to debug : one for the e-server, one for debugging the main program and the last one for debugging the epiphany program with e-gdb.

In e-gdb i typed the following commands :

Code: Select all
(gdb) target remote :51000
Remote debugging using :51000
0x00000000 in start ()
(gdb) b main
Breakpoint 1 at 0x248: file src/e-main.c, line 25.
(gdb) load
Loading section ivt_reset, size 0x4 lma 0x0
Loading section workgroup_config, size 0x28 lma 0x28
Loading section external_mem_config, size 0x8 lma 0x50
Loading section .reserved_crt0, size 0xc lma 0x58
Loading section .init, size 0x24 lma 0x64
Loading section .text, size 0xe0c lma 0x90
Loading section .fini, size 0x1a lma 0xe9c
Loading section .ctors, size 0x8 lma 0xeb8
Loading section .dtors, size 0x8 lma 0xec0
Loading section .jcr, size 0x4 lma 0xec8
Loading section .data, size 0x4 lma 0xecc
Loading section .rodata, size 0x1e0 lma 0xed0
Loading section NEW_LIB_RO, size 0x7010 lma 0x8e000000
Loading section NEW_LIB_WR, size 0x8e0 lma 0x8e007010
Loading section GNU_C_BUILTIN_LIB_RO, size 0x11c8 lma 0x8e0078f0
Start address 0x0, load size 39738
Transfer rate: 258 KB/sec, 651 bytes/write.
(gdb) n
Single stepping until exit from function start,
which has no line number information.
0x0000005a in .normal_start ()
(gdb)
Single stepping until exit from function .normal_start,
which has no line number information.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000004 in ?? ()


And on the e-server side i got :

Code: Select all
Listening for RSP on port 51000
Remote debugging from host 127.0.0.1
INFO: connected to port 51000
Warning: Core 0100: readMem16 from 0x194b2ed0 failed.
Warning: Core 0202: readMem16 from 0xff397d5e failed.
Warning: Core 0300: readMem16 from 0xff302154 failed.
Warning: Core 0301: readMem16 from 0xff1f7e90 failed.
Warning: Core 0302: readMem16 from 0xffffff0a failed.
Warning: Core 0100: readMem16 from 0x194b2ed0 failed.
Warning: Core 0202: readMem16 from 0xff398af6 failed.
Warning: Core 0300: readMem16 from 0xff302154 failed.
Warning: Core 0301: readMem16 from 0xff1f7e90 failed.
Warning: Core 0302: readMem16 from 0xffffff0a failed.
Warning: Core 0100: readMem16 from 0x194b2ed0 failed.
Warning: Core 0202: readMem16 from 0xff399856 failed.
Warning: Core 0300: readMem16 from 0xff302154 failed.
Warning: Core 0301: readMem16 from 0xff1f7e90 failed.
Warning: Core 0302: readMem16 from 0xffffff0a failed.
Warning: Core 0100: readMem16 from 0x194b2ed0 failed.
Warning: Core 0202: readMem16 from 0xff39a5ce failed.
Warning: Core 0300: readMem16 from 0xff302154 failed.
Warning: Core 0301: readMem16 from 0xff1f7e90 failed.
Warning: Core 0302: readMem16 from 0xffffff0a failed.


Or, with the --check-hw-address option :

Code: Select all
Using the HDF file: /opt/adapteva/esdk.2015.1/bsps/parallella_E16G3_1GB/parallella_E16G3_1GB.xml
Listening for RSP on port 51000
Remote debugging from host 127.0.0.1
INFO: connected to port 51000
ERROR: core ID (33, 8): invalid address 0xff851586.


The problem seems to be with some unmapped address. Furthermore, is there normal that there is "no line number information" (i compiled with the -g option) ?

Thanks,

Thomas.
skinner
 
Posts: 21
Joined: Mon Jun 01, 2015 11:14 pm

Re: Debugging the Parallella

Postby skinner » Sun Jun 14, 2015 8:17 pm

Is there really no one able to help here ?
skinner
 
Posts: 21
Joined: Mon Jun 01, 2015 11:14 pm

Re: Debugging the Parallella

Postby skinner » Mon Nov 02, 2015 1:39 am

Hi !

I've been working on a little project to help debug applications on the Epiphany chip since gdb isn't working correctly. This is not suitable for a production code but it can be useful to have some sort of "printf-like" fast debugging. There maybe are still some bugs, if so please let me know. Hope that can help !
skinner
 
Posts: 21
Joined: Mon Jun 01, 2015 11:14 pm


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 8 guests

cron