Skip to content

arch/risc-v/rp23xx-riscv: Initial rp23xx(rp2350) (Pico 2) RISC-V support #16424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shtirlic
Copy link
Contributor

@shtirlic shtirlic commented May 22, 2025

Summary

Add support for RP2350 RISC-V cores, Add Pico 2 board.

Naming

Chip name   : rp23xx-rv
Board name  : raspberrypi-pico-2-rv 
Arch        : risc-v

Changes from ARM rp23xx impl

  • Linker script update
  • ASM head start
  • Update chip start
  • New Hazard3 include regs
  • Remove rp23xx chip hw spinlocks/testset
  • New irq handling (external IRQ interrupt)
  • New timerisr based on RISC-V std MTIME and alarm arch
  • No SMP yet
  • Tickless option
  • Double size for idle, irq and main stacks
  • Board reset via watchdog trigger
    ...

Todo

  • Uart defconfig
  • ostest pass
  • usb defconfig
  • SMP
  • Reset (via watchdog trigger without wd dev)
  • Hazard3 external IRQ
  • More timers
  • Tickless testing
  • Peripherals testing
    • WDOG
    • UART
    • USB
    • PWM
    • I2C
    • SPI
    • DMA
  • Docs
    • Add chip
    • Add board
    • Toolchain info
  • Other boards
  • RISC-V Custom extensions (zba_zbb_zbs_zbkb_zca_zcb_zcmp in defconfig, add to chip?)
  • Compare getprime perf
  • LVGL perf test

Toolchain

Use RISC-V gnu toolchain with soft float abi. Default riscv-collab uses double float abi

This is config for https://github.com/riscv-collab/riscv-gnu-toolchain

./configure --prefix=/opt/riscv --with-arch=rv32imac --with-abi=ilp32

Config

Serial NSH

/tools/configure.sh raspberrypi-pico-2-rv:nsh

USB CDC/ACM Serial NSH

/tools/configure.sh raspberrypi-pico-2-rv:usbnsh

Testing

cpuinfo

nsh> cat /proc/cpuinfo
processor       : 0
hart            : 0
isa             : rv32imac
mmu             : none

nsh> free
      total       used       free    maxused    maxfree  nused  nfree name
     516820       7116     509704      45768     490456     25      3 Umem

getprime

nsh> getprime
Set thread priority to 10
Set thread policy to SCHED_RR
Start thread #0
thread #0 started, looking for primes < 10000, doing 10 run(s)
thread #0 finished, found 1230 primes, last one was 9973
Done
getprime took 4281 msec
ostest nsh output
NuttShell (NSH) NuttX-12.9.0
nsh> 
nsh> ostest
stdio_test: write fd=1
stdio_test: Standard I/O Check: printf
stdio_test: write fd=2
stdio_test: Standard I/O Check: fprintf to stderr
ostest_main: putenv(Variable1=BadValue3)
ostest_main: setenv(Variable1, GoodValue1, TRUE)
ostest_main: setenv(Variable2, BadValue1, FALSE)
ostest_main: setenv(Variable2, GoodValue2, TRUE)
ostest_main: setenv(Variable3, GoodValue3, FALSE)
ostest_main: setenv(Variable3, BadValue2, FALSE)
show_variable: Variable=Variable1 has value=GoodValue1
show_variable: Variable=Variable2 has value=GoodValue2
show_variable: Variable=Variable3 has value=GoodValue3
ostest_main: Started user_main at PID=3

user_main: Begin argument test
user_main: Started with argc=5
user_main: argv[0]="ostest"
user_main: argv[1]="Arg1"
user_main: argv[2]="Arg2"
user_main: argv[3]="Arg3"
user_main: argv[4]="Arg4"

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         1        1
mxordblk    79ce8    79ce8
uordblks     45ec     45ec
fordblks    79ce8    79ce8

user_main: getopt() test
getopt():  Simple test
getopt():  Invalid argument
getopt():  Missing optional argument
getopt_long():  Simple test
getopt_long():  No short options
getopt_long():  Argument for --option=argument
getopt_long():  Invalid long option
getopt_long():  Mixed long and short options
getopt_long():  Invalid short option
getopt_long():  Missing optional arguments
getopt_long_only():  Mixed long and short options
getopt_long_only():  Single hyphen long options

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         1        1
mxordblk    79ce8    79ce8
uordblks     45ec     45ec
fordblks    79ce8    79ce8

user_main: libc tests

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         1        1
mxordblk    79ce8    79ce8
uordblks     45ec     45ec
fordblks    79ce8    79ce8
show_variable: Variable=Variable1 has value=GoodValue1
show_variable: Variable=Variable2 has value=GoodValue2
show_variable: Variable=Variable3 has value=GoodValue3
show_variable: Variable=Variable1 has no value
show_variable: Variable=Variable2 has value=GoodValue2
show_variable: Variable=Variable3 has value=GoodValue3

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         1        2
mxordblk    79ce8    79ce8
uordblks     45ec     45cc
fordblks    79ce8    79d08
show_variable: Variable=Variable1 has no value
show_variable: Variable=Variable2 has no value
show_variable: Variable=Variable3 has no value

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    79ce8    79ce8
uordblks     45cc     4554
fordblks    79d08    79d80

user_main: setvbuf test
setvbuf_test: Test NO buffering
setvbuf_test: Using NO buffering
setvbuf_test: Test default FULL buffering
setvbuf_test: Using default FULL buffering
setvbuf_test: Test FULL buffering, buffer size 64
setvbuf_test: Using FULL buffering, buffer size 64
setvbuf_test: Test FULL buffering, pre-allocated buffer
setvbuf_test: Using FULL buffering, pre-allocated buffer
setvbuf_test: Test LINE buffering, buffer size 64
setvbuf_test: Using LINE buffering, buffer size 64
setvbuf_test: Test FULL buffering, pre-allocated buffer
setvbuf_test: Using FULL buffering, pre-allocated buffer

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    79ce8    79ce8
uordblks     4554     4554
fordblks    79d80    79d80

user_main: /dev/null test
dev_null: Read 0 bytes from /dev/null
dev_null: Wrote 1024 bytes to /dev/null

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    79ce8    79ce8
uordblks     4554     4554
fordblks    79d80    79d80

user_main: task_restart test

Test task_restart()
restart_main: setenv(VarName, VarValue, TRUE)
restart_main: Started restart_main at PID=4
restart_main: Started with argc=4
restart_main: argv[0]="ostest"
restart_main: argv[1]="This is argument 1"
restart_main: argv[2]="Argument 2 here"
restart_main: argv[3]="Lastly, the 3rd argument"
restart_main: Variable=VarName has value=VarValue
restart_main: I am still here
restart_main: I am still here
restart_main: Started restart_main at PID=4
restart_main: Started with argc=4
restart_main: argv[0]="ostest"
restart_main: argv[1]="This is argument 1"
restart_main: argv[2]="Argument 2 here"
restart_main: argv[3]="Lastly, the 3rd argument"
restart_main: Variable=VarName has value=VarValue
restart_main: Started with argc=4
restart_main: argv[0]="ostest"
restart_main: argv[1]="This is argument 1"
restart_main: argv[2]="Argument 2 here"
restart_main: argv[3]="Lastly, the 3rd argument"
restart_main: Variable=VarName has value=VarValue
restart_main: Exiting

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    79ce8    77930
uordblks     4554     6944
fordblks    79d80    77990

user_main: waitpid test

Test waitpid()
waitpid_start_child: Started waitpid_main at PID=5
waitpid_start_child: Started waitpid_main at PID=6
waitpid_main: PID 5 Started
waitpid_main: PID 6 Started
waitpid_start_child: Started waitpid_main at PID=7
waitpid_main: PID 7 Started
waitpid_test: Waiting for PID=5 with waitpid()
waitpid_main: PID 5 exitting with result=14
waitpid_main: PID 6 exitting with result=14
waitpid_test: PID 5 waitpid succeeded with stat_loc=0e00
waitpid_last: Waiting for PID=7 with waitpid()
waitpid_main: PID 7 exitting with result=14
waitpid_last: PASS: PID 7 waitpid succeeded with stat_loc=0e00

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        5
mxordblk    77930    73170
uordblks     6944     a954
fordblks    77990    73980

user_main: mutex test
Initializing mutex
Starting thread 1
Starting thread 2
                Thread1 Thread2
        Loops   32      32
        Errors  0       0

Testing moved mutex
Starting moved mutex thread 1
Starting moved mutex thread 2
                Thread1 Thread2
        Moved Loops     32      32
        Moved Errors    0       0

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         5        2
mxordblk    73170    79408
uordblks     a954     4e6c
fordblks    73980    79468

user_main: timed mutex test
mutex_test: Initializing mutex
mutex_test: Starting thread
pthread:  Started
pthread:  Waiting for lock or timeout
mutex_test: Unlocking
pthread:  Got the lock
pthread:  Waiting for lock or timeout
pthread:  Got the timeout.  Terminating
mutex_test: PASSED

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    79408    79408
uordblks     4e6c     4e6c
fordblks    79468    79468

user_main: cancel test
cancel_test: Test 1a: Normal Cancellation
cancel_test: Starting thread
start_thread: Initializing mutex
start_thread: Initializing cond
start_thread: Starting thread
start_thread: Yielding
sem_waiter: Taking mutex
sem_waiter: Starting wait for condition
cancel_test: Canceling thread
cancel_test: Joining
cancel_test: waiter exited with result=0xffffffff
cancel_test: PASS thread terminated with PTHREAD_CANCELED
cancel_test: Test 2: Asynchronous Cancellation
... Skipped
cancel_test: Test 3: Cancellation of detached thread
cancel_test: Re-starting thread
restart_thread: Destroying cond
restart_thread: Destroying mutex
restart_thread: Re-starting thread
start_thread: Initializing mutex
start_thread: Initializing cond
start_thread: Starting thread
start_thread: Yielding
sem_waiter: Taking mutex
sem_waiter: Starting wait for condition
cancel_test: Canceling thread
cancel_test: Joining
cancel_test: PASS pthread_join failed with status=ESRCH
cancel_test: Test 5: Non-cancelable threads
cancel_test: Re-starting thread (non-cancelable)
restart_thread: Destroying cond
restart_thread: Destroying mutex
restart_thread: Re-starting thread
start_thread: Initializing mutex
start_thread: Initializing cond
start_thread: Starting thread
start_thread: Yielding
sem_waiter: Taking mutex
sem_waiter: Starting wait for condition
sem_waiter: Setting non-cancelable
cancel_test: Canceling thread
cancel_test: Joining
sem_waiter: Releasing mutex
sem_waiter: Setting cancelable
cancel_test: waiter exited with result=0xffffffff
cancel_test: PASS thread terminated with PTHREAD_CANCELED
cancel_test: Test 6: Cancel message queue wait
cancel_test: Starting thread (cancelable)
Skipped
cancel_test: Test 7: Cancel signal wait
cancel_test: Starting thread (cancelable)
Skipped

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    79408    77c08
uordblks     4e6c     666c
fordblks    79468    77c68

user_main: robust test
robust_test: Initializing mutex
robust_test: Starting thread
robust_waiter: Taking mutex
robust_waiter: Exiting with mutex
robust_test: Take the lock again
robust_test: Make the mutex consistent again.
robust_test: Take the lock again
robust_test: Joining
robust_test: waiter exited with result=0
robust_test: Test complete with nerrors=0

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    77c08    77c08
uordblks     666c     666c
fordblks    77c68    77c68

user_main: semaphore test
sem_test: Initializing semaphore to 0
sem_test: Starting waiter thread 1
sem_test: Set thread 1 priority to 191
waiter_func: Thread 1 Started
sem_test: Starting waiter thread 2
waiter_func: Thread 1 initial semaphore value = 0
sem_test: Set thread 2 priority to 128
waiter_func: Thread 1 waiting on semaphore
waiter_func: Thread 2 Started
waiter_func: Thread 2 initial semaphore value = -1
waiter_func: Thread 2 waiting on semaphore
sem_test: Starting poster thread 3
sem_test: Set thread 3 priority to 64
poster_func: Thread 3 started
poster_func: Thread 3 semaphore value = -2
poster_func: Thread 3 posting semaphore
waiter_func: Thread 1 awakened
waiter_func: Thread 1 new semaphore value = -1
waiter_func: Thread 1 done
poster_func: Thread 3 new semaphore value = -1
poster_func: Thread 3 semaphore value = -1
poster_func: Thread 3 posting semaphore
waiter_func: Thread 2 awakened
poster_func: Thread 3 new semaphore value = 0
waiter_func: Thread 2 new semaphore value = 0
poster_func: Thread 3 done
waiter_func: Thread 2 done

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        3
mxordblk    77c08    78248
uordblks     666c     574c
fordblks    77c68    78b88

user_main: timed semaphore test
semtimed_test: Initializing semaphore to 0
semtimed_test: Waiting for two second timeout
semtimed_test: PASS: first test returned timeout
BEFORE: (33 sec, 682764966 nsec)
AFTER:  (35 sec, 690225406 nsec)
semtimed_test: Starting poster thread
semtimed_test: Set thread 1 priority to 191
semtimed_test: Starting poster thread 3
semtimed_test: Set thread 3 priority to 64
semtimed_test: Waiting for two second timeout
poster_func: Waiting for 1 second
poster_func: Posting
semtimed_test: PASS: sem_timedwait succeeded
BEFORE: (35 sec, 693431933 nsec)
AFTER:  (36 sec, 700571253 nsec)

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         3        2
mxordblk    78248    79408
uordblks     574c     4e6c
fordblks    78b88    79468

user_main: condition variable test
cond_test: Initializing mutex
cond_test: Initializing cond
cond_test: Starting waiter
cond_test: Set thread 1 priority to 128
waiter_thread: Started
cond_test: Starting signaler
cond_test: Set thread 2 priority to 64
thread_signaler: Started
thread_signaler: Terminating
cond_test: signaler terminated, now cancel the waiter
cond_test:      Waiter  Signaler
cond_test: Loops        32      32
cond_test: Errors       0       0
cond_test:
cond_test: 0 times, waiter did not have to wait for data
cond_test: 0 times, data was already available when the signaler run
cond_test: 0 times, the waiter was in an unexpected state when the signaler ran

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        3
mxordblk    79408    78b28
uordblks     4e6c     4e6c
fordblks    79468    79468

user_main: pthread_exit() test
pthread_exit_test: Started pthread_exit_main at PID=27
pthread_exit_main 27: Starting pthread_exit_thread
pthread_exit_main 27: Sleeping for 5 seconds
pthread_exit_thread 28: Sleeping for 10 second
pthread_exit_thread 28: Still running...
pthread_exit_main 27: Calling pthread_exit()

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         3        2
mxordblk    78b28    77328
uordblks     4e6c     6f4c
fordblks    79468    77388

user_main: pthread_rwlock test
pthread_rwlock: Initializing rwlock
pthread_exit_thread 28: Exiting

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        3
mxordblk    77328    77328
uordblks     6f4c     4e7c
fordblks    77388    79458

user_main: pthread_rwlock_cancel test
pthread_rwlock_cancel: Starting test

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         3        2
mxordblk    77328    79ce8
uordblks     4e7c     459c
fordblks    79458    79d38

user_main: timed wait test
thread_waiter: Initializing mutex
timedwait_test: Initializing cond
timedwait_test: Starting waiter
timedwait_test: Set thread 2 priority to 177
thread_waiter: Taking mutex
thread_waiter: Starting 5 second wait for condition
timedwait_test: Joining
thread_waiter: pthread_cond_timedwait timed out
thread_waiter: Releasing mutex
thread_waiter: Exit with status 0x12345678
timedwait_test: waiter exited with result=0x12345678

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    79ce8    79408
uordblks     459c     4e7c
fordblks    79d38    79458

user_main: message queue test
mqueue_test: Starting receiver
mqueue_test: Set receiver priority to 128
receiver_thread: Starting
mqueue_test: Starting sender
mqueue_test: Set sender thread priority to 64
mqueue_test: Waiting for sender to complete
sender_thread: Starting
receiver_thread: mq_receive succeeded on msg 0
sender_thread: mq_send succeeded on msg 0
receiver_thread: mq_receive succeeded on msg 1
sender_thread: mq_send succeeded on msg 1
receiver_thread: mq_receive succeeded on msg 2
sender_thread: mq_send succeeded on msg 2
receiver_thread: mq_receive succeeded on msg 3
sender_thread: mq_send succeeded on msg 3
receiver_thread: mq_receive succeeded on msg 4
sender_thread: mq_send succeeded on msg 4
receiver_thread: mq_receive succeeded on msg 5
sender_thread: mq_send succeeded on msg 5
receiver_thread: mq_receive succeeded on msg 6
sender_thread: mq_send succeeded on msg 6
receiver_thread: mq_receive succeeded on msg 7
sender_thread: mq_send succeeded on msg 7
receiver_thread: mq_receive succeeded on msg 8
sender_thread: mq_send succeeded on msg 8
receiver_thread: mq_receive succeeded on msg 9
sender_thread: mq_send succeeded on msg 9
sender_thread: returning nerrors=0
mqueue_test: Killing receiver
receiver_thread: mq_receive interrupted!
receiver_thread: returning nerrors=0
mqueue_test: Canceling receiver
mqueue_test: receiver has already terminated

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    79408    77bd8
uordblks     4e7c     66dc
fordblks    79458    77bf8

user_main: timed message queue test
timedmqueue_test: Starting sender
timedmqueue_test: Waiting for sender to complete
sender_thread: Starting
sender_thread: mq_timedsend succeeded on msg 0
sender_thread: mq_timedsend succeeded on msg 1
sender_thread: mq_timedsend succeeded on msg 2
sender_thread: mq_timedsend succeeded on msg 3
sender_thread: mq_timedsend succeeded on msg 4
sender_thread: mq_timedsend succeeded on msg 5
sender_thread: mq_timedsend succeeded on msg 6
sender_thread: mq_timedsend succeeded on msg 7
sender_thread: mq_timedsend succeeded on msg 8
sender_thread: mq_timedsend 9 timed out as expected
sender_thread: returning nerrors=0
timedmqueue_test: Starting receiver
timedmqueue_test: Waiting for receiver to complete
receiver_thread: Starting
receiver_thread: mq_timedreceive succeed on msg 0
receiver_thread: mq_timedreceive succeed on msg 1
receiver_thread: mq_timedreceive succeed on msg 2
receiver_thread: mq_timedreceive succeed on msg 3
receiver_thread: mq_timedreceive succeed on msg 4
receiver_thread: mq_timedreceive succeed on msg 5
receiver_thread: mq_timedreceive succeed on msg 6
receiver_thread: mq_timedreceive succeed on msg 7
receiver_thread: mq_timedreceive succeed on msg 8
receiver_thread: Receive 9 timed out as expected
receiver_thread: returning nerrors=0
timedmqueue_test: Test complete

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    77bd8    77bd8
uordblks     66dc     66dc
fordblks    77bf8    77bf8

user_main: sigprocmask test
sigprocmask_test: SUCCESS

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        2
mxordblk    77bd8    77bd8
uordblks     66dc     66dc
fordblks    77bf8    77bf8

user_main: signal handler test
sighand_test: Initializing semaphore to 0
sighand_test: Starting waiter task
sighand_test: Started waiter_main pid=44
waiter_main: Waiter started
waiter_main: Unmasking signal 32
waiter_main: Registering signal handler
waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0000000000000000
waiter_main: Waiting on semaphore
sighand_test: Signaling pid=44 with signo=32 sigvalue=42
waiter_main: sem_wait() successfully interrupted by signal
waiter_main: done
sighand_test: done

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        1
mxordblk    77bd8    77bc8
uordblks     66dc     670c
fordblks    77bf8    77bc8

user_main: nested signal handler test
signest_test: Starting signal waiter task at priority 101
waiter_main: Waiter started
waiter_main: Setting signal mask
signest_test: Started waiter_main pid=45
waiter_main: Registering signal handler
signest_test: Starting interfering task at priority 102
waiter_main: Waiting on semaphore
interfere_main: Waiting on semaphore
signest_test: Started interfere_main pid=46
signest_test: Simple case:
  Total signalled 1240  Odd=620 Even=620
  Total handled   1240  Odd=620 Even=620
  Total nested    0    Odd=0   Even=0  
signest_test: With task locking
  Total signalled 2480  Odd=1240 Even=1240
  Total handled   2480  Odd=1240 Even=1240
  Total nested    0    Odd=0   Even=0  
signest_test: With intefering thread
  Total signalled 3720  Odd=1860 Even=1860
  Total handled   3720  Odd=1860 Even=1860
  Total nested    0    Odd=0   Even=0  
signest_test: done

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         1        2
mxordblk    77bc8    75398
uordblks     670c     6e6c
fordblks    77bc8    77468

user_main: wdog test
wdog_test start...
wdtest_once 0 ns
wdtest_once 0 ns
wdtest_once 0 ns
wdtest_once 0 ns
wdtest_once 1 ns
wdtest_once 1 ns
wdtest_once 1 ns
wdtest_once 1 ns
wdtest_once 10 ns
wdtest_once 10 ns
wdtest_once 10 ns
wdtest_once 10 ns
wdtest_once 100 ns
wdtest_once 100 ns
wdtest_once 100 ns
wdtest_once 100 ns
wdtest_once 1000 ns
wdtest_once 1000 ns
wdtest_once 1000 ns
wdtest_once 1000 ns
wdtest_once 10000 ns
wdtest_once 10000 ns
wdtest_once 10000 ns
wdtest_once 10000 ns
wdtest_once 100000 ns
wdtest_once 100000 ns
wdtest_once 100000 ns
wdtest_once 100000 ns
wdtest_once 1000000 ns
wdtest_once 1000000 ns
wdtest_once 1000000 ns
wdtest_once 1000000 ns
wd_start with maximum delay, cancel OK, rest 2147483646
wdtest_recursive 1000000us
wd_start with maximum delay, cancel OK, rest 2147483646
wdtest_recursive 1000000us
wd_start with maximum delay, cancel OK, rest 2147483645
wdtest_recursive 1000000us
wd_start with maximum delay, cancel OK, rest 2147483645
wdtest_recursive 1000000us
recursive wdog triggered 6 times, elapsed tick 12
wdtest_recursive 10000000us
recursive wdog triggered 6 times, elapsed tick 12
wdtest_recursive 10000000us
recursive wdog triggered 6 times, elapsed tick 12
wdtest_recursive 10000000us
recursive wdog triggered 6 times, elapsed tick 12
wdtest_recursive 10000000us
recursive wdog triggered 6 times, elapsed tick 12
recursive wdog triggered 6 times, elapsed tick 12
recursive wdog triggered 6 times, elapsed tick 12
recursive wdog triggered 6 times, elapsed tick 12
wdog_test end...

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         2        3
mxordblk    75398    75398
uordblks     6e6c     710c
fordblks    77468    771c8

user_main: round-robin scheduler test
rr_test: Set thread priority to 1
rr_test: Set thread policy to SCHED_RR
rr_test: Starting first get_primes_thread
         First get_primes_thread: 55
rr_test: Starting second get_primes_thread
         Second get_primes_thread: 56
rr_test: Waiting for threads to complete -- this should take awhile
         If RR scheduling is working, they should start and complete at
         about the same time
get_primes_thread id=1 started, looking for primes < 10000, doing 10 run(s)
get_primes_thread id=2 started, looking for primes < 10000, doing 10 run(s)
get_primes_thread id=1 finished, found 1230 primes, last one was 9973
get_primes_thread id=2 finished, found 1230 primes, last one was 9973
rr_test: Done

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         3        3
mxordblk    75398    75398
uordblks     710c     5f4c
fordblks    771c8    78388

user_main: barrier test
barrier_test: Initializing barrier
barrier_test: Thread 0 created
barrier_test: Thread 1 created
barrier_func: Thread 0 started
barrier_func: Thread 1 started
barrier_test: Thread 2 created
barrier_func: Thread 2 started
barrier_test: Thread 3 created
barrier_func: Thread 3 started
barrier_test: Thread 4 created
barrier_func: Thread 4 started
barrier_test: Thread 5 created
barrier_func: Thread 5 started
barrier_test: Thread 6 created
barrier_func: Thread 6 started
barrier_test: Thread 7 created
barrier_func: Thread 7 started
barrier_func: Thread 0 calling pthread_barrier_wait()
barrier_func: Thread 1 calling pthread_barrier_wait()
barrier_func: Thread 2 calling pthread_barrier_wait()
barrier_func: Thread 3 calling pthread_barrier_wait()
barrier_func: Thread 4 calling pthread_barrier_wait()
barrier_func: Thread 5 calling pthread_barrier_wait()
barrier_func: Thread 6 calling pthread_barrier_wait()
barrier_func: Thread 7 calling pthread_barrier_wait()
barrier_func: Thread 7, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
barrier_func: Thread 0, back with status=0 (I am not special)
barrier_func: Thread 1, back with status=0 (I am not special)
barrier_func: Thread 2, back with status=0 (I am not special)
barrier_func: Thread 3, back with status=0 (I am not special)
barrier_func: Thread 4, back with status=0 (I am not special)
barrier_func: Thread 5, back with status=0 (I am not special)
barrier_func: Thread 6, back with status=0 (I am not special)
barrier_func: Thread 7 done
barrier_func: Thread 0 done
barrier_func: Thread 1 done
barrier_test: Thread 0 completed with result=0
barrier_test: Thread 1 completed with result=0
barrier_func: Thread 2 done
barrier_func: Thread 3 done
barrier_test: Thread 2 completed with result=0
barrier_test: Thread 3 completed with result=0
barrier_func: Thread 4 done
barrier_func: Thread 5 done
barrier_test: Thread 4 completed with result=0
barrier_test: Thread 5 completed with result=0
barrier_func: Thread 6 done
barrier_test: Thread 6 completed with result=0
barrier_test: Thread 7 completed with result=0

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         3        5
mxordblk    75398    75398
uordblks     5f4c     5f4c
fordblks    78388    78388

user_main: scheduler lock test
sched_lock: Starting lowpri_thread at 97
sched_lock: Set lowpri_thread priority to 97
sched_lock: Starting highpri_thread at 98
sched_lock: Set highpri_thread priority to 98
sched_lock: Waiting...
sched_lock: PASSED No pre-emption occurred while scheduler was locked.
sched_lock: Starting lowpri_thread at 97
sched_lock: Set lowpri_thread priority to 97
sched_lock: Starting highpri_thread at 98
sched_lock: Set highpri_thread priority to 98
sched_lock: Waiting...
sched_lock: PASSED No pre-emption occurred while scheduler was locked.
sched_lock: Finished

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         5        4
mxordblk    75398    75398
uordblks     5f4c     566c
fordblks    78388    78c68

user_main: vfork() test
vfork_test: Child 73 ran successfully

Final memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       7e2d4    7e2d4
ordblks         1        3
mxordblk    79ce8    75398
uordblks     45ec     6d94
fordblks    79ce8    77540
user_main: Exiting
ostest_main: Exiting with status 0

@github-actions github-actions bot added Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Board: risc-v Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels May 22, 2025
@keever50
Copy link
Contributor

Wow!
That's great. I love RISC-V. I did not expect this RP23xx RISC-V to come to NuttX.
I will be testing this out today as well, thanks!

@acassis
Copy link
Contributor

acassis commented May 22, 2025

@shtirlic amazing! Kudos!!!

@keever50
Copy link
Contributor

Hmm, @shtirlic
configuration fails and I am not entirely sure what this means.
I cloned your branch.

Output of ./tools/configure.sh from NuttX:

mkkconfig in /home/martini/projects/cleannuttx/nuttx-apps
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_REF (defined at arch/arm/src/rp23xx/Kconfig:835, arch/risc-v/src/rp23xx-riscv/Kconfig:826) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_SYS (defined at arch/arm/src/rp23xx/Kconfig:842, arch/risc-v/src/rp23xx-riscv/Kconfig:833) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_USB (defined at arch/arm/src/rp23xx/Kconfig:848, arch/risc-v/src/rp23xx-riscv/Kconfig:839) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_ADC (defined at arch/arm/src/rp23xx/Kconfig:853, arch/risc-v/src/rp23xx-riscv/Kconfig:844) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_PERI (defined at arch/arm/src/rp23xx/Kconfig:858, arch/risc-v/src/rp23xx-riscv/Kconfig:849) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_HSTX (defined at arch/arm/src/rp23xx/Kconfig:863, arch/risc-v/src/rp23xx-riscv/Kconfig:854) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_REF (defined at arch/arm/src/rp23xx/Kconfig:891, arch/risc-v/src/rp23xx-riscv/Kconfig:882) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_SYS (defined at arch/arm/src/rp23xx/Kconfig:898, arch/risc-v/src/rp23xx-riscv/Kconfig:889) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_USB (defined at arch/arm/src/rp23xx/Kconfig:904, arch/risc-v/src/rp23xx-riscv/Kconfig:895) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_ADC (defined at arch/arm/src/rp23xx/Kconfig:909, arch/risc-v/src/rp23xx-riscv/Kconfig:900) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_PERI (defined at arch/arm/src/rp23xx/Kconfig:914, arch/risc-v/src/rp23xx-riscv/Kconfig:905) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_HSTX (defined at arch/arm/src/rp23xx/Kconfig:919, arch/risc-v/src/rp23xx-riscv/Kconfig:910) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_REF (defined at arch/arm/src/rp23xx/Kconfig:947, arch/risc-v/src/rp23xx-riscv/Kconfig:938) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_SYS (defined at arch/arm/src/rp23xx/Kconfig:954, arch/risc-v/src/rp23xx-riscv/Kconfig:945) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_USB (defined at arch/arm/src/rp23xx/Kconfig:960, arch/risc-v/src/rp23xx-riscv/Kconfig:951) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_ADC (defined at arch/arm/src/rp23xx/Kconfig:965, arch/risc-v/src/rp23xx-riscv/Kconfig:956) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_PERI (defined at arch/arm/src/rp23xx/Kconfig:970, arch/risc-v/src/rp23xx-riscv/Kconfig:961) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_HSTX (defined at arch/arm/src/rp23xx/Kconfig:975, arch/risc-v/src/rp23xx-riscv/Kconfig:966) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_REF (defined at arch/arm/src/rp23xx/Kconfig:1003, arch/risc-v/src/rp23xx-riscv/Kconfig:994) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_SYS (defined at arch/arm/src/rp23xx/Kconfig:1010, arch/risc-v/src/rp23xx-riscv/Kconfig:1001) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_USB (defined at arch/arm/src/rp23xx/Kconfig:1016, arch/risc-v/src/rp23xx-riscv/Kconfig:1007) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_ADC (defined at arch/arm/src/rp23xx/Kconfig:1021, arch/risc-v/src/rp23xx-riscv/Kconfig:1012) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_PERI (defined at arch/arm/src/rp23xx/Kconfig:1026, arch/risc-v/src/rp23xx-riscv/Kconfig:1017) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_HSTX (defined at arch/arm/src/rp23xx/Kconfig:1031, arch/risc-v/src/rp23xx-riscv/Kconfig:1022) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_REF (defined at arch/arm/src/rp23xx/Kconfig:835, arch/risc-v/src/rp23xx-riscv/Kconfig:826) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_SYS (defined at arch/arm/src/rp23xx/Kconfig:842, arch/risc-v/src/rp23xx-riscv/Kconfig:833) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_USB (defined at arch/arm/src/rp23xx/Kconfig:848, arch/risc-v/src/rp23xx-riscv/Kconfig:839) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_ADC (defined at arch/arm/src/rp23xx/Kconfig:853, arch/risc-v/src/rp23xx-riscv/Kconfig:844) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_PERI (defined at arch/arm/src/rp23xx/Kconfig:858, arch/risc-v/src/rp23xx-riscv/Kconfig:849) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT0_SRC_HSTX (defined at arch/arm/src/rp23xx/Kconfig:863, arch/risc-v/src/rp23xx-riscv/Kconfig:854) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_REF (defined at arch/arm/src/rp23xx/Kconfig:891, arch/risc-v/src/rp23xx-riscv/Kconfig:882) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_SYS (defined at arch/arm/src/rp23xx/Kconfig:898, arch/risc-v/src/rp23xx-riscv/Kconfig:889) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_USB (defined at arch/arm/src/rp23xx/Kconfig:904, arch/risc-v/src/rp23xx-riscv/Kconfig:895) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_ADC (defined at arch/arm/src/rp23xx/Kconfig:909, arch/risc-v/src/rp23xx-riscv/Kconfig:900) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_PERI (defined at arch/arm/src/rp23xx/Kconfig:914, arch/risc-v/src/rp23xx-riscv/Kconfig:905) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT1_SRC_HSTX (defined at arch/arm/src/rp23xx/Kconfig:919, arch/risc-v/src/rp23xx-riscv/Kconfig:910) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_REF (defined at arch/arm/src/rp23xx/Kconfig:947, arch/risc-v/src/rp23xx-riscv/Kconfig:938) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_SYS (defined at arch/arm/src/rp23xx/Kconfig:954, arch/risc-v/src/rp23xx-riscv/Kconfig:945) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_USB (defined at arch/arm/src/rp23xx/Kconfig:960, arch/risc-v/src/rp23xx-riscv/Kconfig:951) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_ADC (defined at arch/arm/src/rp23xx/Kconfig:965, arch/risc-v/src/rp23xx-riscv/Kconfig:956) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_PERI (defined at arch/arm/src/rp23xx/Kconfig:970, arch/risc-v/src/rp23xx-riscv/Kconfig:961) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT2_SRC_HSTX (defined at arch/arm/src/rp23xx/Kconfig:975, arch/risc-v/src/rp23xx-riscv/Kconfig:966) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_REF (defined at arch/arm/src/rp23xx/Kconfig:1003, arch/risc-v/src/rp23xx-riscv/Kconfig:994) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_SYS (defined at arch/arm/src/rp23xx/Kconfig:1010, arch/risc-v/src/rp23xx-riscv/Kconfig:1001) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_USB (defined at arcLoaded configuration '.config'
Configuration saved to '.config'
h/arm/src/rp23xx/Kconfig:1016, arch/risc-v/src/rp23xx-riscv/Kconfig:1007) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_ADC (defined at arch/arm/src/rp23xx/Kconfig:1021, arch/risc-v/src/rp23xx-riscv/Kconfig:1012) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_PERI (defined at arch/arm/src/rp23xx/Kconfig:1026, arch/risc-v/src/rp23xx-riscv/Kconfig:1017) is defined with a prompt outside the choice
warning: the choice symbol RP23XX_CLK_GPOUT3_SRC_HSTX (defined at arch/arm/src/rp23xx/Kconfig:1031, arch/risc-v/src/rp23xx-riscv/Kconfig:1022) is defined with a prompt outside the choice
make: *** [tools/Unix.mk:726: olddefconfig] Error 1
ERROR: failed to refresh

