Question about the hello program

I use vmware to install ubuntu 16.04 and follow the instruction within the start guide.

make software PROGRAM=hello BOARD=freedom-e300-hifive1
and the binary is built successfully
make upload PROGRAM=hello BOARD=freedom-e300-hifive1

work/build/openocd/prefix/bin/openocd -f bsp/env/freedom-e300-hifive1/openocd.cfg &
/home/kaihsin/test/freedom-e-sdk/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gdb software/hello/hello --batch -ex “set remotetimeout 240” -ex “target extended-remote localhost:3333” -ex “monitor reset halt” -ex “monitor flash protect 0 64 last off” -ex “load” -ex “monitor resume” -ex “monitor shutdown” -ex “quit”;
echo "Successfully uploaded ‘hello’ to freedom-e300-hifive1."
Open On-Chip Debugger 0.10.0-dev-g563f6ac (2017-05-10-21:41)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : auto-selecting first available session transport “jtag”. To override use 'transport select ‘.
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
Info : Examined RISCV core; XLEN=32, misa=0x40001105
Remote communication error. Target disconnected.: Connection reset by peer.
“monitor” command not supported by this target.
“monitor” command not supported by this target.
You can’t do that when your target is `exec’
“monitor” command not supported by this target.
“monitor” command not supported by this target.
Successfully uploaded ‘hello’ to freedom-e300-hifive1.
It seems that the upload is also successful.
I expected that the terminal which open /dev/ttyUSB1 will show "hello world"
But it still show
Drew’s Skeleton program

/cs-v1/;
/{
model = “SiFive,FE310G-0000-Z0”;
compatible = “sifive,fe300”;
/include/ 0x20004;
};
this is a test

Could anyone give suggestion?
Or Does the printf transmitted the anohter uart pin:GPIO 16 17?

I reported the same problem with the Arty here, but have not seen any response yet. My guess is that a bug has been introduced into the most recent toolchain on git.I got this problem only after updating the toolchain. Despite what the output is saying, the upload does not at all appear to have been successfull.

Hi guys, Thanks for reporting this.

I have just confirmed that things work properly with the binary toolchain distribution here (though you will have to edit the make file to point to the correct binaries:

I’ll compile the toolchain in freedom-e-sdk to see if I can reproduce.

1 Like

I can’t comment on why, but the problem appears to be somewhere in this commit:

I rolled back my checkout of openocd and rebuilt the tools:

dave@Arthur:~/Projects/freedom-e-sdk$ cd openocd/
dave@Arthur:~/Projects/freedom-e-sdk/openocd$ git checkout fa8d7adf33

After which things started working again.

Thanks Dave, I’ll try that as well.

“Never touch a runnung system” ?? :unamused:

1 Like

HI all

I use git revert to abandon the change “allow all hart to be reset” and rebuilt the tools.
But I encounter the below errors.

kaihsin@ubuntu:~/test/freedom-e-sdk$ make upload PROGRAM=hello BOARD=freedom-e300-hifive1
work/build/openocd/prefix/bin/openocd -f bsp/env/freedom-e300-hifive1/openocd.cfg &
/home/kaihsin/test/freedom-e-sdk/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gdb software/hello/hello --batch -ex “set remotetimeout 240” -ex “target extended-remote localhost:3333” -ex “monitor reset halt” -ex “monitor flash protect 0 64 last off” -ex “load” -ex “monitor resume” -ex “monitor shutdown” -ex “quit”;
echo "Successfully uploaded ‘hello’ to freedom-e300-hifive1."
Open On-Chip Debugger 0.10.0-dev-gfbafe61 (2017-05-11-22:59)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : auto-selecting first available session transport “jtag”. To override use 'transport select '.
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
Info : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=0
Info : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=1
Info : Examined RISCV core; XLEN=32, misa=0x40001105
Info : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=2
Info : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=3
Info : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=4
Info : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=5
Info : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=6
Info : dtmcontrol_idle=5, dbus_busy_delay=1, interrupt_high_delay=7
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=7
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=8
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=9
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=10
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=12
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=14
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=16
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=18
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=20
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=23
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=26
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=29
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=32
Info : dtmcontrol_idle=5, dbus_busy_delay=2, interrupt_high_delay=36
riscv.cpu: target state: halted
halted at 0x20400612 due to debug interrupt
Info : accepting ‘gdb’ connection on tcp/3333
Info : Found flash device ‘issi is25lp128’ (ID 0x0018609d)
0x20400612 in _vfprintf_r ()
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
riscv.cpu: target state: halted
riscv.cpu: target state: halted
halted at 0x404 due to software breakpoint
halted at 0x404 due to software breakpoint
cleared protection for sectors 64 through 255 on flash bank 0
cleared protection for sectors 64 through 255 on flash bank 0
warning: Can not parse XML memory map; XML support was disabled at compile time
Loading section .init, size 0x72 lma 0x20400000
Loading section .text, size 0xb94e lma 0x20400074
Error: Core got an exception (0xffffffff) while writing to 0x2040006c
Error: (It may have failed between 0x20400000 and 0x2040006b as well, but we didn’t check then.)
Load failed
Error: Core got an exception (0xffffffff) while writing to 0x20403e8c
Error: (It may have failed between 0x20400074 and 0x20403e8b as well, but we didn’t check then.)
halted at 0x20400644 due to step
halted at 0x20400644 due to step
shutdown command invoked
shutdown command invoked
A debugging session is active.

Inferior 1 [Remote target] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
Remote communication error. Target disconnected.: Connection reset by peer.
Successfully uploaded ‘hello’ to freedom-e300-hifive1.

HI All

I know the reason.
I have to install libexpat1-dev then rebuilt the toolchain.
Now I can upload the software.
But I can’t run with gdb.
When running the gdb, I encounter the error as below

kaihsin@ubuntu:~/test/freedom-e-sdk$ make run_gdb PROGRAM=dhrystone BOARD=freedom-e300-hifive1
/home/kaihsin/test/freedom-e-sdk/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gdb software/dhrystone/dhrystone -ex “set remotetimeout 240” -ex "target extended-remote localhost:3333"
GNU gdb (GDB) 7.12.50.20170322-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=i686-pc-linux-gnu --target=riscv64-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 software/dhrystone/dhrystone…done.
localhost:3333: Connection timed out.

Are you also running openOCD in another terminal:
make run_openocd PROGRAM=dhrystone BOARD=freedom-e300-hifive1

gdb has to connect to openOCD to talk to the hardware.

HI Drew

Yes. You are correct.
Thanks for your help

Looks like a fix has just been checked in.

Smooth. :wink: