Cannot run hello,c on GDB when connected to Ariane via JTAG
I want to run simple hello.c example So I compiled as following:
riscv64-unknown-elf-gcc hello.c -L -o hello.elf
where is :


  // I changed this to the DRAM start addr (0x80000000)
  ROM_BASE = 0x80000000; /* ... but actually position independent */

  . = ROM_BASE;

  .text.init : { *(.text.init) }

  .text : ALIGN(0x100) {
  _TEXT_START_ = .;
  _TEXT_END_ = .;

  .data : ALIGN(0x100) {
  _DATA_START_ = .;
  _DATA_END_ = .;

  PROVIDE(_data = ADDR(.data));
  PROVIDE(_data_lma = LOADADDR(.data));
  PROVIDE(_edata = .);

  .bss : ALIGN(0x100) {
  _BSS_START_ = .;
  _BSS_END_ = .;

  .rodata : ALIGN(0x100) {
  _RODATA_END_ = .;

and the compilation was successful. Then, I followed the instructions in GITHUB  connected with success to JTAG. the problem that I cannot run the the hello.elf I can only see the disassemble which looks correct. check what I tried:

~/Desktop/ariane_test/hello$ riscv64-unknown-elf-gdb hello.elf
GNU gdb (GDB)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
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=riscv64-unknown-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello.elf...
(gdb)  target remote localhost:3333
Remote debugging using localhost:3333
0x0000000000010044 in ?? ()
(gdb) load
Loading section .text, size 0xc0a2 lma 0x100b0
Loading section .rodata, size 0xdb8 lma 0x1c160
Loading section .eh_frame, size 0x4 lma 0x1d000
Loading section .init_array, size 0x10 lma 0x1d008
Loading section .fini_array, size 0x8 lma 0x1d018
Loading section .data, size 0x1100 lma 0x1d020
Loading section .sdata, size 0x58 lma 0x1e120
Start address 0x00000000000100c2, load size 57294
Transfer rate: 53 KB/sec, 5729 bytes/write.
(gdb) target exec
A program is being debugged already.  Kill it? (y or n) y
No executable file now.
(gdb) target exec hello.elf
(gdb) load
You can't do that when your target is `exec'
(gdb) run
Don't know how to run.  Try "help target".
Could you please help me, I want to see 'Hello Ariane' printed on the console
Thank you
Did you try to use the default linker script?
(04-08-2020, 08:33 PM)bluewww Wrote: Did you try to use the default linker script?

yes indeed I used /fpga/ariane.cfg script to connect to the JTAG
That is not the linker script. It is a OpenOCD script.

Forum Jump:

Users browsing this thread: 1 Guest(s)