riscv-rust / riscv-rust-quickstart

A template for building Rust applications for HiFive1 boards
205 stars 24 forks source link

Could not compile `riscv-rust-quickstart`. #4

Closed engineerJishnu closed 5 years ago

engineerJishnu commented 5 years ago

cargo run Updating crates.io index Downloaded hifive1 v0.5.0 Downloaded e310x-hal v0.5.0 Downloaded embedded-hal v0.2.3 Downloaded e310x v0.5.0 Compiling e310x v0.5.0 Compiling hifive1 v0.5.0 Compiling embedded-hal v0.2.3 Compiling e310x-hal v0.5.0 Compiling riscv-rust-quickstart v0.1.0 (/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a) error: linking with rust-lld failed: exit code: 1 | = note: "rust-lld" "-flavor" "gnu" "-L" "/home/jishnuch/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865.2v5z92f4kufubo09.rcgu.o" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865.3ln32byj86n95k05.rcgu.o" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865.41miiojsp6tg8por.rcgu.o" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865.4446yfjab6jrhtqv.rcgu.o" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865.4axbgzb8w95afh6i.rcgu.o" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865.4re4bjs18swaqg72.rcgu.o" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865.5eufnp5235g0hcsn.rcgu.o" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865.goo8u5bj72ecqor.rcgu.o" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865.t0iq9y37bx2k34n.rcgu.o" "-o" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/riscv_rust_quickstart-ede915971db5d865" "--gc-sections" "-L" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps" "-L" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/debug/deps" "-L" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/build/hifive1-cf7a1820d69cc652/out" "-L" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/build/e310x-c6cd8513175931dc/out" "-L" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/build/riscv-bedb254b1eeebebd/out" "-L" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/build/riscv-rt-4bd8095cf7e29401/out" "-L" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/build/riscv-rt-4bd8095cf7e29401/out" "-L" "/home/jishnuch/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib" "-Bstatic" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libhifive1-9006b674e3762805.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libe310x_hal-cfff54b8f9f70f1e.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libembedded_hal-4857c1dde0521056.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libvoid-e072b13301e95d1e.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libnb-1d1f9be4dee3f9c1.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libe310x-3d228c153f767fa2.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libvcell-4252ae51db5d104c.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libriscv_rt-6fd54f4ef8d053e0.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libr0-271bcea9b42cf7e5.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libriscv-17562adacbbf9cbd.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libbit_field-72f8f17484dfd851.rlib" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libbare_metal-c58804a343b9a3e1.rlib" "--start-group" "/home/jishnuch/Downloads/riscv-rust-quickstart-dcc46ed07a2282cca131a680a8f8bf60ce234a8a/target/riscv32imac-unknown-none-elf/debug/deps/libpanic_halt-13b0dfd9fe0f4e96.rlib" "/home/jishnuch/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib/librustc_std_workspace_core-5a60e280b382f06e.rlib" "/home/jishnuch/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib/libcore-8010f7064010be9c.rlib" "--end-group" "/home/jishnuch/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib/libcompiler_builtins-26b11cd3df3b5c44.rlib" "-Tmemory-hifive1-revb.x" "-Tlink.x" "-Bdynamic" = note: rust-lld: error: cannot find linker script memory-hifive1-revb.x

error: aborting due to previous error

error: Could not compile riscv-rust-quickstart.

CAN U PLEASE HELP IN RESOLVING THE ABOVE PROBLEM. Regards Jishnu

Disasm commented 5 years ago

Updated the repository code. Now it should work.

engineerJishnu commented 5 years ago

thanks, I have updated riscv-rust-quickstart and executed cargo build --example hello_world // this succesfully worked. but I have two issues... (1) $ cargo run --example hello_world Finished dev [unoptimized + debuginfo] target(s) in 0.12s Running riscv64-unknown-elf-gdb -q -x gdb_init target/riscv32imac-unknown-none-elf/debug/examples/hello_world error: could not execute process riscv64-unknown-elf-gdb -q -x gdb_init target/riscv32imac-unknown-none-elf/debug/examples/hello_world (never executed)

Caused by: No such file or directory (os error 2)

also (2) JLinkGDBServer -device FE310 -if JTAG -speed 4000 -port 3333 SEGGER J-Link GDB Server V6.46c Command Line Version

JLinkARM.dll V6.46c (DLL compiled Jun 3 2019 18:36:33)

Command line: -device FE310 -if JTAG -speed 4000 -port 3333 -----GDB Server start settings----- GDBInit file: none GDB Server Listening port: 3333 SWO raw output listening port: 2332 Terminal I/O port: 2333 Accept remote connection: yes Generate logfile: off Verify download: off Init regs on start: off Silent mode: off Single run mode: off Target connection timeout: 0 ms ------J-Link related settings------ J-Link Host interface: USB J-Link script: none J-Link settings file: none ------Target related settings------ Target device: FE310 Target interface: JTAG Target interface speed: 4000kHz Target endian: little

Connecting to J-Link... J-Link is connected. Firmware: J-Link OB-K22-SiFive compiled May 27 2019 15:39:22 Hardware: V1.00 S/N: 979000204 Checking target voltage... Target voltage: 3.30 V Listening on TCP/IP port 3333 Connecting to target... J-Link found 1 JTAG device, Total IRLen = 5 JTAG ID: 0x20000913 (RISC-V) Connected to target Waiting for GDB connection... // getting hanged at this point

CAN U PLEASE HELP IN RESOLVING THE ABOVE PROBLEM. Regards Jishnu.

Disasm commented 5 years ago

Make sure that you have riscv64-unknown-elf-gdb in PATH. Output of JLinkGDBServer is OK, you need to run it in the background.

engineerJishnu commented 5 years ago

I am sorry to bother you again... my riscv64-unknown-elf-gdb is in path /home/jishnuch/Downloads/SiFIVE_FILES/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin can u please advise me the steps.

Regards, Jishnu

Disasm commented 5 years ago
PATH=$PATH:/home/jishnuch/Downloads/SiFIVE_FILES/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin
engineerJishnu commented 5 years ago

I did what you have suggested ... however it fails to load the hex code... (1) Terminal One jishnuch@jishnuch-UDOO-x86:~/Downloads/SiFIVE_FILES/riscv-rust-quickstart-master$ PATH=$PATH:/home/jishnuch/Downloads/SiFIVE_FILES/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin jishnuch@jishnuch-UDOO-x86:~/Downloads/SiFIVE_FILES/riscv-rust-quickstart-master$ cargo run --example hello_world Finished dev [unoptimized + debuginfo] target(s) in 0.12s Running riscv64-unknown-elf-gdb -q -x gdb_init target/riscv32imac-unknown-none-elf/debug/examples/hello_world Reading symbols from target/riscv32imac-unknown-none-elf/debug/examples/hello_world... 0x2001d694 in ?? () Expected an decimal digit (0-9) Loading section .text, size 0x5294 lma 0x20010000 Loading section .rodata, size 0x11e4 lma 0x200152a0 Start address 0x20010000, load size 25720 Transfer rate: 5023 KB/sec, 8573 bytes/write. (2) Terminal 2 jishnuch@jishnuch-UDOO-x86:~$ JLinkGDBServer -device FE310 -if JTAG -speed 4000 -port 3333 SEGGER J-Link GDB Server V6.46c Command Line Version

JLinkARM.dll V6.46c (DLL compiled Jun 3 2019 18:36:33)

Command line: -device FE310 -if JTAG -speed 4000 -port 3333 -----GDB Server start settings----- GDBInit file: none GDB Server Listening port: 3333 SWO raw output listening port: 2332 Terminal I/O port: 2333 Accept remote connection: yes Generate logfile: off Verify download: off Init regs on start: off Silent mode: off Single run mode: off Target connection timeout: 0 ms ------J-Link related settings------ J-Link Host interface: USB J-Link script: none J-Link settings file: none ------Target related settings------ Target device: FE310 Target interface: JTAG Target interface speed: 4000kHz Target endian: little

Connecting to J-Link... J-Link is connected. Firmware: J-Link OB-K22-SiFive compiled May 27 2019 15:39:22 Hardware: V1.00 S/N: 979000204 Checking target voltage... Target voltage: 3.30 V Listening on TCP/IP port 3333 Connecting to target... J-Link found 1 JTAG device, Total IRLen = 5 JTAG ID: 0x20000913 (RISC-V) Connected to target Waiting for GDB connection...Connected to 127.0.0.1 Reading all registers Read 2 bytes @ address 0x00000000 (Data = 0x0000) Read 2 bytes @ address 0x00000002 (Data = 0x0000) Read 2 bytes @ address 0x00000004 (Data = 0x0000) Read 2 bytes @ address 0x00000006 (Data = 0x0000) Read 2 bytes @ address 0x00000008 (Data = 0x0000) Read 2 bytes @ address 0x0000000A (Data = 0x0000) Read 2 bytes @ address 0x0000000C (Data = 0x0000) Read 2 bytes @ address 0x0000000E (Data = 0x0000) Read 2 bytes @ address 0x00000010 (Data = 0x0000) Read 2 bytes @ address 0x00000012 (Data = 0x0000) Read 2 bytes @ address 0x00000014 (Data = 0x0000) Read 2 bytes @ address 0x00000016 (Data = 0x0000) Read 2 bytes @ address 0x00000018 (Data = 0x0000) Read 2 bytes @ address 0x0000001A (Data = 0x0000) Read 2 bytes @ address 0x0000001C (Data = 0x0000) Read 2 bytes @ address 0x0000001E (Data = 0x0000) Read 2 bytes @ address 0x00000020 (Data = 0x0000) Read 2 bytes @ address 0x00000022 (Data = 0x0000) Read 2 bytes @ address 0x00000024 (Data = 0x0000) Read 2 bytes @ address 0x00000026 (Data = 0x0000) Read 2 bytes @ address 0x00000028 (Data = 0x0000) Read 2 bytes @ address 0x0000002A (Data = 0x0000) Read 2 bytes @ address 0x0000002C (Data = 0x0000) Read 2 bytes @ address 0x0000002E (Data = 0x0000) Read 2 bytes @ address 0x00000030 (Data = 0x0000) Read 2 bytes @ address 0x00000032 (Data = 0x0000) Read 2 bytes @ address 0x00000034 (Data = 0x0000) Read 2 bytes @ address 0x00000036 (Data = 0x0000) Read 2 bytes @ address 0x00000038 (Data = 0x0000) Read 2 bytes @ address 0x0000003A (Data = 0x0000) Read 2 bytes @ address 0x0000003C (Data = 0x0000) Read 2 bytes @ address 0x0000003E (Data = 0x0000) Read 2 bytes @ address 0x00000040 (Data = 0x0000) Read 2 bytes @ address 0x00000042 (Data = 0x0000) Read 2 bytes @ address 0x00000044 (Data = 0x0000) Read 2 bytes @ address 0x00000046 (Data = 0x0000) Read 2 bytes @ address 0x00000048 (Data = 0x0000) Read 2 bytes @ address 0x0000004A (Data = 0x0000) Read 2 bytes @ address 0x0000004C (Data = 0x0000) Read 2 bytes @ address 0x0000004E (Data = 0x0000) Read 2 bytes @ address 0x00000050 (Data = 0x0000) Read 2 bytes @ address 0x00000052 (Data = 0x0000) Read 2 bytes @ address 0x00000054 (Data = 0x0000) Read 2 bytes @ address 0x00000056 (Data = 0x0000) Read 2 bytes @ address 0x00000058 (Data = 0x0000) Read 2 bytes @ address 0x0000005A (Data = 0x0000) Read 2 bytes @ address 0x0000005C (Data = 0x0000) Read 2 bytes @ address 0x0000005E (Data = 0x0000) Read 2 bytes @ address 0x00000060 (Data = 0x0000) Read 2 bytes @ address 0x00000062 (Data = 0x0000) Received monitor command: reset halt Expected an decimal digit (0-9) Downloading 15408 bytes @ address 0x20010000 Downloading 5732 bytes @ address 0x20013C30 Downloading 4580 bytes @ address 0x200152A0 ERROR: Failed to prepare for programming. Error while determining flash info (Bank @ 0x20000000) Writing register (pc = 0x20010000) Starting target CPU...

Here I opened another terminal and ran sudo screen ttyACM1 115200 and nothing was dfisplayed. so i pressed the reset button and following messages were displayed as given below...

ERROR: Can not read register 4224 (PC) while CPU is running Reading all registers ERROR: Can not read register 4096 (X0) while CPU is running ERROR: Can not read register 4097 (X1) while CPU is running ERROR: Can not read register 4098 (X2) while CPU is running ERROR: Can not read register 4099 (X3) while CPU is running ERROR: Can not read register 4100 (X4) while CPU is running ERROR: Can not read register 4101 (X5) while CPU is running ERROR: Can not read register 4102 (X6) while CPU is running ERROR: Can not read register 4103 (X7) while CPU is running ERROR: Can not read register 4104 (X8) while CPU is running ERROR: Can not read register 4105 (X9) while CPU is running ERROR: Can not read register 4106 (X10) while CPU is running ERROR: Can not read register 4107 (X11) while CPU is running ERROR: Can not read register 4108 (X12) while CPU is running ERROR: Can not read register 4109 (X13) while CPU is running ERROR: Can not read register 4110 (X14) while CPU is running ERROR: Can not read register 4111 (X15) while CPU is running ERROR: Can not read register 4112 (X16) while CPU is running ERROR: Can not read register 4113 (X17) while CPU is running ERROR: Can not read register 4114 (X18) while CPU is running ERROR: Can not read register 4115 (X19) while CPU is running ERROR: Can not read register 4116 (X20) while CPU is running ERROR: Can not read register 4117 (X21) while CPU is running ERROR: Can not read register 4118 (X22) while CPU is running ERROR: Can not read register 4119 (X23) while CPU is running ERROR: Can not read register 4120 (X24) while CPU is running ERROR: Can not read register 4121 (X25) while CPU is running ERROR: Can not read register 4122 (X26) while CPU is running ERROR: Can not read register 4123 (X27) while CPU is running ERROR: Can not read register 4124 (X28) while CPU is running ERROR: Can not read register 4125 (X29) while CPU is running ERROR: Can not read register 4126 (X30) while CPU is running ERROR: Can not read register 4127 (X31) while CPU is running ERROR: Can not read register 4224 (PC) while CPU is running ERROR: Can not read register 4128 (F0) while CPU is running ERROR: Can not read register 4129 (F1) while CPU is running ERROR: Can not read register 4130 (F2) while CPU is running ERROR: Can not read register 4131 (F3) while CPU is running ERROR: Can not read register 4132 (F4) while CPU is running ERROR: Can not read register 4133 (F5) while CPU is running ERROR: Can not read register 4134 (F6) while CPU is running ERROR: Can not read register 4135 (F7) while CPU is running ERROR: Can not read register 4136 (F8) while CPU is running ERROR: Can not read register 4137 (F9) while CPU is running ERROR: Can not read register 4138 (F10) while CPU is running ERROR: Can not read register 4139 (F11) while CPU is running ERROR: Can not read register 4140 (F12) while CPU is running ERROR: Can not read register 4141 (F13) while CPU is running ERROR: Can not read register 4142 (F14) while CPU is running ERROR: Can not read register 4143 (F15) while CPU is running ERROR: Can not read register 4144 (F16) while CPU is running ERROR: Can not read register 4145 (F17) while CPU is running ERROR: Can not read register 4146 (F18) while CPU is running ERROR: Can not read register 4147 (F19) while CPU is running ERROR: Can not read register 4148 (F20) while CPU is running ERROR: Can not read register 4149 (F21) while CPU is running ERROR: Can not read register 4150 (F22) while CPU is running ERROR: Can not read register 4151 (F23) while CPU is running ERROR: Can not read register 4152 (F24) while CPU is running ERROR: Can not read register 4153 (F25) while CPU is running ERROR: Can not read register 4154 (F26) while CPU is running ERROR: Can not read register 4155 (F27) while CPU is running ERROR: Can not read register 4156 (F28) while CPU is running ERROR: Can not read register 4157 (F29) while CPU is running ERROR: Can not read register 4158 (F30) while CPU is running ERROR: Can not read register 4159 (F31) while CPU is running ERROR: Can not read register 1 (FFLAGS) while CPU is running ERROR: Can not read register 2 (FRM) while CPU is running ERROR: Can not read register 3 (FCSR) while CPU is running

Disasm commented 5 years ago

Just reconnect everything and try again. You're on the right way.

engineerJishnu commented 5 years ago

did what you advised...but still the same situation... jishnuch@jishnuch-UDOO-x86:~$ JLinkGDBServer -device FE310 -if JTAG -speed 4000 -port 3333 SEGGER J-Link GDB Server V6.46c Command Line Version

JLinkARM.dll V6.46c (DLL compiled Jun 3 2019 18:36:33)

Command line: -device FE310 -if JTAG -speed 4000 -port 3333 -----GDB Server start settings----- GDBInit file: none GDB Server Listening port: 3333 SWO raw output listening port: 2332 Terminal I/O port: 2333 Accept remote connection: yes Generate logfile: off Verify download: off Init regs on start: off Silent mode: off Single run mode: off Target connection timeout: 0 ms ------J-Link related settings------ J-Link Host interface: USB J-Link script: none J-Link settings file: none ------Target related settings------ Target device: FE310 Target interface: JTAG Target interface speed: 4000kHz Target endian: little

Connecting to J-Link... J-Link is connected. Firmware: J-Link OB-K22-SiFive compiled May 27 2019 15:39:22 Hardware: V1.00 S/N: 979000204 Checking target voltage... Target voltage: 3.30 V Listening on TCP/IP port 3333 Connecting to target... J-Link found 1 JTAG device, Total IRLen = 5 JTAG ID: 0x20000913 (RISC-V) Connected to target Waiting for GDB connection...Connected to 127.0.0.1 Reading all registers Read 2 bytes @ address 0x00000000 (Data = 0x0000) Read 2 bytes @ address 0x00000002 (Data = 0x0000) Read 2 bytes @ address 0x00000004 (Data = 0x0000) Read 2 bytes @ address 0x00000006 (Data = 0x0000) Read 2 bytes @ address 0x00000008 (Data = 0x0000) Read 2 bytes @ address 0x0000000A (Data = 0x0000) Read 2 bytes @ address 0x0000000C (Data = 0x0000) Read 2 bytes @ address 0x0000000E (Data = 0x0000) Read 2 bytes @ address 0x00000010 (Data = 0x0000) Read 2 bytes @ address 0x00000012 (Data = 0x0000) Read 2 bytes @ address 0x00000014 (Data = 0x0000) Read 2 bytes @ address 0x00000016 (Data = 0x0000) Read 2 bytes @ address 0x00000018 (Data = 0x0000) Read 2 bytes @ address 0x0000001A (Data = 0x0000) Read 2 bytes @ address 0x0000001C (Data = 0x0000) Read 2 bytes @ address 0x0000001E (Data = 0x0000) Read 2 bytes @ address 0x00000020 (Data = 0x0000) Read 2 bytes @ address 0x00000022 (Data = 0x0000) Read 2 bytes @ address 0x00000024 (Data = 0x0000) Read 2 bytes @ address 0x00000026 (Data = 0x0000) Read 2 bytes @ address 0x00000028 (Data = 0x0000) Read 2 bytes @ address 0x0000002A (Data = 0x0000) Read 2 bytes @ address 0x0000002C (Data = 0x0000) Read 2 bytes @ address 0x0000002E (Data = 0x0000) Read 2 bytes @ address 0x00000030 (Data = 0x0000) Read 2 bytes @ address 0x00000032 (Data = 0x0000) Read 2 bytes @ address 0x00000034 (Data = 0x0000) Read 2 bytes @ address 0x00000036 (Data = 0x0000) Read 2 bytes @ address 0x00000038 (Data = 0x0000) Read 2 bytes @ address 0x0000003A (Data = 0x0000) Read 2 bytes @ address 0x0000003C (Data = 0x0000) Read 2 bytes @ address 0x0000003E (Data = 0x0000) Read 2 bytes @ address 0x00000040 (Data = 0x0000) Read 2 bytes @ address 0x00000042 (Data = 0x0000) Read 2 bytes @ address 0x00000044 (Data = 0x0000) Read 2 bytes @ address 0x00000046 (Data = 0x0000) Read 2 bytes @ address 0x00000048 (Data = 0x0000) Read 2 bytes @ address 0x0000004A (Data = 0x0000) Read 2 bytes @ address 0x0000004C (Data = 0x0000) Read 2 bytes @ address 0x0000004E (Data = 0x0000) Read 2 bytes @ address 0x00000050 (Data = 0x0000) Read 2 bytes @ address 0x00000052 (Data = 0x0000) Read 2 bytes @ address 0x00000054 (Data = 0x0000) Read 2 bytes @ address 0x00000056 (Data = 0x0000) Read 2 bytes @ address 0x00000058 (Data = 0x0000) Read 2 bytes @ address 0x0000005A (Data = 0x0000) Read 2 bytes @ address 0x0000005C (Data = 0x0000) Read 2 bytes @ address 0x0000005E (Data = 0x0000) Read 2 bytes @ address 0x00000060 (Data = 0x0000) Read 2 bytes @ address 0x00000062 (Data = 0x0000) Received monitor command: reset halt Expected an decimal digit (0-9) Downloading 15408 bytes @ address 0x20010000 Downloading 5732 bytes @ address 0x20013C30 Downloading 4580 bytes @ address 0x200152A0 ERROR: Failed to prepare for programming. Error while determining flash info (Bank @ 0x20000000) Writing register (pc = 0x20010000) Starting target CPU...

jishnuch@jishnuch-UDOO-x86:~/Downloads/SiFIVE_FILES/riscv-rust-quickstart-master$ PATH=$PATH:/home/jishnuch/Downloads/SiFIVE_FILES/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin jishnuch@jishnuch-UDOO-x86:~/Downloads/SiFIVE_FILES/riscv-rust-quickstart-master$ cargo run --example hello_world Finished dev [unoptimized + debuginfo] target(s) in 0.12s Running riscv64-unknown-elf-gdb -q -x gdb_init target/riscv32imac-unknown-none-elf/debug/examples/hello_world Reading symbols from target/riscv32imac-unknown-none-elf/debug/examples/hello_world... 0x2001d6a0 in ?? () Expected an decimal digit (0-9) Loading section .text, size 0x5294 lma 0x20010000 Loading section .rodata, size 0x11e4 lma 0x200152a0 Start address 0x20010000, load size 25720 Transfer rate: 43 KB/sec, 8573 bytes/write.

Program received signal SIGTRAP, Trace/breakpoint trap. 0xdeadbeef in ?? () (gdb) quit jishnuch@jishnuch-UDOO-x86:~/Downloads/SiFIVE_FILES/riscv-rust-quickstart-master$ PATH=$PATH:/home/jishnuch/Downloads/SiFIVE_FILES/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin jishnuch@jishnuch-UDOO-x86:~/Downloads/SiFIVE_FILES/riscv-rust-quickstart-master$ cargo run --example hello_world Finished dev [unoptimized + debuginfo] target(s) in 0.12s Running riscv64-unknown-elf-gdb -q -x gdb_init target/riscv32imac-unknown-none-elf/debug/examples/hello_world Reading symbols from target/riscv32imac-unknown-none-elf/debug/examples/hello_world... 0x2001d69c in ?? () Expected an decimal digit (0-9) Loading section .text, size 0x5294 lma 0x20010000 Loading section .rodata, size 0x11e4 lma 0x200152a0 Start address 0x20010000, load size 25720 Transfer rate: 4186 KB/sec, 8573 bytes/write.

Disasm commented 5 years ago

The second run of cargo run --example hello_world is OK, so what is the problem?

engineerJishnu commented 5 years ago

the program is not getting loaded into the CPU. So when I am running screen /dev/ttyACM1 115200, it is showing the previous program ... not the current hello world program. BTW have you observed this particular line in L link report ERROR: Failed to prepare for programming. Regards, Jishnu

Disasm commented 5 years ago

Unfortunately, that JLink software is not ideal and you need to restart every time you press reset button on your board. You can detect this faulty condition when you see 0xdeadbeef in ?? () in gdb or a lot of error lines in JLinkGDBServer. To resolve this just restart JLinkGDBServer and upload your firmware again.

engineerJishnu commented 5 years ago

where can I find the hex file, which I can drag and drop into Hifive folder?

Disasm commented 5 years ago

We do not generate hex file for manual upload, but you can figure out how to convert ELF file (target/riscv32imac-unknown-none-elf/debug/examples/hello_world) to ihex format. I think that objcopy can do that.

engineerJishnu commented 5 years ago

where can I find the hex file, which I can drag and drop into Hifive folder?

engineerJishnu commented 5 years ago

am happy to share that now program is getting loaded in MCU.

it may wierd for you...but I have done is that first am running cargo run --example led_gpio

then I am running JLinkGDBServer -device FE310 -if JTAG -speed 4000 -port 3333

and found it to be working.

Thank you very much for your support.

I am totally new to rust programming language. So, I need to pick this language. I will also try your spi code and will use it with ADC to read analog data from the sensors.

I tried with SPI example from freedom metal, but its not working and have left queries in SiFive forums - unfortunately no one has been able to provide any solutions till now.

as I understand from SiFive forum, that you are working with I2C and I hope very soon you provide us the successful other libraries, so that hobbyist like me can experiment with this board and use it to full potential.

I am closing this and thank you once again. Future, if I feel to need any help in risc-v rust ... will connect with you once again.