Skip to content

Instantly share code, notes, and snippets.

@lupyuen
Last active January 14, 2024 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lupyuen/8805f8f21dfae237bc06dfbda210628b to your computer and use it in GitHub Desktop.
Save lupyuen/8805f8f21dfae237bc06dfbda210628b to your computer and use it in GitHub Desktop.
Apache NuttX RTOS on TinyEMU RISC-V Emulator. See https://lupyuen.codeberg.page/articles/tinyemu.html
+ git pull
Already up-to-date.
+ git status
On branch tinyemu
Your branch is up-to-date with 'origin/tinyemu'.
nothing to commit, working tree clean
++ git rev-parse HEAD
+ hash1=0f19f417026a75b567d91da6ca946f71369e9216
+ pushd ../apps
~/riscv/apps ~/riscv/nuttx
+ git pull
Already up-to-date.
+ git status
On branch tinyemu
Your branch is up-to-date with 'origin/tinyemu'.
nothing to commit, working tree clean
++ git rev-parse HEAD
+ hash2=cf27f085f56709ca5e1a31e4a91ca9e90dd69c79
+ popd
~/riscv/nuttx
+ echo NuttX Source: https://github.com/apache/nuttx/tree/0f19f417026a75b567d91da6ca946f71369e9216
+ echo NuttX Apps: https://github.com/apache/nuttx-apps/tree/cf27f085f56709ca5e1a31e4a91ca9e90dd69c79
+ riscv64-unknown-elf-gcc -v
Using built-in specs.
COLLECT_GCC=riscv64-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/Users/Luppy/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-apple-darwin/bin/../libexec/gcc/riscv64-unknown-elf/10.2.0/lto-wrapper
Target: riscv64-unknown-elf
Configured with: /scratch/jenkins/workspace/tpp-freedom-tools/tpp01--build-binary-packages--parameterized/obj/x86_64-apple-darwin/build/riscv64-unknown-elf-gcc/riscv-gcc/configure --target=riscv64-unknown-elf --prefix=/scratch/jenkins/workspace/tpp-freedom-tools/tpp01--build-binary-packages--parameterized/obj/x86_64-apple-darwin/install/riscv64-unknown-elf-gcc-10.2.0-2020.12.8-x86_64-apple-darwin --with-pkgversion='SiFive GCC-Metal 10.2.0-2020.12.8' --with-bugurl=https://github.com/sifive/freedom-tools/issues --disable-shared --disable-threads --enable-languages=c,c++ --enable-tls --with-newlib --with-sysroot=/scratch/jenkins/workspace/tpp-freedom-tools/tpp01--build-binary-packages--parameterized/obj/x86_64-apple-darwin/install/riscv64-unknown-elf-gcc-10.2.0-2020.12.8-x86_64-apple-darwin/riscv64-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=../riscv-gcc --with-system-zlib --enable-checking=yes --enable-multilib --with-abi=lp64d --with-arch=rv64imafdc CFLAGS=-O2 CXXFLAGS=-O2 'CFLAGS_FOR_TARGET=-Os -mcmodel=medany' 'CXXFLAGS_FOR_TARGET=-Os -mcmodel=medany'
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (SiFive GCC-Metal 10.2.0-2020.12.8)
+ build_nuttx
+ pushd ../nuttx
~/riscv/nuttx ~/riscv/nuttx
+ make -j 8
Create version.h
CPP: /Users/Luppy/riscv/nuttx/boards/risc-v/qemu-rv/rv-virt/scripts/ld.script-> /Users/Luppy/riscLD: nuttx
CP: nuttx.hex
+ popd
~/riscv/nuttx
+ riscv64-unknown-elf-size nuttx
text data bss dec hex filename
265621 1049 11104 277774 43d0e nuttx
+ riscv64-unknown-elf-objcopy -O binary nuttx nuttx.bin
+ cp .config nuttx.config
+ riscv64-unknown-elf-objdump --syms --source --reloc --demangle --line-numbers --wide --debugging nuttx
+ set +e
+ ../nxstyle arch/risc-v/src/bl808/bl808_timerisr.c
+ ../nxstyle arch/risc-v/src/common/riscv_mmu.h
+ ../nxstyle arch/risc-v/src/common/riscv_mmu.c
+ set -e
+ cp nuttx.cfg ../nuttx-tinyemu/docs/root-riscv64.cfg
+ cp nuttx.bin ../nuttx-tinyemu/docs/
+ cp nuttx.S ../nuttx-tinyemu/docs/
+ echo http://localhost:8080
http://localhost:8080
+ sleep 10
+ temu nuttx.cfg
123ABCnx_start: Entry
mm_initialize: Heap: name=Umem, start=0x80044580 size=33274496
mm_addregion: [Umem] Region 1: base=0x80044828 size=33273808
mm_malloc: Allocated 0x80044850, size 48
mm_malloc: Allocated 0x80044880, size 288
mm_malloc: Allocated 0x800449a0, size 32
mm_malloc: Allocated 0x800449c0, size 720
mm_malloc: Allocated 0x80044c90, size 80
mm_malloc: Allocated 0x80044ce0, size 64
mm_malloc: Allocated 0x80044d20, size 240
mm_malloc: Allocated 0x80044e10, size 464
mm_malloc: Allocated 0x80044fe0, size 176
mm_malloc: Allocated 0x80045090, size 336
mm_malloc: Allocated 0x800451e0, size 464
mm_malloc: Allocated 0x800453b0, size 464
mm_malloc: Allocated 0x80045580, size 528
builtin_initialize: Registering Builtin Loader
elf_initialize: Registering ELF
uart_register: Registering /dev/console
mm_malloc: Allocated 0x80045790, size 80
mm_malloc: Allocated 0x800457e0, size 80
uart_register: Registering /dev/ttyS0
mm_malloc: Allocated 0x80045830, size 80
mm_malloc: Allocated 0x80045880, size 80
mm_malloc: Allocated 0x800458d0, size 80
mm_malloc: Allocated 0x80045920, size 32
mm_malloc: Allocated 0x80045940, size 160
mm_malloc: Allocated 0x800459e0, size 32
mm_malloc: Allocated 0x80045a00, size 32
mm_malloc: Allocated 0x80045a20, size 32
nx_start_application: Starting init thread
task_spawn: name=nsh_main entry=0x800077b6 file_actions=0 attr=0x800444f0 argv=0x800444e8
mm_malloc: Allocated 0x80045a40, size 272
mm_malloc: Allocated 0x80045b50, size 288
mm_malloc: Allocated 0x80045c70, size 32
mm_malloc: Allocated 0x80045c90, size 720
mm_malloc: Allocated 0x80045f60, size 32
mm_malloc: Allocated 0x80045f80, size 32
mm_malloc: Allocated 0x80045fa0, size 32
mm_malloc: Allocated 0x80045fc0, size 32
mm_malloc: Allocated 0x80045fe0, size 160
mm_malloc: Allocated 0x80046080, size 3088
mm_free: Freeing 0x800459e0
mm_free: Freeing 0x80045a20
mm_free: Freeing 0x80045a00
mm_malloc: Allocated 0x800459e0, size 80
mm_malloc: Allocated 0x80046c90, size 336
virtio_mmio_init_device: VIRTIO version: 2 device: 3 vendor: ffff
mm_malloc: Allocated 0x80046de0, size 48
mm_malloc: Allocated 0x80046e10, size 96
mm_malloc: Allocated 0x80046e70, size 368
mm_malloc: Allocated 0x80046fe0, size 12448
mm_malloc: Allocated 0x80048090, size 368
mm_malloc: Allocated 0x80048200, size 12448
Hello VirtIO from NuttX!
mm_malloc: Allocated 0x80048200, size 848
nx_start: CPU0: Beginning Idle Loop
+ pkill temu
+ exit
* Terminal will be reused by tasks, press any key to close it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment