Description
Let us take Nuclei U900FD
(rv32imafdc) 2 SMP Core as example, CPU 0 run Linux Kernel 5.10, and CPU 1 run FreeRTOS demo.
- Similar changes could be maded on UX900FD Core and 6.1/6.6/6.9 Linux Kernel.
- CPU required both PLIC and ECLIC present
Both Linux and FreeRTOS runs on DDR memory:
- Core 0 Linux use:
0x80000000 -> 0xFE000000
- Core 1 FreeRTOS use 4M started from
0xFE000000
to0xFE040000
-
Let us clone source code and switch to
dev_nuclei_5.10_v3
branch, following steps how to do git clone clean source code 如何Clone下载干净的代码 #10 -
Modify
conf/evalsoc/build.mk
andconf/evalsoc/freeloader.mk
as below:
diff --git a/conf/evalsoc/build.mk b/conf/evalsoc/build.mk
index c18315c..220ec62 100644
--- a/conf/evalsoc/build.mk
+++ b/conf/evalsoc/build.mk
@@ -4,7 +4,7 @@ QEMU_MACHINE_OPTS := -M nuclei_evalsoc,download=flashxip -smp 8 -m 2G
# initramfs pre command before generate initrd ramfs
INITRAMFS_PRECMD := bash $(confdir)/preramfs.sh $(confdir) $(buildroot_initramfs_sysroot) copyfiles.txt
# eg. $(confdir)/amp/cx.bin
-CORE1_APP_BIN :=
+CORE1_APP_BIN := $(confdir)/amp/amp_c1.bin
CORE2_APP_BIN :=
CORE3_APP_BIN :=
CORE4_APP_BIN :=
diff --git a/conf/evalsoc/freeloader.mk b/conf/evalsoc/freeloader.mk
index 31e3d3b..7ac9644 100644
--- a/conf/evalsoc/freeloader.mk
+++ b/conf/evalsoc/freeloader.mk
@@ -12,4 +12,4 @@ ENABLE_SMP ?= 1
ENABLE_L2 ?= 1
AMPFW_START_OFFSET ?= 0x7E000000
AMPFW_SIZE ?= 0x400000
-AMP_START_CORE ?= 8
+AMP_START_CORE ?= 1
-
Clone Nuclei SDK 0.5.0 master branch from https://github.com/Nuclei-Software/nuclei-sdk
-
Following steps in https://doc.nucleisys.com/nuclei_sdk/quickstart.html to setup Nuclei SDK build environment
-
Download prepared ampdemo.zip and unzip it to
/path/to/nuclei-sdk/application/freertos/
Now in Nuclei SDK folder
cd /path/to/nuclei-sdk/application/freertos/ampdemo
# make sure Makefile is in this ampdemo folder
# build this application for U900FD, and generate binary
make CORE=u900fd clean
make CORE=u900fd bin
# sample binary as below
$ ll -h freertos_demo.bin
-rwxr-xr-x 1 hqfang hqfang 130K Nov 16 18:03 freertos_demo.bin
# copy this binary to Nuclei Linux SDK's folder as conf/evalsoc/amp/amp_c1.bin
mkdir -p /path/to/nuclei-linux-sdk/conf/evalsoc/amp/
cp -f freertos_demo.bin /path/to/nuclei-linux-sdk/conf/evalsoc/amp/amp_c1.bin
- Build Linux SDK for U900FD
Now in Nuclei Linux SDK folder, make sure you are using a clean and up to date
dev_nuclei_5.10_v2
branch
cd /path/to/nuclei-linux-sdk
# build and generate freeloader and boot images for sdcard
# make sure step 1 changes have been made, and step 5 freertos binary has been copied
make CORE=u900fd freeloader bootimages
Get a 2 Core U900FD FPGA bitstream from Nuclei AE and evaluate it on hardware, this is not possible to run on Nuclei QEMU.
Following steps in https://github.com/Nuclei-Software/nuclei-linux-sdk/tree/dev_nuclei_5.10_v2#upload-freeloader-to-fpga-evaluation-board to upload freeloader and place boot images into SDCard.
Here is sample output, you can see freertos and linux both output in the same uart:
linux_5.10_freertos_ampdemo.log
Our prebuilt images could be found here:
- U900FD Freeloader with FreeRTOS demo: freeloader_u900fd_amp_demo_20231116.zip
- U900FD Prebuilt boot images: boot_u900fd.zip