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

boards/risc-v/eic7700x/starpro64: Add support for PINE64 StarPro64 SBC (ESWIN EIC7700X SoC) #94

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 168 additions & 0 deletions Documentation/platforms/risc-v/eic7700x/boards/starpro64/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
================
PINE64 StarPro64
================

`PINE64 StarPro64 <https://lupyuen.github.io/articles/starpro64>`_
is a RISC-V Single-Board Computer based on the ESWIN EIC7700X RISC-V SoC
with Quad-Core 64-bit RISC-V CPU, 32 GB LPDDR5 RAM and 100 Mbps Ethernet.

Features
========

- **System on Chip:** ESWIN EIC7700X
- **Processors:** 4 x RV64GC 1.4 GHz 64-bit RISC-V Cores
- **NPU:** 19.95 TOPS INT8
- **Memory:** 32 GB 64-bit LPDDR5
- **Storage:** 1 x microSD Connector, 1 x eMMC Pad
- **Network:** 2 x GMAC, RGMII supported
- **PCI Express:** 4-lane PCIe 3.0 (RC + EP)
- **Wireless:** WiFi, Bluetooth
- **USB:** USB 2.0 and 3.0
- **GPIO:** Full GPIO Header

Serial Console
==============

A **USB Serial Adapter** (CH340 or CP2102) is required to run NuttX
on StarPro64.

Connect the USB Serial Adapter to StarPro64 Serial Console at:

========== =================
USB Serial StarPro64 Pin
========== =================
GND Pin 6 (GND)
RX Pin 8 (UART0 TX)
TX Pin 10 (UART0 RX)
========== =================

On the USB Serial Adapter, set the **Voltage Level** to 3V3.

Connect StarPro64 to our computer with the USB Serial Adapter.
On our computer, start a Serial Terminal and connect to the USB Serial Port
at **115.2 kbps**:

.. code:: console

$ screen /dev/ttyUSB0 115200

NuttX will appear in the Serial Console when it boots on StarPro64.

RISC-V Toolchain
================

Before building NuttX for StarPro64, download the toolchain for
`xPack GNU RISC-V Embedded GCC (riscv-none-elf) <https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases>`_.

Add the downloaded toolchain ``xpack-riscv-none-elf-gcc-.../bin``
to the ``PATH`` Environment Variable.

Check the RISC-V Toolchain:

.. code:: console

$ riscv-none-elf-gcc -v

Building
========

To build NuttX for StarPro64, :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 starpro64:nsh
$ make

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-starpro64

The NuttX Image ``Image-starpro64`` will be copied to the TFTP Server in the next step.

Booting
=======

To boot NuttX on StarPro64, `install a TFTP Server <https://lupyuen.github.io/articles/starpro64#boot-nuttx-over-tftp>`_
on our computer.

Copy the file ``Image-starpro64`` from the previous section to the TFTP Server,
together with the Device Tree:

.. code:: console

$ wget https://github.com/lupyuen/nuttx-starpro64/raw/refs/heads/main/eic7700-evb.dtb
$ scp Image-starpro64 \
tftpserver:/tftpfolder/Image-starpro64
$ scp eic7700-evb.dtb \
tftpserver:/tftpfolder/eic7700-evb.dtb

Check that StarPro64 is connected to our computer via a USB Serial Adapter at 115.2 kbps:

.. code:: console

$ screen /dev/ttyUSB0 115200

When StarPro64 boots, press Ctrl-C until U-Boot stops.
At the U-Boot Prompt, run these commands to
`boot NuttX over TFTP <https://lupyuen.github.io/articles/starpro64#boot-nuttx-over-tftp>`_:

.. code:: console

# Change to your TFTP Server
$ setenv tftp_server 192.168.x.x
$ saveenv
$ dhcp ${kernel_addr_r} ${tftp_server}:Image-starpro64
$ tftpboot ${fdt_addr_r} ${tftp_server}:eic7700-evb.dtb
$ fdt addr ${fdt_addr_r}
$ booti ${kernel_addr_r} - ${fdt_addr_r}

Or configure U-Boot to `boot NuttX automatically <https://lupyuen.github.io/articles/starpro64#boot-nuttx-over-tftp>`_.

NuttX boots on StarPro64 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 UART0 at 115.2 kbps.

Peripheral Support
==================

NuttX for StarPro64 supports these peripherals:

======================== ======= =====
Peripheral Support NOTES
======================== ======= =====
UART Yes
======================== ======= =====
25 changes: 25 additions & 0 deletions Documentation/platforms/risc-v/eic7700x/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
==============
ESWIN EIC7700X
==============

`ESWIN EIC7700X <https://www.eswincomputing.com/en/products/index/36.html>`_ is a 64-bit RISC-V SoC with 4 RISC-V Cores:

- **Processors:** 4 x RV64GC 1.4 GHz 64-bit RISC-V Cores
- **NPU:** 19.95 TOPS INT8
- **Memory:** Up to 32 GB 64-bit LPDDR4 / 4x / 5
- **Storage:** eMMC 5.1, 2 x SDIO 3.0, SATA3, SPI NOR Flash
- **Video Decoding:** H.265 up to 8K @ 50 FPS, or 32 x 1080P @ 30 FPS
- **Video Encoding:** H.265 up to 8K @ 25 FPS, or 13 x 1080P @ 30 FPS
- **Image Processing:** JPEG ISO/IEC 10918-1, ITU-T T.81
- **Network:** 2 x GMAC, RGMII supported
- **PCI Express:** 4-lane PCIe 3.0 (RC + EP)
- **Peripherals:** 2 x USB 3.0 DRD (Host + Device), 12 x I2C, 5 x UART, 2 x SPI, 3 x I2S (Slave + Master)

Supported Boards
================

.. toctree::
:glob:
:maxdepth: 1

boards/*/*
23 changes: 23 additions & 0 deletions arch/risc-v/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,25 @@ config ARCH_CHIP_SG2000
---help---
SOPHGO SG2000 SoC.

config ARCH_CHIP_EIC7700X
bool "ESWIN EIC7700X"
select ARCH_RV64
select ARCH_RV_ISA_M
select ARCH_RV_ISA_A
select ARCH_RV_ISA_C
select ARCH_HAVE_FPU
select ARCH_HAVE_DPFPU
select ARCH_HAVE_MULTICPU
select ARCH_HAVE_MPU
select ARCH_MMU_TYPE_SV39
select ARCH_HAVE_ADDRENV
select ARCH_NEED_ADDRENV_MAPPING
select ARCH_HAVE_S_MODE
select ONESHOT
select ALARM_ARCH
---help---
ESWIN EIC7700X SoC.

config ARCH_CHIP_RISCV_CUSTOM
bool "Custom RISC-V chip"
select ARCH_CHIP_CUSTOM
Expand Down Expand Up @@ -534,6 +553,7 @@ config ARCH_CHIP
default "bl808" if ARCH_CHIP_BL808
default "k230" if ARCH_CHIP_K230
default "sg2000" if ARCH_CHIP_SG2000
default "eic7700x" if ARCH_CHIP_EIC7700X

config ARCH_RISCV_INTXCPT_EXTENSIONS
bool "RISC-V Integer Context Extensions"
Expand Down Expand Up @@ -774,4 +794,7 @@ endif
if ARCH_CHIP_SG2000
source "arch/risc-v/src/sg2000/Kconfig"
endif
if ARCH_CHIP_EIC7700X
source "arch/risc-v/src/eic7700x/Kconfig"
endif
endif # ARCH_RISCV
26 changes: 26 additions & 0 deletions arch/risc-v/include/eic7700x/chip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/****************************************************************************
* arch/risc-v/include/eic7700x/chip.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

#ifndef __ARCH_RISCV_INCLUDE_EIC7700X_CHIP_H
#define __ARCH_RISCV_INCLUDE_EIC7700X_CHIP_H

#endif /* __ARCH_RISCV_INCLUDE_EIC7700X_CHIP_H */
42 changes: 42 additions & 0 deletions arch/risc-v/include/eic7700x/irq.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/****************************************************************************
* arch/risc-v/include/eic7700x/irq.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

#ifndef __ARCH_RISCV_INCLUDE_EIC7700X_IRQ_H
#define __ARCH_RISCV_INCLUDE_EIC7700X_IRQ_H

/****************************************************************************
* Included Files
****************************************************************************/

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/* Number of PLIC External Interrupts supported */

#define EIC7700X_PLIC_IRQS 458

/* Map RISC-V exception code to NuttX IRQ */

#define NR_IRQS (RISCV_IRQ_SEXT + EIC7700X_PLIC_IRQS)

#endif /* __ARCH_RISCV_INCLUDE_EIC7700X_IRQ_H */
Empty file.
32 changes: 32 additions & 0 deletions arch/risc-v/src/eic7700x/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
############################################################################
# arch/risc-v/src/eic7700x/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

include common/Make.defs

# Specify our HEAD assembly file. This will be linked as
# the first object file, so it will appear at address 0
HEAD_ASRC = eic7700x_head.S

# Specify our C code within this directory to be included
CHIP_CSRCS = eic7700x_start.c eic7700x_irq_dispatch.c eic7700x_irq.c
CHIP_CSRCS += eic7700x_timerisr.c eic7700x_allocateheap.c
CHIP_CSRCS += eic7700x_mm_init.c eic7700x_pgalloc.c
Loading
Loading