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

Initial support for ESP32-C6 #8337

Merged
merged 2 commits into from
Jun 30, 2023
Merged
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
2 changes: 2 additions & 0 deletions .github/scripts/on-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then
FQBN_ESP32S2="espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app"
FQBN_ESP32S3="espressif:esp32:esp32s3:PSRAM=opi,USBMode=default,PartitionScheme=huge_app"
FQBN_ESP32C3="espressif:esp32:esp32c3:PartitionScheme=huge_app"
FQBN_ESP32C6="espressif:esp32:esp32c6:PartitionScheme=huge_app"

SKETCHES_ESP32="\
$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino\
Expand All @@ -85,6 +86,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then
build "esp32s3" $FQBN_ESP32S3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
build "esp32s2" $FQBN_ESP32S2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX
build "esp32c3" $FQBN_ESP32C3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX
build "esp32c6" $FQBN_ESP32C6 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX
build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
else
source ${SCRIPTS_DIR}/install-platformio-esp32.sh
Expand Down
4 changes: 4 additions & 0 deletions .github/scripts/sketch_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
esp32s2_opts="PSRAM=enabled,PartitionScheme=huge_app"
esp32s3_opts="PSRAM=opi,USBMode=default,PartitionScheme=huge_app"
esp32c3_opts="PartitionScheme=huge_app"
esp32c6_opts="PartitionScheme=huge_app"

# Select the common part of the FQBN based on the target. The rest will be
# appended depending on the passed options.
Expand All @@ -91,6 +92,9 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
"esp32s3")
fqbn="espressif:esp32:esp32s3:${options:-$esp32s3_opts}"
;;
"esp32c6")
fqbn="espressif:esp32:esp32c6:${options:-$esp32c6_opts}"
;;
esac

# Make it look like a JSON array.
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/hil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3']
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6']
chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}}
steps:
- name: Checkout Repository
Expand All @@ -71,11 +71,12 @@ jobs:
- ESP32-S2
- ESP32-S3
- ESP32-C3
- ESP32-C6

strategy:
fail-fast: false
matrix:
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3']
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6']
chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}}
container:
image: python:3.10.1-bullseye
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- esp32s2
- esp32c3
- esp32s3
- esp32c6

include:
- target: esp32
Expand All @@ -46,6 +47,8 @@ jobs:
fqbn: espressif:esp32:esp32c3
- target: esp32s3
fqbn: espressif:esp32:esp32s3
- target: esp32c6
fqbn: espressif:esp32:esp32c6


steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
name: Arduino ${{ matrix.chunk }} on ubuntu-latest
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
chunk: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]

Expand All @@ -52,6 +53,7 @@ jobs:
name: Arduino on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest]

Expand All @@ -68,6 +70,7 @@ jobs:
name: PlatformIO on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

Expand Down
162 changes: 162 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,168 @@ menu.LORAWAN_PREAMBLE_LENGTH=LoRaWan Preamble Length
### DO NOT PUT BOARDS ABOVE THE OFFICIAL ESPRESSIF BOARDS! ###
##############################################################

esp32c6.name=ESP32C6 Dev Module
esp32c6.vid.0=0x303a
esp32c6.pid.0=0x1001

esp32c6.bootloader.tool=esptool_py
esp32c6.bootloader.tool.default=esptool_py

esp32c6.upload.tool=esptool_py
esp32c6.upload.tool.default=esptool_py
esp32c6.upload.tool.network=esp_ota

esp32c6.upload.maximum_size=1310720
esp32c6.upload.maximum_data_size=327680
esp32c6.upload.flags=
esp32c6.upload.extra_flags=
esp32c6.upload.use_1200bps_touch=false
esp32c6.upload.wait_for_upload_port=false

esp32c6.serial.disableDTR=false
esp32c6.serial.disableRTS=false

esp32c6.build.tarch=riscv32
esp32c6.build.target=esp
esp32c6.build.mcu=esp32c6
esp32c6.build.core=esp32
esp32c6.build.variant=esp32c6
esp32c6.build.board=ESP32C6_DEV
esp32c6.build.bootloader_addr=0x0

esp32c6.build.cdc_on_boot=0
esp32c6.build.f_cpu=160000000L
esp32c6.build.flash_size=4MB
esp32c6.build.flash_freq=80m
esp32c6.build.flash_mode=qio
esp32c6.build.boot=qio
esp32c6.build.partitions=default
esp32c6.build.defines=

## IDE 2.0 Seems to not update the value
esp32c6.menu.JTAGAdapter.default=Disabled
esp32c6.menu.JTAGAdapter.default.build.copy_jtag_files=0
esp32c6.menu.JTAGAdapter.builtin=Integrated USB JTAG
esp32c6.menu.JTAGAdapter.builtin.build.openocdscript=esp32c6-builtin.cfg
esp32c6.menu.JTAGAdapter.builtin.build.copy_jtag_files=1
esp32c6.menu.JTAGAdapter.external=FTDI Adapter
esp32c6.menu.JTAGAdapter.external.build.openocdscript=esp32c6-ftdi.cfg
esp32c6.menu.JTAGAdapter.external.build.copy_jtag_files=1
esp32c6.menu.JTAGAdapter.bridge=ESP USB Bridge
esp32c6.menu.JTAGAdapter.bridge.build.openocdscript=esp32c6-bridge.cfg
esp32c6.menu.JTAGAdapter.bridge.build.copy_jtag_files=1

esp32c6.menu.CDCOnBoot.default=Disabled
esp32c6.menu.CDCOnBoot.default.build.cdc_on_boot=0
esp32c6.menu.CDCOnBoot.cdc=Enabled
esp32c6.menu.CDCOnBoot.cdc.build.cdc_on_boot=1

esp32c6.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
esp32c6.menu.PartitionScheme.default.build.partitions=default
esp32c6.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
esp32c6.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
esp32c6.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS)
esp32c6.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
esp32c6.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
esp32c6.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
esp32c6.menu.PartitionScheme.minimal.build.partitions=minimal
esp32c6.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
esp32c6.menu.PartitionScheme.no_ota.build.partitions=no_ota
esp32c6.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
esp32c6.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
esp32c6.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
esp32c6.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
esp32c6.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
esp32c6.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
esp32c6.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
esp32c6.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
esp32c6.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
esp32c6.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
esp32c6.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
esp32c6.menu.PartitionScheme.huge_app.build.partitions=huge_app
esp32c6.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
esp32c6.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
esp32c6.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
esp32c6.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
esp32c6.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS)
esp32c6.menu.PartitionScheme.fatflash.build.partitions=ffat
esp32c6.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
esp32c6.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
esp32c6.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
esp32c6.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
esp32c6.menu.PartitionScheme.rainmaker=RainMaker
esp32c6.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
esp32c6.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728

esp32c6.menu.CPUFreq.160=160MHz (WiFi)
esp32c6.menu.CPUFreq.160.build.f_cpu=160000000L
esp32c6.menu.CPUFreq.80=80MHz (WiFi)
esp32c6.menu.CPUFreq.80.build.f_cpu=80000000L
esp32c6.menu.CPUFreq.40=40MHz
esp32c6.menu.CPUFreq.40.build.f_cpu=40000000L
esp32c6.menu.CPUFreq.20=20MHz
esp32c6.menu.CPUFreq.20.build.f_cpu=20000000L
esp32c6.menu.CPUFreq.10=10MHz
esp32c6.menu.CPUFreq.10.build.f_cpu=10000000L

esp32c6.menu.FlashMode.qio=QIO
esp32c6.menu.FlashMode.qio.build.flash_mode=dio
esp32c6.menu.FlashMode.qio.build.boot=qio
esp32c6.menu.FlashMode.dio=DIO
esp32c6.menu.FlashMode.dio.build.flash_mode=dio
esp32c6.menu.FlashMode.dio.build.boot=dio

esp32c6.menu.FlashFreq.80=80MHz
esp32c6.menu.FlashFreq.80.build.flash_freq=80m
esp32c6.menu.FlashFreq.40=40MHz
esp32c6.menu.FlashFreq.40.build.flash_freq=40m

esp32c6.menu.FlashSize.4M=4MB (32Mb)
esp32c6.menu.FlashSize.4M.build.flash_size=4MB
esp32c6.menu.FlashSize.8M=8MB (64Mb)
esp32c6.menu.FlashSize.8M.build.flash_size=8MB
esp32c6.menu.FlashSize.8M.build.partitions=default_8MB
esp32c6.menu.FlashSize.2M=2MB (16Mb)
esp32c6.menu.FlashSize.2M.build.flash_size=2MB
esp32c6.menu.FlashSize.2M.build.partitions=minimal
esp32c6.menu.FlashSize.16M=16MB (128Mb)
esp32c6.menu.FlashSize.16M.build.flash_size=16MB

esp32c6.menu.UploadSpeed.921600=921600
esp32c6.menu.UploadSpeed.921600.upload.speed=921600
esp32c6.menu.UploadSpeed.115200=115200
esp32c6.menu.UploadSpeed.115200.upload.speed=115200
esp32c6.menu.UploadSpeed.256000.windows=256000
esp32c6.menu.UploadSpeed.256000.upload.speed=256000
esp32c6.menu.UploadSpeed.230400.windows.upload.speed=256000
esp32c6.menu.UploadSpeed.230400=230400
esp32c6.menu.UploadSpeed.230400.upload.speed=230400
esp32c6.menu.UploadSpeed.460800.linux=460800
esp32c6.menu.UploadSpeed.460800.macosx=460800
esp32c6.menu.UploadSpeed.460800.upload.speed=460800
esp32c6.menu.UploadSpeed.512000.windows=512000
esp32c6.menu.UploadSpeed.512000.upload.speed=512000

esp32c6.menu.DebugLevel.none=None
esp32c6.menu.DebugLevel.none.build.code_debug=0
esp32c6.menu.DebugLevel.error=Error
esp32c6.menu.DebugLevel.error.build.code_debug=1
esp32c6.menu.DebugLevel.warn=Warn
esp32c6.menu.DebugLevel.warn.build.code_debug=2
esp32c6.menu.DebugLevel.info=Info
esp32c6.menu.DebugLevel.info.build.code_debug=3
esp32c6.menu.DebugLevel.debug=Debug
esp32c6.menu.DebugLevel.debug.build.code_debug=4
esp32c6.menu.DebugLevel.verbose=Verbose
esp32c6.menu.DebugLevel.verbose.build.code_debug=5

esp32c6.menu.EraseFlash.none=Disabled
esp32c6.menu.EraseFlash.none.upload.erase_cmd=
esp32c6.menu.EraseFlash.all=Enabled
esp32c6.menu.EraseFlash.all.upload.erase_cmd=-e

##############################################################

esp32s3.name=ESP32S3 Dev Module
esp32s3.vid.0=0x303a
esp32s3.pid.0=0x1001
Expand Down
3 changes: 3 additions & 0 deletions cores/esp32/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ extern "C" {
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c3 is located at 0x0000
#elif CONFIG_IDF_TARGET_ESP32C6
#include "esp32c6/rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c6 is located at 0x0000
#else
#error Target CONFIG_IDF_TARGET is not supported
#endif
Expand Down
4 changes: 2 additions & 2 deletions cores/esp32/HWCDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "USB.h"
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
#if SOC_USB_SERIAL_JTAG_SUPPORTED

#include "esp32-hal.h"
#include "esp32-hal-periman.h"
Expand Down Expand Up @@ -435,4 +435,4 @@ HWCDC USBSerial;
#endif
#endif

#endif /* CONFIG_TINYUSB_CDC_ENABLED */
#endif /* SOC_USB_SERIAL_JTAG_SUPPORTED */
4 changes: 3 additions & 1 deletion cores/esp32/HWCDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#pragma once

#include "sdkconfig.h"
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
#include "soc/soc_caps.h"

#if SOC_USB_SERIAL_JTAG_SUPPORTED

#include <inttypes.h>
#include "esp_event.h"
Expand Down
8 changes: 8 additions & 0 deletions cores/esp32/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define SOC_RX0 44
#elif CONFIG_IDF_TARGET_ESP32C3
#define SOC_RX0 20
#elif CONFIG_IDF_TARGET_ESP32C6
#define SOC_RX0 17
#endif
#endif

Expand All @@ -38,6 +40,8 @@
#define SOC_TX0 43
#elif CONFIG_IDF_TARGET_ESP32C3
#define SOC_TX0 21
#elif CONFIG_IDF_TARGET_ESP32C6
#define SOC_TX0 16
#endif
#endif

Expand All @@ -55,6 +59,8 @@ void serialEvent(void) {}
#define RX1 18
#elif CONFIG_IDF_TARGET_ESP32S3
#define RX1 15
#elif CONFIG_IDF_TARGET_ESP32C6
#define RX1 5
#endif
#endif

Expand All @@ -67,6 +73,8 @@ void serialEvent(void) {}
#define TX1 19
#elif CONFIG_IDF_TARGET_ESP32S3
#define TX1 16
#elif CONFIG_IDF_TARGET_ESP32C6
#define TX1 4
#endif
#endif

Expand Down
6 changes: 3 additions & 3 deletions cores/esp32/USB.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// limitations under the License.
#pragma once

#include "sdkconfig.h"
#include "soc/soc_caps.h"

#if CONFIG_TINYUSB_ENABLED
#if SOC_USB_OTG_SUPPORTED

#include "esp_event.h"
#include "USBCDC.h"
Expand Down Expand Up @@ -116,4 +116,4 @@ class ESPUSB {

extern ESPUSB USB;

#endif /* CONFIG_TINYUSB_ENABLED */
#endif /* SOC_USB_OTG_SUPPORTED */
4 changes: 2 additions & 2 deletions cores/esp32/esp32-hal-adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ esp_err_t __analogChannelConfig(adc_bitwidth_t width, adc_attenuation_t atten, i
log_e("adc_cali_create_scheme_curve_fitting failed with error: %d", err);
return err;
}
#else //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
#elif !defined(CONFIG_IDF_TARGET_ESP32C6) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
log_d("Deleting ADC_UNIT_%d line cali handle",adc_unit);
err = adc_cali_delete_scheme_line_fitting(adc_cali_handle[adc_unit]);
if(err != ESP_OK){
Expand Down Expand Up @@ -278,7 +278,7 @@ uint32_t __analogReadMilliVolts(uint8_t pin){
.bitwidth = __analogWidth,
};
err = adc_cali_create_scheme_curve_fitting(&cali_config, &adc_cali_handle[adc_unit]);
#else //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
#elif !defined(CONFIG_IDF_TARGET_ESP32C6) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
adc_cali_line_fitting_config_t cali_config = {
.unit_id = adc_unit,
.bitwidth = __analogWidth,
Expand Down
Loading