Page 1 of 1

GDB and simulator

PostPosted: Wed Feb 21, 2018 1:21 pm
by upcFrost
Hi,

Can someone plz tell me how to use e-sim and e-gdb together?

I'm away from my board, and I'm trying to test my compiler against matmul-16. This example requires passing matrices from host, so i'm trying to use e-sim like this (different example, hello_world here)

Code: Select all
e-sim --host `pwd`/hello_world.elf -p parallella16 --wait-attach 0x808 --external-fetch


And this is where I'm getting stuck. e-sim spawns a number of cores except the one I specified, but I don't get how to attach this single core to the sim.

If i'm trying to use the usual approach with e-gdb -> target sim -> load -> start, it will just spawn yet another sim process without connecting to the existing one. Am I missing something?

Re: GDB and simulator

PostPosted: Wed Feb 21, 2018 4:43 pm
by upcFrost
Somehow managed to run gdb and sim together.

First started e-gdb as

Code: Select all
e-gdb e_matmul.elf -ex "target sim" -ex "sim e-coreid 0x808" -ex "sim e-rows 4" -ex "sim e-cols 4" -ex "sim e-external-fetch" -ex "sim e-first-core 0x808"


Next, started e-sim as

Code: Select all
e-sim --host `pwd`/matmul.elf ../../device/Release/e_matmul.elf -p parallella16 --external-fetch --wait-attach 0x808 --verbose


now i'm getting "RESETCORE asserted at 0xb64" error after a couple of steps.

Re: GDB and simulator

PostPosted: Thu Mar 22, 2018 9:31 am
by upcFrost
Meh, ok, somehow managed to fix the code without using debugger. Man it sucks, but whatever :roll:

Re: GDB and simulator

PostPosted: Wed Apr 04, 2018 12:33 pm
by olajep
Glad to see you were able solve it!

When passing --host to e-sim you also need to pass
"-ex environment operating" to e-gdb.
(e-sim is a frontend for e-run, 'e-sim --host ...' implies 'e-run --environment operating ...')


The GDB simulator framework provides three environments which the epiphany target maps as follows:

user:
For standalone single-core programs
Interrupts will stop the simulation.
Anything that puts the core in IDLE state, e.g. asserting RESETCORE, will stop the simulation.
workgroup_cfg section set by simulator
Command line options supported
Started from Entry point address in ELF header (usually the _start symbol)

virtual:
For standalone multi-core programs
workgroup_cfg section set by simulator
Started by triggering the SYNC interrupt

operating:
For programs with a host part
Corresponds to e-sim --host flag
Core started in IDLE mode


The default environment for e-gdb and e-run is 'user'
The default environment passed by e-sim to e-run is 'virtual'. The --host flag changes that to 'operating'

// Ola

Re: GDB and simulator

PostPosted: Wed May 02, 2018 8:03 pm
by upcFrost
Thanks for the explanation, I think I'll really need it when I'll get to work with matmul example once again :D