Skip to content

Commit cfc9029

Browse files
cwespressifAlan Carvalho de Assis
authored andcommitted
risc-v/esp32c6: Add ESP32-C6 basic support
1. Bring up OS kernel. 2. Add interrupt support. 3. Add system timer support. 4. Add the ESP32-C6 devkit board. 5. Add basic UART support for console. 6. Add clock configuration. 7. Add board reset support.
1 parent 2334484 commit cfc9029

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+11871
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
==================
2+
Espressif ESP32-C6
3+
==================
4+
5+
The ESP32-C6 is an ultra-low-power and highly integrated SoC with a RISC-V
6+
core and supports 2.4 GHz Wi-Fi 6, Bluetooth 5 (LE) and the 802.15.4 protocol.
7+
8+
* Address Space
9+
- 800 KB of internal memory address space accessed from the instruction bus
10+
- 560 KB of internal memory address space accessed from the data bus
11+
- 1016 KB of peripheral address space
12+
- 8 MB of external memory virtual address space accessed from the instruction bus
13+
- 8 MB of external memory virtual address space accessed from the data bus
14+
- 480 KB of internal DMA address space
15+
* Internal Memory
16+
- 320 KB ROM
17+
- 512 KB SRAM (16 KB can be configured as Cache)
18+
- 16 KB of SRAM in RTC
19+
* External Memory
20+
- Up to 16 MB of external flash
21+
* Peripherals
22+
- 35 peripherals
23+
* GDMA
24+
- 7 modules are capable of DMA operations.
25+
26+
ESP32-C6 Toolchain
27+
==================
28+
29+
A generic RISC-V toolchain can be used to build ESP32-C6 projects.
30+
SiFive's toolchain can be downloaded from: https://github.com/sifive/freedom-tools/releases
31+
32+
Second stage bootloader and partition table
33+
===========================================
34+
35+
The NuttX port for now relies on IDF's second stage bootloader to carry on some hardware
36+
initializations. The binaries for the bootloader and the partition table can be found in
37+
this repository: https://github.com/espressif/esp-nuttx-bootloader
38+
That repository contains a dummy IDF project that's used to build the bootloader and
39+
partition table, these are then presented as Github assets and can be downloaded
40+
from: https://github.com/espressif/esp-nuttx-bootloader/releases
41+
Download ``bootloader-esp32c6.bin`` and ``partition-table-esp32c6.bin`` and place them
42+
in a folder, the path to this folder will be used later to program them. This
43+
can be: ``../esp-bins``
44+
45+
Building and flashing
46+
=====================
47+
48+
First make sure that ``esptool.py`` is installed. This tool is used to convert
49+
the ELF to a compatible ESP32-C6 image and to flash the image into the board.
50+
It can be installed with: ``pip install esptool``.
51+
52+
Configure the NUttX project: ``./tools/configure.sh esp32c6-devkit:nsh``
53+
Run ``make`` to build the project. Note that the conversion mentioned above is
54+
included in the build process.
55+
The `esptool.py` command to flash all the binaries is::
56+
57+
esptool.py --chip esp32c6 --port /dev/ttyUSBXX --baud 921600 write_flash 0x0 bootloader.bin 0x8000 partition-table.bin 0x10000 nuttx.bin
58+
59+
However, this is also included in the build process and we can build and flash with::
60+
61+
make flash ESPTOOL_PORT=<port> ESPTOOL_BINDIR=../esp-bins
62+
63+
Where ``<port>`` is typically ``/dev/ttyUSB0`` or similar and ``../esp-bins`` is
64+
the path to the folder containing the bootloader and the partition table
65+
for the ESP32-C6 as explained above.
66+
Note that this step is required only one time. Once the bootloader and partition
67+
table are flashed, we don't need to flash them again. So subsequent builds
68+
would just require: ``make flash ESPTOOL_PORT=/dev/ttyUSBXX``

arch/risc-v/Kconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,29 @@ config ARCH_CHIP_ESP32C3
8787
---help---
8888
Espressif ESP32-C3 (RV32IMC).
8989

90+
config ARCH_CHIP_ESP32C6
91+
bool "Espressif ESP32-C6"
92+
select ARCH_RV32
93+
select ARCH_RV_ISA_M
94+
select ARCH_RV_ISA_A
95+
select ARCH_RV_ISA_C
96+
select ARCH_VECNOTIRQ
97+
select ARCH_HAVE_RESET
98+
select LIBC_ARCH_MEMCPY
99+
select LIBC_ARCH_MEMCHR
100+
select LIBC_ARCH_MEMCMP
101+
select LIBC_ARCH_MEMMOVE
102+
select LIBC_ARCH_MEMSET
103+
select LIBC_ARCH_STRCHR
104+
select LIBC_ARCH_STRCMP
105+
select LIBC_ARCH_STRCPY
106+
select LIBC_ARCH_STRLCPY
107+
select LIBC_ARCH_STRNCPY
108+
select LIBC_ARCH_STRLEN
109+
select LIBC_ARCH_STRNLEN
110+
---help---
111+
Espressif ESP32-C6 (RV32IMAC).
112+
90113
config ARCH_CHIP_C906
91114
bool "THEAD C906"
92115
select ARCH_RV64
@@ -199,6 +222,7 @@ config ARCH_CHIP
199222
default "litex" if ARCH_CHIP_LITEX
200223
default "bl602" if ARCH_CHIP_BL602
201224
default "esp32c3" if ARCH_CHIP_ESP32C3
225+
default "esp32c6" if ARCH_CHIP_ESP32C6
202226
default "c906" if ARCH_CHIP_C906
203227
default "mpfs" if ARCH_CHIP_MPFS
204228
default "rv32m1" if ARCH_CHIP_RV32M1
@@ -329,6 +353,9 @@ endif
329353
if ARCH_CHIP_ESP32C3
330354
source "arch/risc-v/src/esp32c3/Kconfig"
331355
endif
356+
if ARCH_CHIP_ESP32C6
357+
source "arch/risc-v/src/esp32c6/Kconfig"
358+
endif
332359
if ARCH_CHIP_C906
333360
source "arch/risc-v/src/c906/Kconfig"
334361
endif

arch/risc-v/include/esp32c6/chip.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/****************************************************************************
2+
* arch/risc-v/include/esp32c6/chip.h
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
#ifndef __ARCH_RISCV_INCLUDE_ESP32C6_CHIP_H
22+
#define __ARCH_RISCV_INCLUDE_ESP32C6_CHIP_H
23+
24+
#endif /* __ARCH_RISCV_INCLUDE_ESP32C6_CHIP_H */

0 commit comments

Comments
 (0)