Possibly something to do with the RISCV tool chain I have to install and configure?
I did install it into my system using 'yay' from 'AUR'.

Any idea?

@keever50
Copy link
Contributor

Okay manually compiled the toolchain with the correct configuration, but as probably expected, this did not make the nuttx configuration work 🤔

@shtirlic
Copy link
Contributor Author

Okay manually compiled the toolchain with the correct configuration, but as probably expected, this did not make the nuttx configuration work 🤔

It's just a warning(not sorted out yet) did you try to make it? Yeah toolchain from aur built with double float, that's why we have to build with soft ABI for Arch.

@shtirlic
Copy link
Contributor Author

@keever50 I updated the branch, check pls

@keever50
Copy link
Contributor

@shtirlic Nice, the warnings are gone!

How do i make this using the custom built toolchain?
It's targeting the wrong one.

riscv32-unknown-elf-ld: /opt/riscv32-gnu-toolchain-elf-bin/bin/../lib/gcc/riscv32-unknown-elf/14.2.0/libgcc.a(_udivdi3.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /opt/riscv32-gnu-toolchain-elf-bin/bin/../lib/gcc/riscv32-unknown-elf/14.2.0/libgcc.a(_udivdi3.o)

Not entirely sure how it's finding the toolchain, but i might have to change something to make it find the correct (custom) one.

@shtirlic
Copy link
Contributor Author

shtirlic commented May 22, 2025

@shtirlic Nice, the warnings are gone!

How do i make this using the custom built toolchain? It's targeting the wrong one.

riscv32-unknown-elf-ld: /opt/riscv32-gnu-toolchain-elf-bin/bin/../lib/gcc/riscv32-unknown-elf/14.2.0/libgcc.a(_udivdi3.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /opt/riscv32-gnu-toolchain-elf-bin/bin/../lib/gcc/riscv32-unknown-elf/14.2.0/libgcc.a(_udivdi3.o)

Not entirely sure how it's finding the toolchain, but i might have to change something to make it find the correct (custom) one.

You should add it to the PATH env something like this

export PATH=/opt/riscv/bin:$PATH

@keever50
Copy link
Contributor

@shtirlic
Nice! I confirmed this works perfectly fine with ostest. The serial output also looks consistent.

The problem I had was quite simple. Doing make distclean after changing toolchain path fixed the problem.

@keever50
Copy link
Contributor

@shtirlic
I have a suggestion. This could save some big headaches for developers in the future using this config.
I suggest increasing the stacksize of nsh_main by changing the default task stacksize.
See kconfig below

config INIT_STACKSIZE
int "Main thread stack size"
default DEFAULT_TASK_STACKSIZE(=2048)
help
The size of the stack to allocate for the user initialization thread
that is started as soon as the OS completes its initialization.

As you can see, default is 2k, which is exceeded after enabling some basic debugging or applications in kconfig. Causing crashes without notice.
See image below for stack usage:

image

This chip has plenty of memory and I consider that few kB of extra memory usage to prevent headaches worth it.
4k should be more than enough.

@shtirlic
Copy link
Contributor Author

shtirlic commented May 23, 2025

Update:
changed the chip name to rp23xx-rv and board name to raspberrypi-pico-2-rv to me more consistent
@keever50

29 .. CONFIG_IDLETHREAD_STACKSIZE=2048
30 29 CONFIG_INIT_ENTRYPOINT="nsh_main"
31 .. CONFIG_INIT_STACKSIZE=4096
32 .. CONFIG_IRQ_WORK_STACKSIZE=4096

Remember always do: make distclean before updating the branch

@keever50
Copy link
Contributor

Update:
changed the chip name to rp23xx-rv and board name to raspberrypi-pico-2-rv to me more consistent
@keever50

29 .. CONFIG_IDLETHREAD_STACKSIZE=2048
30 29 CONFIG_INIT_ENTRYPOINT="nsh_main"
31 .. CONFIG_INIT_STACKSIZE=4096
32 .. CONFIG_IRQ_WORK_STACKSIZE=4096

Remember always do: make distclean before updating the branch

That's perfect thank you!

@shtirlic shtirlic changed the title arch/risc-v/rp23xx-riscv: Initial rp23xx RISC-V support arch/risc-v/rp23xx-riscv: Initial rp23xx(rp2350) (Pico 2) RISC-V support May 23, 2025
@shtirlic shtirlic force-pushed the riscvrp23xx branch 4 times, most recently from bee91f0 to 9d164e5 Compare May 24, 2025 18:21
@cederom
Copy link
Contributor

cederom commented May 28, 2025

Hey there @shtirlic great work, keeping my fingers crossed! I have rPI-Pico2 and rPI-Pico2W boards, will test on FreeBSD with system provided toolchain and/or espressif rv32 toolchain that I use to work with ESP32-C3/C6 :-)

@shtirlic
Copy link
Contributor Author

Update:
Handling multiple external interrupts via Hazard3 interrupt extension
i2c working

@shtirlic
Copy link
Contributor Author

Update: finally USB is working, from now you can use board USB defconfig.
The problem was in code enabling and disabling external interrupts, Hazard3 uses custom interrupt extension (PLIC like) for handling external (devices) interrupts and some custom register arrays for external interrupt enable/force/pending array

3.8.6.1. Xh3irq: Hazard3 interrupt controller
Xh3irq controls up to 512 external interrupts, with up to 16 levels of pre-emption. It is architected as a layer on top of the
standard mip.meip external interrupt line, and all standard RISC-V interrupt behaviour still applies. This extension adds no
new instructions, but does add several CSRs:
• MEIEA: external interrupt enable array
• MEIPA: external interrupt pending array
• MEIFA: external interrupt force array
• MEIPRA: external interrupt priority array
• MEINEXT: get next external interrupt
• MEICONTEXT: external interrupt context register
Xh3irq is geared towards supporting interrupt handlers as bare C functions, with dispatch implemented in software and
pre-emption priority logic implemented in hardware. However, the exact interrupt ABI is up to the implementation of the
soft dispatch routine installed as the mip.meip external interrupt handler.

@cederom
Copy link
Contributor

cederom commented Jun 26, 2025

Excellen work @shtirlic :-) What compiler do you use? Looks like some custom compiler is required?

On FreeBSD 14.2-RELEASE-p3 with default system riscv32-unknown-elf- toolchain I have build errors, and Espressif's riscv32-esp-elf- does not seem to handle required extensions :-P

Configuration is okay:

% ./tools/configure.sh -B raspberrypi-pico-2-rv:nsh
  Copy files
  Select CONFIG_HOST_BSD=y
  Refreshing...
CP: arch/dummy/Kconfig to /XXX/nuttx/pr/nuttx.git/arch/dummy/dummy_kconfig
CP: boards/dummy/Kconfig to /XXX/nuttx/pr/nuttx.git/boards/dummy/dummy_kconfig
LN: platform/board to /XXX/nuttx/pr/nuttx-apps.git/platform/dummy
LN: include/arch to arch/risc-v/include
LN: include/arch/board to /XXX/nuttx/pr/nuttx.git/boards/risc-v/rp23xx-rv/raspberrypi-pico-2-rv/include
LN: drivers/platform to /XXX/nuttx/pr/nuttx.git/drivers/dummy
LN: include/arch/chip to /XXX/nuttx/pr/nuttx.git/arch/risc-v/include/rp23xx-rv
LN: arch/risc-v/src/chip to /XXX/nuttx/pr/nuttx.git/arch/risc-v/src/rp23xx-rv
LN: arch/risc-v/src/board to /XXX/nuttx/pr/nuttx.git/boards/risc-v/rp23xx-rv/raspberrypi-pico-2-rv/../common
LN: arch/risc-v/src/board/board to /XXX/nuttx/pr/nuttx.git/boards/risc-v/rp23xx-rv/raspberrypi-pico-2-rv/src
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/audioutils
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/benchmarks
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/boot
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/canutils
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/crypto
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/database
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/examples/mcuboot
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/examples/module
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/examples/rust
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/examples/sotest
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/examples
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/fsutils
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/games
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/graphics
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/industry
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/inertial
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/interpreters/luamodules
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/interpreters
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/logging
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/lte
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/math
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/mlearning
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/netutils
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/sdr
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/system
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/tee
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/testing/arch
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/testing/cxx
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/testing/drivers
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/testing/fs
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/testing/libc
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/testing/mm
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/testing/sched
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/testing
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/videoutils
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/wireless/bluetooth
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/wireless/ieee802154
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git/wireless
mkkconfig in /XXX/nuttx/pr/nuttx-apps.git
#
# configuration written to .config
#

Build with FreeBSD's riscv32-unknown-elf- toolchain fails:

% gmake -j24
Create version.h
LN: platform/board to /XXX/nuttx/pr/nuttx-apps.git/platform/dummy
Register: dd
Register: sh
Register: nsh
Register: ostest
Register: hello
Register: getprime
LD: nuttx
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_divdi3.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_divdi3.o)
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_udivdi3.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_udivdi3.o)
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_clz.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_clz.o)
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_clzsi2.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_clzsi2.o)
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_moddi3.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_moddi3.o)
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_umoddi3.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_umoddi3.o)
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_ffssi2.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_ffssi2.o)
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_fixunsdfsi.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_fixunsdfsi.o)
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_floatundidf.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(_floatundidf.o)
riscv32-unknown-elf-ld: /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(divdf3.o): can't link double-float modules with soft-float modules
riscv32-unknown-elf-ld: failed to merge target specific data of file /usr/local/lib/gcc/riscv32-unknown-elf/11.3.0/libgcc.a(divdf3.o)
riscv32-unknown-elf-ld: warning: /XXX/nuttx/pr/nuttx.git/nuttx has a LOAD segment with RWX permissions
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx.git/staging/libapps.a(nsh_fscmds.c.zraid.data.cederom.work.CeDeROM.lab.embedded.nuttx.pr.nuttx-apps.git.nshlib_1.o): in function `ls_handler':
/XXX/nuttx/pr/nuttx-apps.git/nshlib/nsh_fscmds.c:519:(.text.ls_handler+0x178): undefined reference to `__floatsisf'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx-apps.git/nshlib/nsh_fscmds.c:526:(.text.ls_handler+0x192): undefined reference to `__mulsf3'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx-apps.git/nshlib/nsh_fscmds.c:526:(.text.ls_handler+0x19a): undefined reference to `__extendsfdf2'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx-apps.git/nshlib/nsh_fscmds.c:486:(.text.ls_handler+0x266): undefined reference to `__mulsf3'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx-apps.git/nshlib/nsh_fscmds.c:488:(.text.ls_handler+0x26e): undefined reference to `__extendsfdf2'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx-apps.git/nshlib/nsh_fscmds.c:530:(.text.ls_handler+0x28c): undefined reference to `__mulsf3'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx-apps.git/nshlib/nsh_fscmds.c:530:(.text.ls_handler+0x294): undefined reference to `__extendsfdf2'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx.git/staging/libapps.a(dd_main.c.zraid.data.cederom.work.CeDeROM.lab.embedded.nuttx.pr.nuttx-apps.git.system.dd_1.o): in function `dd_main':
/XXX/nuttx/pr/nuttx-apps.git/system/dd/dd_main.c:427:(.text.dd_main+0x422): undefined reference to `__muldf3'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx.git/staging/libc.a(lib_srand.o): in function `frand1':
/XXX/nuttx/pr/nuttx.git/libs/libc/stdlib/lib_srand.c:134:(.text.nrand+0x50): undefined reference to `__floatunsidf'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx.git/staging/libc.a(lib_srand.o): in function `nrand_r':
/XXX/nuttx/pr/nuttx.git/libs/libc/stdlib/lib_srand.c:243:(.text.nrand+0x6a): undefined reference to `__floatunsidf'
riscv32-unknown-elf-ld: /XXX/nuttx/pr/nuttx.git/libs/libc/stdlib/lib_srand.c:243:(.text.nrand+0x7a): undefined reference to `__muldf3'
Memory region         Used Size  Region Size  %age Used
           FLASH:      164016 B         4 MB      3.91%
             RAM:       12836 B       512 KB      2.45%
       SCRATCH_X:           0 B         4 KB      0.00%
       SCRATCH_Y:           0 B         4 KB      0.00%
gmake[1]: *** [Makefile:191: nuttx] Error 1
gmake: *** [tools/Unix.mk:552: nuttx] Error 2

Espressif's riscv32-esp-elf- toolchain fails:

% gmake -j24 CROSSDEV=riscv32-esp-elf-
CC:  environ/env_unsetenv.c Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
-march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
-march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Assembler messages:
Fatal error: Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'-march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'

CC:  environ/env_foreach.c Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
CC:  group/group_create.c -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
CC:  group/group_join.c Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
CC:  group/group_leave.c Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
CC:  group/group_setupidlefiles.c Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: Assembler messages:
-march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'Fatal error:
-march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
Assembler messages:
Fatal error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: Invalid or unknown z ISA extension: 'zba'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
cc1: error: -march=rv32imac_zba_zbb_zbs_zbkb_zca_zcb_zcmp: unsupported ISA substring '_zba_zbb_zbs_zbkb_zca_zcb_zcmp'
gmake[1]: *** [Makefile:64: env_getenv.o] Error 1
gmake[1]: *** Waiting for unfinished jobs....
gmake[1]: *** [Makefile:64: group_create.o] Error 1
gmake[1]: *** [Makefile:64: env_foreach.o] Error 1
gmake[1]: *** [Makefile:64: env_clearenv.o] Error 1
gmake[1]: *** [Makefile:64: group_setupidlefiles.o] Error 1
gmake[1]: *** [Makefile:64: group_join.o] Error 1
gmake[1]: *** [Makefile:64: env_setenv.o] Error 1
gmake[1]: *** [Makefile:64: env_removevar.o] Error 1
gmake[1]: *** [Makefile:64: env_putenv.o] Error 1
gmake[1]: *** [Makefile:64: clock_systime_timespec.o] Error 1
gmake[1]: *** [Makefile:64: clock_systime_ticks.o] Error 1
gmake[1]: *** [Makefile:64: clock_gettime.o] Error 1
gmake[1]: *** [Makefile:64: clock_initialize.o] Error 1
gmake[1]: *** [Makefile:64: clock.o] Error 1
gmake[1]: *** [Makefile:64: clock_settime.o] Error 1
gmake[1]: *** [Makefile:64: clock_perf.o] Error 1
gmake[1]: *** [Makefile:64: group_leave.o] Error 1
gmake[1]: *** [Makefile:64: env_unsetenv.o] Error 1
gmake[1]: *** [Makefile:64: env_release.o] Error 1
gmake[1]: *** [Makefile:64: clock_realtime2absticks.o] Error 1
gmake[1]: *** [Makefile:64: env_dup.o] Error 1
gmake[1]: *** [Makefile:64: env_findvar.o] Error 1
gmake[1]: *** [Makefile:64: env_getenvironptr.o] Error 1
gmake: *** [tools/LibTargets.mk:71: sched/libsched.a] Error 2

@shtirlic
Copy link
Contributor Author

Yes, rp23xx needs soft float abi gcc compiler in the top of the pull description I provided the configure for riscv toolchain

@cederom
Copy link
Contributor

cederom commented Jun 26, 2025

@keever50: Not entirely sure how it's finding the toolchain, but i might have to change something to make it find the correct (custom) one.

You may also provide crossdev directly as make parameter i.e. make -j24 CROSSDEV=riscv32-esp-elf- and it must be in path :-)

@cederom
Copy link
Contributor

cederom commented Jun 26, 2025

@shtirlic: Yes, rp23xx needs soft float abi gcc compiler in the top of the pull description I provided the configure for riscv toolchain

Tanks @shtirlic! Missed that works now :-) Toolchain built in 5 minutes, nsh and usbnsh builds fine, will test runtime in a free moment :-)

% which riscv32-unknown-elf-gcc
/XXX/riscv-gnu-toolchain/bin/riscv32-unknown-elf-gcc

% ./tools/configure.sh -B raspberrypi-pico-2-rv:nsh
  Copy files
  Select CONFIG_HOST_BSD=y
  Refreshing...
(..)
#
# configuration written to .config
#

% /usr/bin/time -h gmake -j24 CROSSDEV=riscv32-unknown-elf-
Create version.h
LN: platform/board to /XXX/nuttx/pr/nuttx-apps.git/platform/dummy
Register: dd
Register: nsh
Register: sh
Register: hello
Register: ostest
Register: getprime
LD: nuttx
riscv32-unknown-elf-ld: warning: /XXX/nuttx/pr/nuttx.git/nuttx has a LOAD segment with RWX permissions
Memory region         Used Size  Region Size  %age Used
           FLASH:      150236 B         4 MB      3.58%
             RAM:       14408 B       512 KB      2.75%
       SCRATCH_X:           0 B         4 KB      0.00%
       SCRATCH_Y:           0 B         4 KB      0.00%
Generating: nuttx.uf2
Done.
        7,55s real              37,18s user             21,00s sys


% gmake clean distclean -j24 CROSSDEV=riscv32-unknown-elf-


% ./tools/configure.sh -B raspberrypi-pico-2-rv:usbnsh
  Copy files
  Select CONFIG_HOST_BSD=y
  Refreshing...
(..>)
#
# configuration written to .config
#

% /usr/bin/time -h gmake -j24 CROSSDEV=riscv32-unknown-elf-
Create version.h
LN: platform/board to /XXX/nuttx/pr/nuttx-apps.git/platform/dummy
Register: nsh
Register: sh
Register: dd
Register: hello
Register: ostest
Register: getprime
LD: nuttx
riscv32-unknown-elf-ld: warning: /XXX/nuttx/pr/nuttx.git/nuttx has a LOAD segment with RWX permissions
Memory region         Used Size  Region Size  %age Used
           FLASH:      170532 B         4 MB      4.07%
             RAM:       14980 B       512 KB      2.86%
       SCRATCH_X:           0 B         4 KB      0.00%
       SCRATCH_Y:           0 B         4 KB      0.00%
Generating: nuttx.uf2
Done.
        8,27s real              36,77s user             23,04s sys

@cederom
Copy link
Contributor

cederom commented Jun 26, 2025

I can see CI has the same problem - not the toolchain required :-)

Do you know @shtirlic if it is possible to build this toolchain with all possible extensions so we can have megacompiler to built them all for CI? :-)

@shtirlic
Copy link
Contributor Author

Yes, should be possible, see the https://github.com/riscv-collab/riscv-gnu-toolchain multilib feature

@shtirlic
Copy link
Contributor Author

@cederom also please have a look at https://xpack-dev-tools.github.io/riscv-none-elf-gcc-xpack/blog/2024/12/06/riscv-none-elf-gcc-v14-2-0-3-released/

@cederom
Copy link
Contributor

cederom commented Jun 26, 2025

Ah I think @lupyuen uses xpack and recommended to me that one.. there are no official builds for FreeBSD but I may create a port if its worth it :-)

@cederom
Copy link
Contributor

cederom commented Jun 28, 2025

Allright we have new xpack-riscv-none-elf-gcc 14.2.0-3 in the CI (#16645) lets see how the CI build goes :-)

[ UPDATE from PR ]

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
@keever50
Copy link
Contributor

Just want to say you are doing a great job. I am still looking forward to this. You will make an impact, at least for me. Making the Raspberry Pi Pico a NuttX option again, together with the nice risc-v arch. The USB integration absolutely does it (very flaky in rp2040)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Board: risc-v Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants