RISC-V Platform IO Debug not working (Mac OS)


I am using RISC-V Board Dev B and platform IO on Mac OS but debug is not working with some errors even though I successfully built and uploaded the project. Anyone can help this out? I will be appreciate if you can solve this problem. I tried to change the init settings, delete and reboot the project again, and everything.

Here's the console below:

Processing hifive1-revb (platform: sifive; board: hifive1-revb; framework: freedom-e-sdk)
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/sifive/hifive1-revb.html
PLATFORM: SiFive (2.0.3) > HiFive1 Rev B
HARDWARE: FE310 320MHz, 16KB RAM, 16MB Flash
DEBUG: Current (jlink) On-board (jlink)
 - framework-freedom-e-sdk 2.201908.190927 (20.19.8)
 - toolchain-riscv 1.80300.190927 (8.3.0)
LDF: Library Dependency Finder -> http://bitly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Checking size .pio/build/hifive1-revb/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  21.0% (used 3448 bytes from 16384 bytes)
Flash: [          ]   0.0% (used 4622 bytes from 16777216 bytes)
========================= [SUCCESS] Took 1.55 seconds =========================
SEGGER J-Link GDB Server V6.52 Command Line Version
JLinkARM.dll V6.52 (DLL compiled Sep 27 2019 17:51:01)

Command line: -singlerun -if JTAG -select USB -speed 1000 -jtagconf -1,-1 -device FE310 -port 2331
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
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:               on
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:        1000kHz
Target endian:                 little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link OB-K22-SiFive compiled Nov 22 2019 12:57:38
Hardware: V1.00
S/N: 979014797
Checking target voltage...
Target voltage: 3.30 V
ERROR: Failed to listen at socket (Err = -1)
ERROR: Failed to open listener port 2331
Restoring target state and closing J-Link connection...
Shutting down...
undefinedFailed to open listener port 2331
Reading symbols from /Users/davelee/Documents/PlatformIO/Projects/Lab1/.pio/build/hifive1-revb/firmware.elf...
PlatformIO Unified Debugger -> http://bitly/pio-debug
PlatformIO: debug_tool = jlink
PlatformIO: Initializing remote target...
0x00813800 in ?? ()
Select auto target interface speed (4000 kHz)
Resetting target
Loading section .init, size 0x17e lma 0x20010000
Loading section .text, size 0x704 lma 0x20010180
Loading section .rodata, size 0x8a4 lma 0x20010884
Loading section .init_array, size 0x8 lma 0x20011128
Loading section .data, size 0xe0 lma 0x20011130
Start address 0x20010000, load size 4622
Transfer rate: 752 KB/sec, 924 bytes/write.
Temporary breakpoint 1 at 0x200101a6: file src/main.c, line 5.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> http://bitly/pio-debug
Cannot insert breakpoint 1.
Cannot access memory at address 0x200101a6

Command aborted.

Also, these are my platform io init settings:

platform = sifive
board = hifive1-revb
framework = freedom-e-sdk

Also, my main function and assembly: main:

#include <stdio.h>
void asm_main();

int main() {
    while(1) { 
        return 1;


.section .text 
.align 2
.globl asm_main
.equ offset, 0x80000000
.equ data, 0xDEADBEEF 

# add program code here 
    li a1, data     # load immediate (32-bit)
    li a2, offset   # load offset address to a2
    sw a1, (a2)     # save a1 into the memory location specified by a2
    lw a3, (a2)     # load word (32-bit) from mem
    lh a4, (a2)     # load half word (16-bit) from mem 
    lb a5, (a2)     # load byte (8-bit) from mem

    mv a2, a1       # copy a1 to a2
    mv a1, x0       # clear a1. x0 is always '0'
asked on Stack Overflow Oct 15, 2020 by Dave Lee • edited Oct 15, 2020 by Dave Lee

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0