Hello Example never reaches main
#1
Hi,

Yesterday I was trying the Hello example on the PULPissimo (RI5CY) which is on a NEXYS4 FPGA board. The GDB Server is running without any error and I am able to load the binary onto the FPGA. But if I want to start the program, it ends up in a infinite loop. 
So I started to step through the program and I saw, that it does not even reach the main function.


Code:
Dump of assembler code for function _stext:
=> 0x1c0080a0 <+0>:    csrw    pcmr,zero
  0x1c0080a4 <+4>:    auipc    t0,0xffff9
  0x1c0080a8 <+8>:    addi    t0,t0,-724 # 0x1c000dd0 <__rt_io_event>
  0x1c0080ac <+12>:    auipc    t1,0xffff9
  0x1c0080b0 <+16>:    addi    t1,t1,-512 # 0x1c000eac
  0x1c0080b4 <+20>:    sw    zero,0(t0)
  0x1c0080b8 <+24>:    addi    t0,t0,4
  0x1c0080ba <+26>:    bltu    t0,t1,0x1c0080b4 <_stext+20>
  0x1c0080be <+30>:    auipc    sp,0xffff9
  0x1c0080c2 <+34>:    addi    sp,sp,-1022 # 0x1c000cc0 <camera_isAwaked>
  0x1c0080c6 <+38>:    jal    ra,0x1c008358 <__rt_init>
  0x1c0080ca <+42>:    li    a0,0
  0x1c0080ce <+46>:    li    a1,0
  0x1c0080d2 <+50>:    auipc    t2,0x0
  0x1c0080d6 <+54>:    addi    t2,t2,612 # 0x1c008336 <main>
  0x1c0080da <+58>:    jalr    t2
  0x1c0080de <+62>:    mv    s0,a0
  0x1c0080e0 <+64>:    jal    ra,0x1c00842e <__rt_deinit>
  0x1c0080e4 <+68>:    mv    a0,s0
  0x1c0080e6 <+70>:    jal    ra,0x1c009492 <exit>
End of assembler dump.

It seems that it reaches the branch instruction bltu t0,t1,0x1c0080b4 <_stext+20>, takes the jump back to sw zero,0(t0) and starts all over again. It never leaves these three instructions.

The funny part is, that the example once rendered the string "Hello !" to the console but after never again. There is also a warning which now shows up after I connect to the GDB server with 'target remote localhost:3333':

warning: Target-supplied registers are not supported by the current architecture

0x1a000080 in ?? ()


My idea is, that there is an issue with my binary file, because I recompiled quite a few times and did some changes at the code while it did not work. But I cannot really see where the problem is.

Hope someone knows better Smile.

P.S: this is my test.c file:

Code:
#include <stdio.h>
#include <rt/rt_api.h>

int __rt_fpga_fc_frequency =  10000000;  // e.g. 20000000 for 20MHz;
int __rt_fpga_periph_frequency = 5000000; // e.g. 10000000 for 10MHz;


int main()
{
 printf("Hello !\n");
 return 0;
}

Thank you very much.
Reply
#2
Ok I solved it. Strange problem but it looks like it was the Debug Probe that made debugging really really slow (I mean really slow). After using an different one it worked.
(Used the SEGGER EDU and now the SIPEED USB-JTAG/TLL RISC-V DEBUG; Both support RISC-V and both support OpenOCD).

Sorry for the unnecessary thread here Smile.
Reply


Forum Jump: