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

AMP Demo about Linux + FreeRTOS #18

Open
fanghuaqi opened this issue Nov 16, 2023 · 0 comments
Open

AMP Demo about Linux + FreeRTOS #18

fanghuaqi opened this issue Nov 16, 2023 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@fanghuaqi
Copy link
Member

fanghuaqi commented Nov 16, 2023

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 Linux Kernel.

Both Linux and FreeRTOS runs on DDR memory:

  • Core 0 Linux use: 0x80000000 -> 0xFE000000
  • Core 1 FreeRTOS use 4M started from 0xFE000000 to 0xFE040000
  1. Let us clone source code and switch to dev_nuclei_5.10_v2 branch, following steps how to do git clone clean source code 如何Clone下载干净的代码 #10

  2. Modify conf/evalsoc/build.mk and conf/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
  1. Clone Nuclei SDK 0.5.0 master branch from https://github.com/Nuclei-Software/nuclei-sdk

  2. Following steps in https://doc.nucleisys.com/nuclei_sdk/quickstart.html to setup Nuclei SDK build environment

  3. 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
  1. 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:

@fanghuaqi fanghuaqi added the documentation Improvements or additions to documentation label Nov 16, 2023
@fanghuaqi fanghuaqi self-assigned this Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant