New HiFive cannot connect to console over usb

Here’s how I fixed it (I guess @DrItanium did the same thing), just in case anyone else finds this thread because they have the same issue…

I found this old thread about the boot loader source:

which is at software/double_tap_dontboot/double_tap_dontboot.c in the SDK.

I tweaked the linker script and gdb flashing script as hinted in that old thread, to make the program be flashed at 0x20000000 instead of the usual 0x20400000:

diff --git a/Makefile b/Makefile
index 6b8e1c6..dfad2fb 100644
--- a/Makefile
+++ b/Makefile
@@ -218,7 +218,7 @@ GDB_UPLOAD_ARGS ?= --batch
 GDB_UPLOAD_CMDS += -ex "set remotetimeout 240"
 GDB_UPLOAD_CMDS += -ex "target extended-remote localhost:$(GDB_PORT)"
 GDB_UPLOAD_CMDS += -ex "monitor reset halt"
-GDB_UPLOAD_CMDS += -ex "monitor flash protect 0 64 last off"
+GDB_UPLOAD_CMDS += -ex "monitor flash protect 0 0 last off"
 GDB_UPLOAD_CMDS += -ex "load"
 GDB_UPLOAD_CMDS += -ex "monitor resume"
 GDB_UPLOAD_CMDS += -ex "monitor shutdown"
diff --git a/bsp/env/freedom-e300-hifive1/flash.lds b/bsp/env/freedom-e300-hifive1/flash.lds
index 6b37141..faa9c65 100644
--- a/bsp/env/freedom-e300-hifive1/flash.lds
+++ b/bsp/env/freedom-e300-hifive1/flash.lds
@@ -4,7 +4,7 @@ ENTRY( _start )
 
 MEMORY
 {
-  flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 512M
+  flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 512M
   ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K
 }

and then built and flashed it:

$ make software PROGRAM=double_tap_dontboot BOARD=freedom-e300-hifive1
$ make upload PROGRAM=double_tap_dontboot BOARD=freedom-e300-hifive1

and now the boot loader works the way it’s supposed to. :slight_smile:

2 Likes