forked from apache/nuttx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards/riscv: Add support for PINE64 Ox64 BL808 SBC
This PR adds support for PINE64 Ox64 64-bit RISC-V SBC, based on Bouffalo Lab BL808 SoC (T-Head C906 Core). Most of the code is derived from NuttX for Star64 JH7110. The source files are explained in the articles here: https://github.com/lupyuen/nuttx-ox64 ### Modified Files `boards/Kconfig`: Added Ox64 board ### New Files in boards/risc-v/bl808/ox64 `src/bl808_appinit.c`: Startup Code `include/board.h`: Ox64 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`: Ox64 Makefile `src/Makefile`: Ox64 Makefile `Kconfig`: Ox64 Config `configs/nsh/defconfig`: Build Config for `ox64:nsh` ### Updated Documentation `platforms/risc-v/bl808/index.rst`: New page for Bouffalo Lab BL808 SoC `platforms/risc-v/bl808/boards/ox64/index.rst`: Building and booting NuttX for Ox64 `platforms/risc-v/jh7110/boards/star64/index.rst`: Fix typo
- Loading branch information
1 parent
98e3615
commit 87c1b81
Showing
15 changed files
with
883 additions
and
1 deletion.
There are no files selected for viewing
149 changes: 149 additions & 0 deletions
149
Documentation/platforms/risc-v/bl808/boards/ox64/index.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
=========== | ||
PINE64 Ox64 | ||
=========== | ||
|
||
`Ox64 <https://wiki.pine64.org/wiki/Ox64>`_ is a RISC-V Single-Board Computer | ||
based on the Bouffalo Lab BL808 RISC-V SoC with C906 64-bit CPU Core and | ||
E907 / E902 32-bit CPU Cores supported by 64 MB of embedded PSRAM memory, | ||
with built-in WiFi, Bluetooth and Zigbee radio interfaces. | ||
|
||
Ox64 comes in a breadboard-friendly form factor. It has a microSD Card slot, | ||
USB 2.0 Type-C port and other peripheral interfaces. | ||
|
||
Features | ||
======== | ||
|
||
- **System on Chip:** Bouffalo Lab BL808 | ||
- **CPU:** | ||
- 64-bit T-Head C906 "D0" (RV64IMAFCV) | ||
- 32-bit T-Head E907 "M0" (RV32IMAFCP) | ||
- 32-bit T-Head E902 "LP" (RV32E[M]C) | ||
- **RAM:** Embedded 64 MB PSRAM | ||
- **Wireless:** 2.4 GHz 1T1R WiFi 802.11 b/g/n, Bluetooth 5.2, Zigbee | ||
- **Ethernet:** 10 / 100 Mbps (optional) | ||
- **Storage:** On-board 128 Mbit (16 MB) XSPI NOR Flash Memory, microSD (SDHC and SDXC) | ||
- **USB:** USB 2.0 OTG | ||
- **Audio:** Microphone and Speaker (optional) | ||
- **Video Input:** Dual-lane MIPI CSI port for Camera Module (USB-C) | ||
- **Expansion Ports:** 26 GPIO pins (including SPI, I2C and UART) | ||
|
||
Serial Console | ||
============== | ||
|
||
A **USB Serial Adapter** that supports 2 Mbps (like `CH340G Serial Adapter <https://lupyuen.github.io/articles/ox64#test-the-usb-serial-adapter>`_) | ||
is required to run NuttX on Ox64. | ||
|
||
Connect the USB Serial Adapter to Ox64 Serial Console at: | ||
|
||
========== ======== | ||
USB Serial Ox64 Pin | ||
========== ======== | ||
TX Pin 31 (GPIO 17 / UART3 RX) | ||
RX Pin 32 (GPIO 16 / UART3 TX) | ||
GND Pin 33 (GND) | ||
========== ======== | ||
|
||
On the USB Serial Adapter, set the **Voltage Level** to 3V3. | ||
|
||
Connect Ox64 to our computer with the USB Serial Adapter. | ||
On our computer, start a Serial Terminal and connect to the USB Serial Port | ||
at **2 Mbps**. | ||
|
||
NuttX will appear in the Serial Console when it boots on Ox64. | ||
|
||
RISC-V Toolchain | ||
================ | ||
|
||
Before building NuttX for Ox64, download the **RISC-V Toolchain riscv64-unknown-elf** | ||
from `SiFive RISC-V Tools <https://github.com/sifive/freedom-tools/releases/tag/v2020.12.0>`_. | ||
|
||
Add the downloaded toolchain ``riscv64-unknown-elf-toolchain-.../bin`` | ||
to the ``PATH`` Environment Variable. | ||
|
||
Check the RISC-V Toolchain: | ||
|
||
.. code:: console | ||
$ riscv64-unknown-elf-gcc -v | ||
Building | ||
======== | ||
|
||
To build NuttX for Ox64, :doc:`install the prerequisites </quickstart/install>` and | ||
:doc:`clone the git repositories </quickstart/install>` for ``nuttx`` and ``apps``. | ||
|
||
Configure the NuttX project and build the project: | ||
|
||
.. code:: console | ||
$ cd nuttx | ||
$ tools/configure.sh ox64:nsh | ||
$ make | ||
$ riscv64-unknown-elf-objcopy -O binary nuttx nuttx.bin | ||
This produces the NuttX Kernel ``nuttx.bin``. Next, build the NuttX Apps Filesystem: | ||
|
||
.. code:: console | ||
$ make export | ||
$ pushd ../apps | ||
$ tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz | ||
$ make import | ||
$ popd | ||
$ genromfs -f initrd -d ../apps/bin -V "NuttXBootVol" | ||
This generates the Initial RAM Disk ``initrd``. | ||
|
||
Package the NuttX Kernel and Initial RAM Disk into a NuttX Image: | ||
|
||
.. code:: console | ||
$ head -c 65536 /dev/zero >/tmp/nuttx.pad | ||
$ cat nuttx.bin /tmp/nuttx.pad initrd >Image | ||
The NuttX Image ``Image`` will be copied to a microSD Card in the next step. | ||
|
||
Booting | ||
======= | ||
|
||
To boot NuttX on Ox64, flash | ||
`OpenSBI and U-Boot Bootloader <https://lupyuen.github.io/articles/ox64>`_ to Ox64. | ||
|
||
NuttX boots on Star64 via a microSD Card. Prepare a | ||
`Linux microSD Card <https://lupyuen.github.io/articles/ox64>`_ for Ox64. | ||
|
||
Copy the file ``Image`` from the previous section | ||
and overwrite the file on the microSD Card. | ||
|
||
Check that Ox64 is connected to our computer via a USB Serial Adapter at 2 Mbps. | ||
|
||
Insert the microSD Card into Ox64 and power up Ox64 via the Micro USB Port. | ||
NuttX boots on Ox64 and NuttShell (nsh) appears in the Serial Console. | ||
|
||
To see the available commands in NuttShell: | ||
|
||
.. code:: console | ||
$ help | ||
Configurations | ||
============== | ||
|
||
nsh | ||
--- | ||
|
||
Basic configuration that runs NuttShell (nsh). | ||
This configuration is focused on low level, command-line driver testing. | ||
Built-in applications are supported, but none are enabled. | ||
Serial Console is enabled on UART3 at 2 Mbps. | ||
|
||
Peripheral Support | ||
================== | ||
|
||
NuttX for Ox64 supports these peripherals: | ||
|
||
======================== ======= ===== | ||
Peripheral Support NOTES | ||
======================== ======= ===== | ||
UART Yes | ||
======================== ======= ===== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
================== | ||
Bouffalo Lab BL808 | ||
================== | ||
|
||
`Bouffalo Lab BL808 <https://github.com/bouffalolab/bl_docs/tree/main/BL808_RM/en>`_ is a 64-bit / 32-bit RISC-V SoC with 3 RISC-V Cores: | ||
|
||
- **D0 Multimedia Core:** T-Head C906 480 MHz 64-bit RISC-V CPU | ||
- RV64IMAFCV | ||
- Level 1 Instruction and Data Cache (Harvard architecture) | ||
- Sv39 Memory Management Unit | ||
- jTLB (128 entries) | ||
- AXI 4.0 128-bit master interface | ||
- Core Local Interrupt (CLINT) and Platform-Level Interrupt Controller (PLIC) | ||
- 80 External Interrupt Sources | ||
- BHT (8K) and BTB | ||
- RISC-V PMP (8 configurable areas) | ||
|
||
- **M0 Wireless Core:** T-Head E907 320 MHz 32-bit RISC-V CPU | ||
- RV32IMAFCP | ||
- 32-bit / 16-bit Mixed Instruction Set | ||
- RISC-V Machine Mode and User Mode | ||
- 32 x 32-bit Integer General Purpose Registers (GPR) | ||
- 32 x 32-bit / 64-bit Floating-Point GPRs | ||
- AXI 4.0 main device interface and AHB 5.0 peripheral interface | ||
- Instruction and Data Cache | ||
|
||
- **LP Low Power Core:** T-Head E902 150 MHz 32-bit RISC-V CPU | ||
- RV32E[M]C | ||
|
||
- **RAM:** Embedded 64 MB PSRAM | ||
- **Wireless:** 2.4 GHz 1T1R WiFi 802.11 b/g/n, Bluetooth 5.2, Zigbee | ||
- **Ethernet:** 10 / 100 Mbps | ||
- **USB:** USB 2.0 OTG | ||
- **Audio:** Microphone and Speaker | ||
- **Video Input:** Dual-lane MIPI CSI | ||
- **Peripherals:** UART, SPI, I2C, PWM, SDH, EMAC, USB | ||
|
||
Supported Boards | ||
================ | ||
|
||
.. toctree:: | ||
:glob: | ||
:maxdepth: 1 | ||
|
||
boards/*/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# | ||
# This file is autogenerated: PLEASE DO NOT EDIT IT. | ||
# | ||
# You can use "make menuconfig" to make any modifications to the installed .config file. | ||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your | ||
# modifications. | ||
# | ||
# CONFIG_DISABLE_OS_API is not set | ||
# CONFIG_NSH_DISABLE_LOSMART is not set | ||
# CONFIG_STANDARD_SERIAL is not set | ||
CONFIG_ARCH="risc-v" | ||
CONFIG_ARCH_ADDRENV=y | ||
CONFIG_ARCH_BOARD="ox64" | ||
CONFIG_ARCH_BOARD_BL808_OX64=y | ||
CONFIG_ARCH_CHIP="bl808" | ||
CONFIG_ARCH_CHIP_BL808=y | ||
CONFIG_ARCH_DATA_NPAGES=128 | ||
CONFIG_ARCH_DATA_VBASE=0x80100000 | ||
CONFIG_ARCH_HEAP_NPAGES=128 | ||
CONFIG_ARCH_HEAP_VBASE=0x80200000 | ||
CONFIG_ARCH_INTERRUPTSTACK=2048 | ||
CONFIG_ARCH_KERNEL_STACKSIZE=3072 | ||
CONFIG_ARCH_PGPOOL_MAPPING=y | ||
CONFIG_ARCH_PGPOOL_PBASE=0x50600000 | ||
CONFIG_ARCH_PGPOOL_SIZE=4194304 | ||
CONFIG_ARCH_PGPOOL_VBASE=0x50600000 | ||
CONFIG_ARCH_RISCV=y | ||
CONFIG_ARCH_STACKDUMP=y | ||
CONFIG_ARCH_TEXT_NPAGES=128 | ||
CONFIG_ARCH_TEXT_VBASE=0x80000000 | ||
CONFIG_ARCH_USE_MMU=y | ||
CONFIG_ARCH_USE_MPU=y | ||
CONFIG_ARCH_USE_S_MODE=y | ||
CONFIG_BL808_UART3=y | ||
CONFIG_BOARDCTL_ROMDISK=y | ||
CONFIG_BOARD_LATE_INITIALIZE=y | ||
CONFIG_BOARD_LOOPSPERMSEC=116524 | ||
CONFIG_BUILD_KERNEL=y | ||
CONFIG_DEBUG_ASSERTIONS=y | ||
CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y | ||
CONFIG_DEBUG_FEATURES=y | ||
CONFIG_DEBUG_FULLOPT=y | ||
CONFIG_DEBUG_SYMBOLS=y | ||
CONFIG_DEV_ZERO=y | ||
CONFIG_ELF=y | ||
CONFIG_EXAMPLES_HELLO=m | ||
CONFIG_FS_PROCFS=y | ||
CONFIG_FS_ROMFS=y | ||
CONFIG_IDLETHREAD_STACKSIZE=3072 | ||
CONFIG_INIT_FILEPATH="/system/bin/init" | ||
CONFIG_INIT_MOUNT=y | ||
CONFIG_INIT_MOUNT_FLAGS=0x1 | ||
CONFIG_INIT_MOUNT_TARGET="/system/bin" | ||
CONFIG_INIT_STACKSIZE=3072 | ||
CONFIG_INTELHEX_BINARY=y | ||
CONFIG_LIBC_ENVPATH=y | ||
CONFIG_LIBC_EXECFUNCS=y | ||
CONFIG_LIBC_PERROR_STDOUT=y | ||
CONFIG_LIBC_STRERROR=y | ||
CONFIG_MEMSET_64BIT=y | ||
CONFIG_MEMSET_OPTSPEED=y | ||
CONFIG_MM_PGALLOC=y | ||
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 | ||
CONFIG_NSH_ARCHINIT=y | ||
CONFIG_NSH_FILEIOSIZE=512 | ||
CONFIG_NSH_FILE_APPS=y | ||
CONFIG_NSH_READLINE=y | ||
CONFIG_PATH_INITIAL="/system/bin" | ||
CONFIG_RAM_SIZE=1048576 | ||
CONFIG_RAM_START=0x50200000 | ||
CONFIG_READLINE_CMD_HISTORY=y | ||
CONFIG_RR_INTERVAL=200 | ||
CONFIG_SCHED_LPWORK=y | ||
CONFIG_SCHED_WAITPID=y | ||
CONFIG_STACK_COLORATION=y | ||
CONFIG_START_MONTH=12 | ||
CONFIG_START_YEAR=2021 | ||
CONFIG_SYMTAB_ORDEREDBYNAME=y | ||
CONFIG_SYSTEM_NSH=y | ||
CONFIG_SYSTEM_NSH_PROGNAME="init" | ||
CONFIG_TESTING_GETPRIME=y | ||
CONFIG_UART3_BAUD=2000000 | ||
CONFIG_UART3_SERIAL_CONSOLE=y | ||
CONFIG_USEC_PER_TICK=1000 |
Oops, something went wrong.