Skip to content
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

boards/risc-v: Add support for Milk-V Duo S SBC (SOPHGO SG2000 SoC) #12510

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

lupyuen
Copy link
Member

@lupyuen lupyuen commented Jun 17, 2024

Summary

This PR adds support for Milk-V Duo S 64-bit RISC-V SBC, based on SOPHGO SG2000 SoC (T-Head C906 Core). Most of the code is derived from NuttX for Ox64 BL808. The source files are explained in the articles here

Modified Files

boards/Kconfig: Added Milk-V Duo S board

arch/risc-v/src/sg2000/sg2000_timerisr.c: Fixed MTIMER_FREQ for sleep() to work correctly

New Files in boards/risc-v/sg2000/milkv_duos

src/sg2000_appinit.c: Startup Code

include/board.h: Milk-V Duo S Definitions

include/board_memorymap.h: Memory Map

src/etc/init.d/rc.sysinit, rcS: Startup Script

src/.gitignore: Ignore the tmp filesystem

scripts/ld.script: Linker Script

scripts/Make.defs: Milk-V Duo S Makefile

src/Makefile: Milk-V Duo S Makefile

Kconfig: Milk-V Duo S Config

configs/nsh/defconfig: Build Config for milkv_duos:nsh

Updated Documentation

platforms/risc-v/sg2000/index.rst: New page for SOPHGO SG2000 SoC

platforms/risc-v/sg2000/boards/milkv_duos/index.rst: Building and booting NuttX for Milk-V Duo S

Impact

This PR is needed to support NuttX on Milk-V Duo S SBC.

No impact on existing code, since the Milk-V Duo S source files are not used by existing code.

Testing

We tested the NuttX Build on Milk-V Duo S SBC via U-Boot Network Boot (TFTP):

tools/configure.sh milkv_duos:nsh
make
## Omitted: Build Initial RAM Disk, append to NuttX Kernel with padding, copy to TFTP Server
## https://github.com/lupyuen2/wip-nuttx/releases/tag/sg2000c-2

NuttX boots correctly to NSH Shell. ostest completes successfully:

NuttX Log on Milk-V Duo S

Starting kernel ...
ABC
NuttShell (NSH) NuttX-12.5.1
nsh> uname -a
NuttX 12.5.1 84e91fd52c Jun 17 2024 15:40:03 risc-v milkv_duos
nsh> free
                 total       used       free    maxused    maxfree  nused  nfree
      Kmem:    2061304      11624    2049680      38208    2042848     34      5
      Page:   20971520     647168   20324352   20324352
nsh> ls /dev
/dev:
 console
 null
 ram0
 ttyS0
 zero
nsh> hello
Hello, World!!
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 18484 msec
nsh> ostest
stdio_test: write fd=1
stdio_test: Standard I/O Check: printf
...
user_main: Exiting
ostest_main: Exiting with status 0
nsh> 

Watch the Demo Video

See the Build Outputs

See the Build Log

@lupyuen lupyuen marked this pull request as draft June 17, 2024 07:00
This PR adds support for Milk-V Duo S 64-bit RISC-V SBC, based on SOPHGO SG2000 SoC (T-Head C906 Core). Most of the code is derived from NuttX for Ox64 BL808. The source files are explained in the articles here: https://github.com/lupyuen/nuttx-sg2000

Modified Files:

`boards/Kconfig`: Added Milk-V Duo S board

`arch/risc-v/src/sg2000/sg2000_timerisr.c`: Fixed MTIMER_FREQ for sleep() to work correctly

New Files in boards/risc-v/sg2000/milkv_duos:

`src/sg2000_appinit.c`: Startup Code

`include/board.h`: Milk-V Duo S Definitions

`include/board_memorymap.h`: Memory Map

`src/etc/init.d/rc.sysinit`, `rcS`: Startup Script

`src/.gitignore`: Ignore the tmp filesystem

`scripts/ld.script`: Linker Script

`scripts/Make.defs`: Milk-V Duo S Makefile

`src/Makefile`: Milk-V Duo S Makefile

`Kconfig`: Milk-V Duo S Config

`configs/nsh/defconfig`: Build Config for `milkv_duos:nsh`

Updated Documentation:

`platforms/risc-v/sg2000/index.rst`: New page for SOPHGO SG2000 SoC

`platforms/risc-v/sg2000/boards/milkv_duos/index.rst`: Building and booting NuttX for Milk-V Duo S
@lupyuen lupyuen marked this pull request as ready for review June 17, 2024 07:52
@xiaoxiang781216 xiaoxiang781216 merged commit 0088038 into apache:master Jun 17, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants