Skip to content

Instantly share code, notes, and snippets.

@orangecms
Created January 30, 2024 00:10
Show Gist options
  • Save orangecms/b3af586726796b42400b38afa3f4c144 to your computer and use it in GitHub Desktop.
Save orangecms/b3af586726796b42400b38afa3f4c144 to your computer and use it in GitHub Desktop.
build Zephyr for VF2 / JH7110
#!/bin/bash
# get a toolchain; the one in current Ubuntu is not suitable, so use Zephyr's
# TOOLCHAIN_DL_BASE=https://github.com/zephyrproject-rtos/sdk-ng/releases/download
# TOOLCHAIN_VER=v0.16.5-rc1
# TOOLCHAIN_TAR=toolchain_linux-x86_64_riscv64-zephyr-elf.tar.xz
# wget $TOOLCHAIN_DL_BASE/$TOOLCHAIN_VER/$TOOLCHAIN_TAR
# tar -xf $TOOLCHAIN_TAR
TOOLCHAIN_DIR=$(pwd)/riscv64-zephyr-elf
SYSROOT_DIR=$TOOLCHAIN_DIR/riscv64-zephyr-elf
export CROSS_COMPILE="$TOOLCHAIN_DIR/bin/riscv64-zephyr-elf-"
export ZEPHYR_BASE=$(pwd)
# python3 -m venv .venv
. .venv/bin/activate
# pip install -r scripts/requirements-base.txt
cmake -Bbuild -GNinja \
-DBOARD=visionfive2_jh7110 \
-DSYSROOT_DIR=$SYSROOT_DIR \
samples/hello_world
ninja -Cbuild
# will get `build/zephyr/zephyr.bin` - about 18KB in size
@orangecms
Copy link
Author

orangecms commented Jan 30, 2024

sources

TODO

  • load with oreboot, run on hart0
  • configure pins for UART1
  • run oreboot main (just for a demo) on hart1 printing on UART0 and Zephyr on hart0 printing on UART1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment