Compiling and running application on Zedboard (Pulpissimo)
#1
Good afternoon,

After several issues I have been able to install the complete SDK and platforms. 

I'm able to compile applications and run them on the rt platform. I'm also able to complete the Vivado implementation of Pulpissimo for the Zedboard. However, I'm still not able to run applications on the Zedboard.

The sequence of steps I carry out are:

1 - Using Vivado Hardware manager I program the device on the Zedboard with the pulpissimo-zedboard.bit configuration file. Everything is fine, the device is configured and led LED0 is on (from the .xdc file and xilinx_pulpissimo.v I identify that this is CSN for SPI channel 1, so it is OK).

2 - source configs/pulpissimo.sh

3 - source configs/fpgas/pulpissimo/genesys2.sh (from the information provided in GitHub there shoulb be also a zedboard.sh script, but this is the only one that can be found)

4 - source sourceme.sh

5 - make clean all

6 - The USB cable that was used to configure the Zynq device is removed from the Zedboard.

7 - The Digilent JTAG-HS2 cable is attached to PMOD A.

8 - openocd -f openocd-zedboard-hs2.cfg

9 - riscv32-unknown-elf-gdb FILENAME

10 - (gdb) target remote localhost:3333

11 - (gdb) load

If within gdb I issue two list commands here is what I get:

1 /*
2 * This example shows how drive a GPIO as an output.
3 */
4
5 #include <stdio.h>
6 #include <rt/rt_api.h>
7 #include <stdint.h>
8
9 #define GPIO 20
10
(gdb) list
11 int __rt_fpga_fc_frequency = 20000000; // e.g. 20000000 for 20MHz;
12 int __rt_fpga_periph_frequency = 10000000; // e.g. 10000000 for 10MHz;
13
14 int main()
15 {
16  unsigned long i;
17
18  // First configure the SPI device
19  rt_spim_conf_t conf;
20  // Get default configuration

Now I want to place a breakpoint at line 19. Therefore what I get is:

(gdb) b 19
No line 19 in the current file.
Make breakpoint pending on future shared library load? (y or [n]) 

Therefore, it seems that something is wrong. If I issue the command 'continue' on gdb I get the message Continuing, and nothing happens.

I have tried the same flow, but issuing a 'source platform-fpga.sh' after step 4, but the result is the same.

Can you identify if something is missing or wrong in the steps I'm following? Any help will be appreciated.

In order to check if the program is being executed properly by Pulpissimo on the Zedboard I'm trying to turn OFF LED0 by changing the value of the CSN signal of SPI channel 1 that is mapped onto this LED, but without success until now.

Best regards,

Manuel
Reply
#2
(12-05-2019, 01:25 PM)jmmarostegui Wrote: Good afternoon,

After several issues I have been able to install the complete SDK and platforms. 

I'm able to compile applications and run them on the rt platform. I'm also able to complete the Vivado implementation of Pulpissimo for the Zedboard. However, I'm still not able to run applications on the Zedboard.

The sequence of steps I carry out are:

1 - Using Vivado Hardware manager I program the device on the Zedboard with the pulpissimo-zedboard.bit configuration file. Everything is fine, the device is configured and led LED0 is on (from the .xdc file and xilinx_pulpissimo.v I identify that this is CSN for SPI channel 1, so it is OK).

2 - source configs/pulpissimo.sh

3 - source configs/fpgas/pulpissimo/genesys2.sh (from the information provided in GitHub there shoulb be also a zedboard.sh script, but this is the only one that can be found)

4 - source sourceme.sh

5 - make clean all

6 - The USB cable that was used to configure the Zynq device is removed from the Zedboard.

7 - The Digilent JTAG-HS2 cable is attached to PMOD A.

8 - openocd -f openocd-zedboard-hs2.cfg

9 - riscv32-unknown-elf-gdb FILENAME

10 - (gdb) target remote localhost:3333

11 - (gdb) load

If within gdb I issue two list commands here is what I get:

1 /*
2 * This example shows how drive a GPIO as an output.
3 */
4
5 #include <stdio.h>
6 #include <rt/rt_api.h>
7 #include <stdint.h>
8
9 #define GPIO 20
10
(gdb) list
11 int __rt_fpga_fc_frequency = 20000000; // e.g. 20000000 for 20MHz;
12 int __rt_fpga_periph_frequency = 10000000; // e.g. 10000000 for 10MHz;
13
14 int main()
15 {
16  unsigned long i;
17
18  // First configure the SPI device
19  rt_spim_conf_t conf;
20  // Get default configuration

Now I want to place a breakpoint at line 19. Therefore what I get is:

(gdb) b 19
No line 19 in the current file.
Make breakpoint pending on future shared library load? (y or [n]) 

Therefore, it seems that something is wrong. If I issue the command 'continue' on gdb I get the message Continuing, and nothing happens.

I have tried the same flow, but issuing a 'source platform-fpga.sh' after step 4, but the result is the same.

Can you identify if something is missing or wrong in the steps I'm following? Any help will be appreciated.

In order to check if the program is being executed properly by Pulpissimo on the Zedboard I'm trying to turn OFF LED0 by changing the value of the CSN signal of SPI channel 1 that is mapped onto this LED, but without success until now.

Best regards,

Manuel
Hi Manuel,

Could you please try to set a breakpoint on _start (b _start in GDB)? This is the entry point of the binary and the first instruction that should be executed. Also what options did you provide to GCC? In order to be able to debug a program with sourcecode line information you should compile your programm with the gcc -g flag. Have a look at the following application Makefile as an example:

Code:
PULP_APP = test
PULP_APP_FC_SRCS = test.c
PULP_APP_HOST_SRCS = test.c
PULP_CFLAGS = -O0 -g

include $(PULP_SDK_HOME)/install/rules/pulp_rt.mk

The -O0 disable optimization which sometimes makes it easier to debug. 

Also, I assume you made sure that openocd correctly connects to the FPGA?


Greetings,
another Manuel :-)
Reply
#3
(12-05-2019, 02:07 PM)meggiman Wrote:
(12-05-2019, 01:25 PM)jmmarostegui Wrote: Good afternoon,

After several issues I have been able to install the complete SDK and platforms. 

I'm able to compile applications and run them on the rt platform. I'm also able to complete the Vivado implementation of Pulpissimo for the Zedboard. However, I'm still not able to run applications on the Zedboard.

The sequence of steps I carry out are:

1 - Using Vivado Hardware manager I program the device on the Zedboard with the pulpissimo-zedboard.bit configuration file. Everything is fine, the device is configured and led LED0 is on (from the .xdc file and xilinx_pulpissimo.v I identify that this is CSN for SPI channel 1, so it is OK).

2 - source configs/pulpissimo.sh

3 - source configs/fpgas/pulpissimo/genesys2.sh (from the information provided in GitHub there shoulb be also a zedboard.sh script, but this is the only one that can be found)

4 - source sourceme.sh

5 - make clean all

6 - The USB cable that was used to configure the Zynq device is removed from the Zedboard.

7 - The Digilent JTAG-HS2 cable is attached to PMOD A.

8 - openocd -f openocd-zedboard-hs2.cfg

9 - riscv32-unknown-elf-gdb FILENAME

10 - (gdb) target remote localhost:3333

11 - (gdb) load

If within gdb I issue two list commands here is what I get:

1 /*
2 * This example shows how drive a GPIO as an output.
3 */
4
5 #include <stdio.h>
6 #include <rt/rt_api.h>
7 #include <stdint.h>
8
9 #define GPIO 20
10
(gdb) list
11 int __rt_fpga_fc_frequency = 20000000; // e.g. 20000000 for 20MHz;
12 int __rt_fpga_periph_frequency = 10000000; // e.g. 10000000 for 10MHz;
13
14 int main()
15 {
16  unsigned long i;
17
18  // First configure the SPI device
19  rt_spim_conf_t conf;
20  // Get default configuration

Now I want to place a breakpoint at line 19. Therefore what I get is:

(gdb) b 19
No line 19 in the current file.
Make breakpoint pending on future shared library load? (y or [n]) 

Therefore, it seems that something is wrong. If I issue the command 'continue' on gdb I get the message Continuing, and nothing happens.

I have tried the same flow, but issuing a 'source platform-fpga.sh' after step 4, but the result is the same.

Can you identify if something is missing or wrong in the steps I'm following? Any help will be appreciated.

In order to check if the program is being executed properly by Pulpissimo on the Zedboard I'm trying to turn OFF LED0 by changing the value of the CSN signal of SPI channel 1 that is mapped onto this LED, but without success until now.

Best regards,

Manuel
Hi Manuel,

Could you please try to set a breakpoint on _start (b _start in GDB)? This is the entry point of the binary and the first instruction that should be executed. Also what options did you provide to GCC? In order to be able to debug a program with sourcecode line information you should compile your programm with the gcc -g flag. Have a look at the following application Makefile as an example:

Code:
PULP_APP = test
PULP_APP_FC_SRCS = test.c
PULP_APP_HOST_SRCS = test.c
PULP_CFLAGS = -O0 -g

include $(PULP_SDK_HOME)/install/rules/pulp_rt.mk

The -O0 disable optimization which sometimes makes it easier to debug. 

Also, I assume you made sure that openocd correctly connects to the FPGA?


Greetings,
another Manuel :-)
Hi (another :-)) Manuel,

First of all, thank you very much for your prompt answer. Here are the contents of the Makefile I'm using:

PULP_APP = test
PULP_APP_FC_SRCS = test.c
PULP_CFLAGS = -O3 -g

include $(PULP_SDK_HOME)/install/rules/pulp_rt.mk

As you can see, the option -g is already included. Regarding opencd, when I start it I can see that is waiting for connections coming from gdb through  the 3333 port. When I start gdb and set the proper target I can see that openced accepts the connection. Is there anything else I should do to check that opencd is working properly?

Best regards,

Manuel
Reply
#4
(12-05-2019, 02:27 PM)jmmarostegui Wrote:
(12-05-2019, 02:07 PM)meggiman Wrote:
(12-05-2019, 01:25 PM)jmmarostegui Wrote: Good afternoon,

After several issues I have been able to install the complete SDK and platforms. 

I'm able to compile applications and run them on the rt platform. I'm also able to complete the Vivado implementation of Pulpissimo for the Zedboard. However, I'm still not able to run applications on the Zedboard.

The sequence of steps I carry out are:

1 - Using Vivado Hardware manager I program the device on the Zedboard with the pulpissimo-zedboard.bit configuration file. Everything is fine, the device is configured and led LED0 is on (from the .xdc file and xilinx_pulpissimo.v I identify that this is CSN for SPI channel 1, so it is OK).

2 - source configs/pulpissimo.sh

3 - source configs/fpgas/pulpissimo/genesys2.sh (from the information provided in GitHub there shoulb be also a zedboard.sh script, but this is the only one that can be found)

4 - source sourceme.sh

5 - make clean all

6 - The USB cable that was used to configure the Zynq device is removed from the Zedboard.

7 - The Digilent JTAG-HS2 cable is attached to PMOD A.

8 - openocd -f openocd-zedboard-hs2.cfg

9 - riscv32-unknown-elf-gdb FILENAME

10 - (gdb) target remote localhost:3333

11 - (gdb) load

If within gdb I issue two list commands here is what I get:

1 /*
2 * This example shows how drive a GPIO as an output.
3 */
4
5 #include <stdio.h>
6 #include <rt/rt_api.h>
7 #include <stdint.h>
8
9 #define GPIO 20
10
(gdb) list
11 int __rt_fpga_fc_frequency = 20000000; // e.g. 20000000 for 20MHz;
12 int __rt_fpga_periph_frequency = 10000000; // e.g. 10000000 for 10MHz;
13
14 int main()
15 {
16  unsigned long i;
17
18  // First configure the SPI device
19  rt_spim_conf_t conf;
20  // Get default configuration

Now I want to place a breakpoint at line 19. Therefore what I get is:

(gdb) b 19
No line 19 in the current file.
Make breakpoint pending on future shared library load? (y or [n]) 

Therefore, it seems that something is wrong. If I issue the command 'continue' on gdb I get the message Continuing, and nothing happens.

I have tried the same flow, but issuing a 'source platform-fpga.sh' after step 4, but the result is the same.

Can you identify if something is missing or wrong in the steps I'm following? Any help will be appreciated.

In order to check if the program is being executed properly by Pulpissimo on the Zedboard I'm trying to turn OFF LED0 by changing the value of the CSN signal of SPI channel 1 that is mapped onto this LED, but without success until now.

Best regards,

Manuel
Hi Manuel,

Could you please try to set a breakpoint on _start (b _start in GDB)? This is the entry point of the binary and the first instruction that should be executed. Also what options did you provide to GCC? In order to be able to debug a program with sourcecode line information you should compile your programm with the gcc -g flag. Have a look at the following application Makefile as an example:

Code:
PULP_APP = test
PULP_APP_FC_SRCS = test.c
PULP_APP_HOST_SRCS = test.c
PULP_CFLAGS = -O0 -g

include $(PULP_SDK_HOME)/install/rules/pulp_rt.mk

The -O0 disable optimization which sometimes makes it easier to debug. 

Also, I assume you made sure that openocd correctly connects to the FPGA?


Greetings,
another Manuel :-)
Hi (another :-)) Manuel,

First of all, thank you very much for your prompt answer. Here are the contents of the Makefile I'm using:

PULP_APP = test
PULP_APP_FC_SRCS = test.c
PULP_CFLAGS = -O3 -g

include $(PULP_SDK_HOME)/install/rules/pulp_rt.mk

As you can see, the option -g is already included. Regarding opencd, when I start it I can see that is waiting for connections coming from gdb through  the 3333 port. When I start gdb and set the proper target I can see that openced accepts the connection. Is there anything else I should do to check that opencd is working properly?

Best regards,

Manuel

Could you please share the output of OpenOCD when you start it up? In some scenarios, openocd might start the GDB server even though there was an issue while connecting to the core. So all of the output should be checked carefully. Also, did you try to set the breakpoint at _start or __rt_init with the -O0 -g option?

Greetings,
Manuel
Reply
#5
Because the OP never responded and I'm in basically the same situation, I thought it would make sense to continue this thread for future reference.
I try to run the example, following the steps mentioned in the GitHub.
Just like in jmmarosteguis' case it seems to hang at the (gdb) continue part.

After I load the bitstream on the Zedboard ( make -C pulpissimo-zedboard download ) the blue LED (LD12) is on, as well as LD0.
From what I understand this means that the bitstream download was a success.

I do not own the Digilent HS-2 or the Altera USB Blaster but I connected JTAG and UART with my adapter according to the readme of the Zedboard.
I am also using minicom.

So now I just follow the steps until I reach the (gdb) continue part where it's stuck on "Continuing."



Here is the log of openocd (for readability I shortened the output of the disabled harts):

Quote:Open On-Chip Debugger 0.10.0+dev-00615-g5ead86ea9 (2020-08-24-15:25)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 1000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
  TapName             Enabled  IdCode     Expected   IrLen IrCap IrMask
-- ------------------- -------- ---------- ---------- ----- ----- ------
0 riscv.unknown0         Y     0x00000000 0x10102001     5 0x01  0x03
1 riscv.cpu              Y     0x00000000 0x249511c3     5 0x01  0x03
Info : J-Link ARM V8 compiled Nov 28 2014 13:44:46
Info : Hardware version: 8.00
Info : VTarget = 3.364 V
Info : clock speed 1000 kHz
Info : JTAG tap: riscv.unknown0 tap/device found: 0x10102001 (mfg: 0x000 (<invalid>), part: 0x0102, ver: 0x1)
Info : JTAG tap: riscv.cpu tap/device found: 0x249511c3 (mfg: 0x0e1 (Wintec Industries), part: 0x4951, ver: 0x2)
Info : datacount=2 progbufsize=8
Info : Examined RISC-V core; found 1024 harts
Info :  hart 0: currently disabled
... (all other harts also disabled) ...
Info :  hart 991: currently disabled
Info :  hart 992: XLEN=32, misa=0x40901104
Info :  hart 993: currently disabled
... (all other harts also disabled) ...
Info :  hart 1023: currently disabled
Info : Listening on port 3333 for gdb connections
Ready for Remote Connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333



Here is the log of gdb:

Quote:NU gdb (GDB) 7.12.50.20170505-git
Copyright © 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=riscv32-unknown-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /local/lpla/pulpissimo/pulp-rt-examples/hello/build/pulpissimo/test/test...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
warning: Target-supplied registers are not supported by the current architecture
0x1a000080 in ?? ()
(gdb) b _start
Breakpoint 1 at 0x1c008080: file kernel/riscv/rt/crt0.S, line 202.
(gdb) load
Loading section .data_tiny_fc, size 0x31c lma 0x1c000004
Loading section .init_array, size 0x2c lma 0x1c000320
Loading section .fini_array, size 0xc lma 0x1c00034c
Loading section .rodata, size 0x164 lma 0x1c000358
Loading section .data, size 0x110 lma 0x1c000cc0
Loading section .vectors, size 0xa0 lma 0x1c008000
Loading section .text, size 0x204c lma 0x1c0080a0
Loading section .l2_data, size 0xec lma 0x1c010000
Start address 0x1c008080, load size 10144
Transfer rate: 5 KB/sec, 1268 bytes/write.
(gdb) continue
Continuing.

Breakpoint 1, _start () at kernel/riscv/rt/crt0.S:202
202  jal x0, _entry
(gdb) continue
Continuing.


Here is the log of minicom (minicom -D /dev/ttyUSB0 115200):

Quote:Welcome to minicom 2.6.2

OPTIONS: I18n 
Compiled on May  5 2014, 09:45:24.
Port /dev/ttyUSB0, 13:13:12

Press CTRL-A Z for help on special keys
I added the breakpoint (b _start in gdb) and set the PULP_CFLAGS in the makefile of the app to -O0 -g as it has been suggested.
Hopefully this information will help in finding a solution.


Edit: I managed to get the output on minicom!
The only thing that still persists is the infinite Continue.
Even when enabling semihost it still won't work.
Right now I am setting a breakpoint on exit but it would be nice to have it just run till the end and then stop.


Regards,
LPLA
Reply
#6
(08-27-2020, 11:54 AM)LPLA Wrote: Because the OP never responded and I'm in basically the same situation, I thought it would make sense to continue this thread for future reference.
I try to run the example, following the steps mentioned in the GitHub.
Just like in jmmarosteguis' case it seems to hang at the (gdb) continue part.

After I load the bitstream on the Zedboard ( make -C pulpissimo-zedboard download ) the blue LED (LD12) is on, as well as LD0.
From what I understand this means that the bitstream download was a success.

I do not own the Digilent HS-2 or the Altera USB Blaster but I connected JTAG and UART with my adapter according to the readme of the Zedboard.
I am also using minicom.

So now I just follow the steps until I reach the (gdb) continue part where it's stuck on "Continuing."



Here is the log of openocd (for readability I shortened the output of the disabled harts):

Quote:Open On-Chip Debugger 0.10.0+dev-00615-g5ead86ea9 (2020-08-24-15:25)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 1000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
  TapName             Enabled  IdCode     Expected   IrLen IrCap IrMask
-- ------------------- -------- ---------- ---------- ----- ----- ------
0 riscv.unknown0         Y     0x00000000 0x10102001     5 0x01  0x03
1 riscv.cpu              Y     0x00000000 0x249511c3     5 0x01  0x03
Info : J-Link ARM V8 compiled Nov 28 2014 13:44:46
Info : Hardware version: 8.00
Info : VTarget = 3.364 V
Info : clock speed 1000 kHz
Info : JTAG tap: riscv.unknown0 tap/device found: 0x10102001 (mfg: 0x000 (<invalid>), part: 0x0102, ver: 0x1)
Info : JTAG tap: riscv.cpu tap/device found: 0x249511c3 (mfg: 0x0e1 (Wintec Industries), part: 0x4951, ver: 0x2)
Info : datacount=2 progbufsize=8
Info : Examined RISC-V core; found 1024 harts
Info :  hart 0: currently disabled
... (all other harts also disabled) ...
Info :  hart 991: currently disabled
Info :  hart 992: XLEN=32, misa=0x40901104
Info :  hart 993: currently disabled
... (all other harts also disabled) ...
Info :  hart 1023: currently disabled
Info : Listening on port 3333 for gdb connections
Ready for Remote Connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333



Here is the log of gdb:

Quote:NU gdb (GDB) 7.12.50.20170505-git
Copyright © 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=riscv32-unknown-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /local/lpla/pulpissimo/pulp-rt-examples/hello/build/pulpissimo/test/test...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
warning: Target-supplied registers are not supported by the current architecture
0x1a000080 in ?? ()
(gdb) b _start
Breakpoint 1 at 0x1c008080: file kernel/riscv/rt/crt0.S, line 202.
(gdb) load
Loading section .data_tiny_fc, size 0x31c lma 0x1c000004
Loading section .init_array, size 0x2c lma 0x1c000320
Loading section .fini_array, size 0xc lma 0x1c00034c
Loading section .rodata, size 0x164 lma 0x1c000358
Loading section .data, size 0x110 lma 0x1c000cc0
Loading section .vectors, size 0xa0 lma 0x1c008000
Loading section .text, size 0x204c lma 0x1c0080a0
Loading section .l2_data, size 0xec lma 0x1c010000
Start address 0x1c008080, load size 10144
Transfer rate: 5 KB/sec, 1268 bytes/write.
(gdb) continue
Continuing.

Breakpoint 1, _start () at kernel/riscv/rt/crt0.S:202
202  jal x0, _entry
(gdb) continue
Continuing.


Here is the log of minicom (minicom -D /dev/ttyUSB0 115200):

Quote:Welcome to minicom 2.6.2

OPTIONS: I18n 
Compiled on May  5 2014, 09:45:24.
Port /dev/ttyUSB0, 13:13:12

Press CTRL-A Z for help on special keys
I added the breakpoint (b _start in gdb) and set the PULP_CFLAGS in the makefile of the app to -O0 -g as it has been suggested.
Hopefully this information will help in finding a solution.


Edit: I managed to get the output on minicom!
The only thing that still persists is the infinite Continue.
Even when enabling semihost it still won't work.
Right now I am setting a breakpoint on exit but it would be nice to have it just run till the end and then stop.


Regards,
LPLA

Hi, so I am facing the same issue and ain't able to display anything on minicom. I saw your edit that you are able to view output on minicom. Could you let me know what changes did you make in order to do that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)