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

esp32c6 support (IDF v5.2) #11869

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

andrewleech
Copy link
Sponsor Contributor

@andrewleech andrewleech commented Jun 26, 2023

The is esp32c6 officially supported in IDF v5.1 but requires a number of changes to work...
Pulling together changes and generic board support needed here.

@@ -196,5 +196,9 @@ foreach(comp ${IDF_COMPONENTS})
micropy_gather_target_properties(${comp})
endforeach()


list(APPEND MICROPY_CPP_INC_EXTRA ${IDF_PATH}/components/riscv/include)
list(APPEND MICROPY_CPP_INC_EXTRA ${IDF_PATH}/components/soc/soc/include)
Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm expecting these lines to not be required for real / merged support, but I've been having issues with the risk-v compiles and this is part of the WIP to get it going.

@andrewleech
Copy link
Sponsor Contributor Author

I've hacked past a bunch of compile flags to get further in the compile, but still not complete.

Bluetooth is not working - #include "esp_nimble_hci.h" is not available unless cmake set(CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE "y") is set, but once that's enabled a bunch of other compile errors jump up.

ADC does not support the legacy api currently being used in idf v5 support.

/mpy/ports/esp32/machine_adcblock.h:13:5: error: unknown type name 'esp_adc_cal_characteristics_t'
   13 |     esp_adc_cal_characteristics_t *characteristics[ADC_ATTEN_MAX];
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mpy/ports/esp32/machine_adcblock.c: In function 'madcblock_bits_helper':
/mpy/ports/esp32/machine_adcblock.c:90:13: error: implicit declaration of function 'esp_adc_cal_characterize' [-Werror=implicit-function-declaration]
   90 |             esp_adc_cal_characterize(self->unit_id, atten, self->width, DEFAULT_VREF, self->characteristics[atten]);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
/mpy/ports/esp32/machine_adcblock.c: In function 'madcblock_read_helper':
/mpy/ports/esp32/machine_adcblock.c:174:23: error: implicit declaration of function 'adc2_get_raw'; did you mean 'adc1_get_raw'? [-Werror=implicit-function-declaration]
  174 |         check_esp_err(adc2_get_raw(channel_id, self->width, &raw));
      |                       ^~~~~~~~~~~~
      |                       adc1_get_raw
/mpy/ports/esp32/machine_adcblock.c: In function 'madcblock_read_uv_helper':
/mpy/ports/esp32/machine_adcblock.c:181:5: error: unknown type name 'esp_adc_cal_characteristics_t'
  181 |     esp_adc_cal_characteristics_t *adc_chars = self->characteristics[atten];
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mpy/ports/esp32/machine_adcblock.c:183:35: error: 'esp_adc_cal_characteristics_t' undeclared (first use in this function)
  183 |         adc_chars = malloc(sizeof(esp_adc_cal_characteristics_t));
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mpy/ports/esp32/machine_adcblock.c:183:35: note: each undeclared identifier is reported only once for each function it appears in
/mpy/ports/esp32/machine_adcblock.c:187:19: error: implicit declaration of function 'esp_adc_cal_raw_to_voltage' [-Werror=implicit-function-declaration]
  187 |     mp_int_t uv = esp_adc_cal_raw_to_voltage(raw, adc_chars) * 1000;

@github-actions
Copy link

github-actions bot commented Jul 26, 2023

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS

@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.39%. Comparing base (b1ac266) to head (50b7df6).
Report is 26 commits behind head on master.

❗ Current head 50b7df6 differs from pull request most recent head f3e6628. Consider uploading reports for the commit f3e6628 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11869      +/-   ##
==========================================
- Coverage   98.39%   98.39%   -0.01%     
==========================================
  Files         161      161              
  Lines       21204    21200       -4     
==========================================
- Hits        20864    20860       -4     
  Misses        340      340              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mattytrentini mattytrentini changed the title WIP: esp32c6 support WIP: esp32c6 support (IDF v5.1) Aug 21, 2023
@mattytrentini
Copy link
Sponsor Contributor

Tried building with the recently-released ESP IDF v5.1.2 (currently aliased to release-v5.1) and the first error appears to be related to sleep modes:

> docker run -ti --rm -v $(pwd):/code -w /code espressif/idf:release-v5.1 bash -c "make -C mpy-cross && make -C ports/esp32 submodules all BOARD=GENERIC_C6"
[snip]
[346/1191] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/sleep_modes.c.objFAILED: esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/sleep_modes.c.obj
[snip]
/opt/esp/idf/components/esp_hw_support/sleep_modes.c: In function 'light_sleep_uart_prepare':
/opt/esp/idf/components/esp_hw_support/sleep_modes.c:153:61: error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared (first use in this function); did you mean 'CONFIG_ESP_CONSOLE_UART_NUM'?
  153 | #define UART_FLUSH_US_PER_CHAR              (10*1000*1000 / CONFIG_ESP_CONSOLE_UART_BAUDRATE)
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/esp/idf/components/esp_hw_support/sleep_modes.c:485:113: note: in expansion of macro 'UART_FLUSH_US_PER_CHAR'
  485 |             (sleep_duration < (int64_t)((UART_LL_FIFO_DEF_LEN - uart_ll_get_txfifo_len(CONSOLE_UART_DEV) + 1) * UART_FLUSH_US_PER_CHAR) + SLEEP_UART_FLUSH_DONE_TO_SLEEP_US)) {
      |                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~
/opt/esp/idf/components/esp_hw_support/sleep_modes.c:153:61: note: each undeclared identifier is reported only once for each function it appears in
  153 | #define UART_FLUSH_US_PER_CHAR              (10*1000*1000 / CONFIG_ESP_CONSOLE_UART_BAUDRATE)
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/esp/idf/components/esp_hw_support/sleep_modes.c:485:113: note: in expansion of macro 'UART_FLUSH_US_PER_CHAR'
  485 |             (sleep_duration < (int64_t)((UART_LL_FIFO_DEF_LEN - uart_ll_get_txfifo_len(CONSOLE_UART_DEV) + 1) * UART_FLUSH_US_PER_CHAR) + SLEEP_UART_FLUSH_DONE_TO_SLEEP_US)) {
      |                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~

@andrewleech
Copy link
Sponsor Contributor Author

I should rebase this on top of #12952 to include everything already fixed there.

@jschott780
Copy link

To resolve "error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared"
add this to the sdkconfig file:
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200

@mattytrentini
Copy link
Sponsor Contributor

To resolve "error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared" add this to the sdkconfig file: CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200

Thanks for the suggestion @jschott780 but I made the change and am having exactly the same error! Tried cleaning first too. Puzzling...

--- a/ports/esp32/boards/GENERIC_C6/sdkconfig.board
+++ b/ports/esp32/boards/GENERIC_C6/sdkconfig.board
@@ -2,5 +2,5 @@ CONFIG_ESP32C6_BROWNOUT_DET=y
 CONFIG_ESP32C6_BROWNOUT_DET_LVL_SEL_7=
 CONFIG_ESP32C6_BROWNOUT_DET_LVL_SEL_4=y
 CONFIG_ESP32C6_BROWNOUT_DET_LVL=4
 CONFIG_ESP_CONSOLE_UART_DEFAULT=
 CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
+CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200

@jschott780
Copy link

jschott780 commented Nov 25, 2023

To resolve "error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared" add this to the sdkconfig file: CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200

Thanks for the suggestion @jschott780 but I made the change and am having exactly the same error! Tried cleaning first too. Puzzling...

--- a/ports/esp32/boards/GENERIC_C6/sdkconfig.board
+++ b/ports/esp32/boards/GENERIC_C6/sdkconfig.board
@@ -2,5 +2,5 @@ CONFIG_ESP32C6_BROWNOUT_DET=y
 CONFIG_ESP32C6_BROWNOUT_DET_LVL_SEL_7=
 CONFIG_ESP32C6_BROWNOUT_DET_LVL_SEL_4=y
 CONFIG_ESP32C6_BROWNOUT_DET_LVL=4
 CONFIG_ESP_CONSOLE_UART_DEFAULT=
 CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
+CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200

Maybe its the order in which sdkconfig files are resolved in mpconfigboard.cmake?
Here is mine:
set(IDF_TARGET esp32c6)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
boards/sdkconfig.ble
boards/ESP32_GENERIC_C6/sdkconfig.c6usb
)

I dont know if it matters. I seem to remember running into this problem and renaming sdkconfig to sdkconfig.c6usb resolve it. Though totally possible I incidentally resolved it in some other way, and the file name was irrelevant.

@mattytrentini
Copy link
Sponsor Contributor

Seems similar here:

set(IDF_TARGET esp32c6)

set(SDKCONFIG_DEFAULTS
    boards/sdkconfig.base
    boards/GENERIC_C6/sdkconfig.board
)

Confusing!

@jschott780
Copy link

For anyone that is interested, i have a hacked up fork that appears to be working on C6. I havent done any robust testing yet. Use at your own risk. However, it may provide additional insight for the professional devs on here.
https://github.com/jschott780/micropython

@Drill-N-Bass
Copy link

Drill-N-Bass commented Dec 12, 2023

For anyone that is interested, i have a hacked up fork that appears to be working on C6. I havent done any robust testing yet. Use at your own risk. However, it may provide additional insight for the professional devs on here. https://github.com/jschott780/micropython

Can you guide me on how can I test your fork? I'm unable to find the proper firmware to esp32-c6 on https://micropython.org/download/?vendor=Espressif.

I haven't seen it in your repository either. Where to get it?

With my older boards, I was downloading FV from this page and then installing it with 'Thonny' IDE. Is there another way that I should attempt for this board?

I use:
#Thonny #Win10 x64 #VSC #python #micropython

@jschott780
Copy link

jschott780 commented Dec 13, 2023

For anyone that is interested, i have a hacked up fork that appears to be working on C6. I havent done any robust testing yet. Use at your own risk. However, it may provide additional insight for the professional devs on here. https://github.com/jschott780/micropython

Can you guide me on how can I test your fork? I'm unable to find the proper firmware to esp32-c6 on https://micropython.org/download/?vendor=Espressif.

I haven't seen it in your repository either. Where to get it?

With my older boards, I was downloading FV from this page and then installing it with 'Thonny' IDE. Is there another way that I should attempt for this board?

I use: #Thonny #Win10 x64 #VSC #python #micropython

That downloads list are the officially supported builds generated by cicd. To get this to work on C6 you have to build and compile the binaries yourself. You may want to first start with building the main branch by following these instructions. If you get that working, then take a whack at building my forked repo.
https://github.com/micropython/micropython/wiki/Getting-Started

@Drill-N-Bass
Copy link

Drill-N-Bass commented Dec 13, 2023

For anyone that is interested, i have a hacked up fork that appears to be working on C6. I havent done any robust testing yet. Use at your own risk. However, it may provide additional insight for the professional devs on here. https://github.com/jschott780/micropython

Can you guide me on how can I test your fork? I'm unable to find the proper firmware to esp32-c6 on https://micropython.org/download/?vendor=Espressif.
I haven't seen it in your repository either. Where to get it?
With my older boards, I was downloading FV from this page and then installing it with 'Thonny' IDE. Is there another way that I should attempt for this board?
I use: #Thonny #Win10 x64 #VSC #python #micropython

That downloads list are the officially supported builds generated by cicd. To get this to work on C6 you have to build and compile the binaries yourself. You may want to first start with building the main branch by following these instructions. If you get that working, then take a whack at building my forked repo. https://github.com/micropython/micropython/wiki/Getting-Started

Ok, that sounds doable. But, I need to clarify some things:

  1. I understand that you propose to first try to do a normal .bin file using the main/official micropython repo. The thing I don't understand is, what and how should be set for the sake of using this main repo in a way that it will work with a particular model of ESP32. The binary should be set up in a way that it will be compatible with a particular board. In other words, I know that for that practice I need to use another board because the official repo doesn't support ESP32-C6 and I have ESP32 WROOM 32D too, so it's not a problem, but what I don't know is what to do, to prepare files for compilation in a way that they will be compatible with, for example, ESP32 WROOM 32D. Where to find the most up-to-date documentation for this?
  2. Besides creating this binary, do I need to establish any Espressif IoT Development Framework firmware on ESP32, before I flash it with this binary we were speaking about before?
  3. Doing such actions as preparing my own binary, do I risk bricking the board in the process of flashing?
  4. Can you elaborate on the limitations of your version (fork) of micropython regarding ESP32-C6? Are you aware of what doesn't work, or - at least - what is working at this moment?

@jschott780
Copy link

Ok, that sounds doable. But, I need to clarify some things:

  1. I understand that you propose to first try to do a normal .bin file using the main/official micropython repo. The thing I don't understand is, what and how should be set for the sake of using this main repo in a way that it will work with a particular model of ESP32. The binary should be set up in a way that it will be compatible with a particular board. In other words, I know that for that practice I need to use another board because the official repo doesn't support ESP32-C6 and I have ESP32 WROOM 32D too, so it's not a problem, but what I don't know is what to do, to prepare files for compilation in a way that they will be compatible with, for example, ESP32 WROOM 32D. Where to find the most up-to-date documentation for this?
  2. Besides creating this binary, do I need to establish any Espressif IoT Development Framework firmware on ESP32, before I flash it with this binary we were speaking about before?
  3. Doing such actions as preparing my own binary, do I risk bricking the board in the process of flashing?
  4. Can you elaborate on the limitations of your version (fork) of micropython regarding ESP32-C6? Are you aware of what doesn't work, or - at least - what is working at this moment?

Take a look at this file. I set the build target and a couple CMake variables such that the build points to the correct sdkconfig files under ports/esp32/boards.
https://github.com/jschott780/micropython/blob/master/flash-build.sh

Yeah, you have to clone this repo, and follow the build instructions in the README.
https://github.com/espressif/esp-idf
Once you've built the esp-idf tools, you can do then execute "export.sh" which will place the build tool chain on your path (idf.py).

Yep, you can brick your board.

No idea of the limitations yet. I'm about to test my application in the next few weeks. Entirely possible nothing works.
For clarification, I'm not presenting this fork as a shrink wrapped bug free solution. I was able to get the build to a point where the micropython shell is accessible. Just providing this as a reference to help move the ball forward.

@IhorNehrutsa
Copy link
Contributor

Please rebase current branch to top of master

@andrewleech
Copy link
Sponsor Contributor Author

I've finally rebased this up to current master, including a bunch of fixes recently contributed by @IhorNehrutsa
It was a rather complicated rebase as lots has changed in esp32 in master recently, I haven't tested this branch yet to see how close it is to working.

@andrewleech
Copy link
Sponsor Contributor Author

andrewleech commented Jan 18, 2024

To build and flash:

cd micropython
docker run -it --rm -e BOARD=ESP32_GENERIC_C6 -e UID=$(id -u) -v $(pwd):/micropython -v /sys/bus:/sys/bus -v /dev:/dev --net=host -w /micropython espressif/idf:v5.1.2 bash -c '\
useradd -ms /bin/bash -g root -G sudo -u $UID esp;\
git config --global --add safe.directory /opt/esp/idf;\
su esp -m -c ". /opt/esp/entrypoint.sh; export HOME=/tmp; \
make -C mpy-cross && \
make -C ports/esp32 BOARD=$BOARD submodules && \
make -C ports/esp32 BOARD=$BOARD deploy PORT=/dev/ttyACM0; \
"'

This command looks nuts at first glance to be sure... it's starting a temporary docker container from the official esp idf image and running the build commands inside it. There's some mucking around with users (inside the container) so that the build can access the idf files correctly while not breaking the permissions on the micropython code shared into the container.

Using docker means though you don't need to install and configure anything esp / idf / compiler related on your PC, just docker. It also makes it easy to switch between different versions of IDF, just pick the appropriate image version!

@mattytrentini espressif/esp-idf#11924 - currently still broken in the v5.1 image, v5.1.2 was released ~ 1 week before that fix was merged.

There's also compile failures relating to ADC... probably closely related to what @IhorNehrutsa fixed previously which I've likely re-broken in the rebase to master where a lot of changes have been made to consolidate machine/adc functionality across ports.

@kdschlosser
Copy link

I am not sure why you are having such a hard hour getting it to compile properly using IDF5.1.2

Click me to see build log.
make clean -j 32 -C lib/micropython/ports/esp32 LV_CFLAGS="-DLV_KCONFIG_IGNORE=1" LV_PORT=esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT USER_C_MODULES=../../../../../micropython.cmake FROZEN_MANIFEST="********/new_binding/lvgl_micropython/build/manifest.py"
make: Entering directory '********/new_binding/lvgl_micropython/lib/micropython/ports/esp32'
idf.py -D MICROPY_BOARD=ESP32_GENERIC_S3 -D MICROPY_BOARD_DIR=********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/boards/ESP32_GENERIC_S3 -DUSER_C_MODULES=../../../../../micropython.cmake -D MICROPY_FROZEN_MANIFEST=********/new_binding/lvgl_micropython/build/manifest.py -D MICROPY_BOARD_VARIANT=SPIRAM_OCT -B build-ESP32_GENERIC_S3-SPIRAM_OCT -p /dev/ttyUSB0 -b 460800 fullclean
Executing action: fullclean
Executing action: remove_managed_components
Done
make: Leaving directory '********/new_binding/lvgl_micropython/lib/micropython/ports/esp32'
********/new_binding/lvgl_micropython/driver/display/display_driver_framework.py
********/new_binding/lvgl_micropython/driver/fs_driver.py
********/new_binding/lvgl_micropython/utils/lv_utils.py
make -j 32 -C lib/micropython/ports/esp32 LV_CFLAGS="-DLV_KCONFIG_IGNORE=1" LV_PORT=esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT USER_C_MODULES=../../../../../micropython.cmake FROZEN_MANIFEST="********/new_binding/lvgl_micropython/build/manifest.py"
make: Entering directory '********/new_binding/lvgl_micropython/lib/micropython/ports/esp32'
idf.py -D MICROPY_BOARD=ESP32_GENERIC_S3 -D MICROPY_BOARD_DIR=********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/boards/ESP32_GENERIC_S3 -DUSER_C_MODULES=../../../../../micropython.cmake -D MICROPY_FROZEN_MANIFEST=********/new_binding/lvgl_micropython/build/manifest.py -D MICROPY_BOARD_VARIANT=SPIRAM_OCT -B build-ESP32_GENERIC_S3-SPIRAM_OCT build || (echo -e "See \033[1;31mhttps://github.com/micropython/micropython/wiki/Build-Troubleshooting\033[0m"; false)
Executing action: all (aliases: build)
Running cmake in directory ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=********/.espressif/python_env/idf5.1_py3.10_env/bin/python -DESP_PLATFORM=1 -DMICROPY_BOARD=ESP32_GENERIC_S3 -DMICROPY_BOARD_DIR=********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/boards/ESP32_GENERIC_S3 -DUSER_C_MODULES=../../../../../micropython.cmake -DMICROPY_FROZEN_MANIFEST=********/new_binding/lvgl_micropython/build/manifest.py -DMICROPY_BOARD_VARIANT=SPIRAM_OCT -DCCACHE_ENABLE=0 ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32"...
-- Found Git: /usr/bin/git (found version "2.34.1")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: ********/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: ********/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: ********/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32s3
Manifest files have changed, solving dependencies.
.......Updating lock file at ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/dependencies.lock
Processing 4 dependencies:
[1/4] espressif/esp_tinyusb (1.0.3)
[2/4] espressif/mdns (1.1.0)
[3/4] espressif/tinyusb (0.15.0~4)
[4/4] idf (5.1.2)
-- Project sdkconfig file ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/sdkconfig
Loading defaults file ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/sdkconfig.combined...
********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/sdkconfig.combined:100 CONFIG_ESP32_WIFI_IRAM_OPT was replaced with CONFIG_ESP_WIFI_IRAM_OPT
********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/sdkconfig.combined:101 CONFIG_ESP32_WIFI_RX_IRAM_OPT was replaced with CONFIG_ESP_WIFI_RX_IRAM_OPT
/tmp/kconfgen_tmpt99ihbsm:162 line was updated to CONFIG_ESPTOOLPY_FLASHSIZE_4MB=n
/tmp/kconfgen_tmpt99ihbsm:164 line was updated to CONFIG_ESPTOOLPY_FLASHSIZE_16MB=n
/tmp/kconfgen_tmpt99ihbsm:168 line was updated to CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_40=n
/tmp/kconfgen_tmpt99ihbsm:169 line was updated to CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80=n
/tmp/kconfgen_tmpt99ihbsm:170 line was updated to CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160=n
/tmp/kconfgen_tmpt99ihbsm:174 line was updated to CONFIG_SPIRAM_MODE_QUAD=n
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Found Python3: ********/.espressif/python_env/idf5.1_py3.10_env/bin/python (found version "3.10.12") found components: Interpreter
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "micropython" version: v1.22.1-dirty
-- Adding linker script ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/esp-idf/esp_system/ld/memory.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_system/ld/esp32s3/sections.ld.in
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_rom/esp32s3/ld/esp32s3.rom.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_rom/esp32s3/ld/esp32s3.rom.api.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_rom/esp32s3/ld/esp32s3.rom.libgcc.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_rom/esp32s3/ld/esp32s3.rom.newlib.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_rom/esp32s3/ld/esp32s3.rom.version.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/soc/esp32s3/ld/esp32s3.peripherals.ld
-- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_coex esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_mm esp_netif esp_netif_stack esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump espressif__esp_tinyusb espressif__mdns espressif__tinyusb esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 json log lwip main_esp32s3 mbedtls mqtt newlib nvs_flash openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport touch_element ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: ********/esp-idf-v5.1.2/components/app_trace ********/esp-idf-v5.1.2/components/app_update ********/esp-idf-v5.1.2/components/bootloader ********/esp-idf-v5.1.2/components/bootloader_support ********/esp-idf-v5.1.2/components/bt ********/esp-idf-v5.1.2/components/cmock ********/esp-idf-v5.1.2/components/console ********/esp-idf-v5.1.2/components/cxx ********/esp-idf-v5.1.2/components/driver ********/esp-idf-v5.1.2/components/efuse ********/esp-idf-v5.1.2/components/esp-tls ********/esp-idf-v5.1.2/components/esp_adc ********/esp-idf-v5.1.2/components/esp_app_format ********/esp-idf-v5.1.2/components/esp_coex ********/esp-idf-v5.1.2/components/esp_common ********/esp-idf-v5.1.2/components/esp_eth ********/esp-idf-v5.1.2/components/esp_event ********/esp-idf-v5.1.2/components/esp_gdbstub ********/esp-idf-v5.1.2/components/esp_hid ********/esp-idf-v5.1.2/components/esp_http_client ********/esp-idf-v5.1.2/components/esp_http_server ********/esp-idf-v5.1.2/components/esp_https_ota ********/esp-idf-v5.1.2/components/esp_https_server ********/esp-idf-v5.1.2/components/esp_hw_support ********/esp-idf-v5.1.2/components/esp_lcd ********/esp-idf-v5.1.2/components/esp_local_ctrl ********/esp-idf-v5.1.2/components/esp_mm ********/esp-idf-v5.1.2/components/esp_netif ********/esp-idf-v5.1.2/components/esp_netif_stack ********/esp-idf-v5.1.2/components/esp_partition ********/esp-idf-v5.1.2/components/esp_phy ********/esp-idf-v5.1.2/components/esp_pm ********/esp-idf-v5.1.2/components/esp_psram ********/esp-idf-v5.1.2/components/esp_ringbuf ********/esp-idf-v5.1.2/components/esp_rom ********/esp-idf-v5.1.2/components/esp_system ********/esp-idf-v5.1.2/components/esp_timer ********/esp-idf-v5.1.2/components/esp_wifi ********/esp-idf-v5.1.2/components/espcoredump ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/managed_components/espressif__esp_tinyusb ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/managed_components/espressif__mdns ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/managed_components/espressif__tinyusb ********/esp-idf-v5.1.2/components/esptool_py ********/esp-idf-v5.1.2/components/fatfs ********/esp-idf-v5.1.2/components/freertos ********/esp-idf-v5.1.2/components/hal ********/esp-idf-v5.1.2/components/heap ********/esp-idf-v5.1.2/components/http_parser ********/esp-idf-v5.1.2/components/idf_test ********/esp-idf-v5.1.2/components/ieee802154 ********/esp-idf-v5.1.2/components/json ********/esp-idf-v5.1.2/components/log ********/esp-idf-v5.1.2/components/lwip ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/main_esp32s3 ********/esp-idf-v5.1.2/components/mbedtls ********/esp-idf-v5.1.2/components/mqtt ********/esp-idf-v5.1.2/components/newlib ********/esp-idf-v5.1.2/components/nvs_flash ********/esp-idf-v5.1.2/components/openthread ********/esp-idf-v5.1.2/components/partition_table ********/esp-idf-v5.1.2/components/perfmon ********/esp-idf-v5.1.2/components/protobuf-c ********/esp-idf-v5.1.2/components/protocomm ********/esp-idf-v5.1.2/components/pthread ********/esp-idf-v5.1.2/components/sdmmc ********/esp-idf-v5.1.2/components/soc ********/esp-idf-v5.1.2/components/spi_flash ********/esp-idf-v5.1.2/components/spiffs ********/esp-idf-v5.1.2/components/tcp_transport ********/esp-idf-v5.1.2/components/touch_element ********/esp-idf-v5.1.2/components/ulp ********/esp-idf-v5.1.2/components/unity ********/esp-idf-v5.1.2/components/usb ********/esp-idf-v5.1.2/components/vfs ********/esp-idf-v5.1.2/components/wear_levelling ********/esp-idf-v5.1.2/components/wifi_provisioning ********/esp-idf-v5.1.2/components/wpa_supplicant ********/esp-idf-v5.1.2/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT
Running ninja in directory ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT
Executing "ninja all"...
[1/1893] Generating project_elf_src_esp32s3.c
[2/1893] Generating memory.ld linker script...
[3/1893] Building C object esp-idf/main_esp32s3/CMakeFiles/micropy_extmod_btree.dir********/new_binding/lvgl_micropython/lib/micropython/lib/berkeley-db-1.xx/btree/bt_debug.c.obj
....
[28/1893] Building C object esp-idf/driver/CMakeFiles/__idf_driver.dir/gptimer/gptimer_priv.c.obj
[29/1893] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,2444K,
vfs,data,fat,0x273000,5684K,
*******************************************************************************
[30/1893] Building C object esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedcrypto.dir/base64.c.obj
....
[1055/1893] Linking C static library esp-idf/esp_app_format/libesp_app_format.a
[1056/1893] Generating ********/new_binding/lvgl_micropython/lib/micropython/mpy-cross/build/mpy-cross
make[1]: Entering directory '********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/esp-idf/main_esp32s3'
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
GEN build/genhdr/mpversion.h
CC ../py/modsys.c
CC main.c
LINK build/mpy-cross
   text    data     bss     dec     hex filename
 326534   13784     872  341190   534c6 build/mpy-cross
make[1]: Leaving directory '********/new_binding/lvgl_micropython/lib/micropython/mpy-cross'
[1057/1893] Linking CXX static library esp-idf/mbedtls/mbedtls/library/libmbedtls.a
....
[1061/1893] Linking CXX static library esp-idf/mbedtls/mbedtls/3rdparty/everest/libeverest.a
[1062/1893] Linking C static library esp-idf/esp_pm/libesp_pm.a
....
[1088/1893] Linking C static library esp-idf/wifi_provisioning/libwifi_provisioning.a
[1089/1893] Generating ../../genhdr/qstr.i.last
[1090/1893] Building C object esp-idf/espressif__mdns/CMakeFiles/__idf_espressif__mdns.dir/mdns.c.obj
[1091/1893] Linking C static library esp-idf/espressif__mdns/libespressif__mdns.a
[1092/1893] Linking C static library esp-idf/esp_local_ctrl/libesp_local_ctrl.a
[1093/1893] Generating ../../genhdr/qstr.split
[1094/1893] Generating ../../genhdr/qstrdefs.collected.h
QSTR updated
[1095/1893] Generating ../../genhdr/qstrdefs.preprocessed.h
[1096/1893] Generating ../../genhdr/qstrdefs.generated.h
[1097/1893] Generating ../../genhdr/root_pointers.split
[1098/1893] Generating ../../genhdr/root_pointers.collected
Root pointer registrations updated
[1099/1893] Generating ../../genhdr/root_pointers.h
[1100/1893] Performing configure step for 'bootloader'
-- Found Git: /usr/bin/git (found version "2.34.1")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: ********/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: ********/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: ********/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32s3
-- Project sdkconfig file ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/sdkconfig
Compiler supported targets: xtensa-esp32s3-elf

-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Adding linker script ********/esp-idf-v5.1.2/components/soc/esp32s3/ld/esp32s3.peripherals.ld
-- App "bootloader" version: v5.1.2
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_rom/esp32s3/ld/esp32s3.rom.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_rom/esp32s3/ld/esp32s3.rom.api.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_rom/esp32s3/ld/esp32s3.rom.libgcc.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/esp_rom/esp32s3/ld/esp32s3.rom.newlib.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld
-- Adding linker script ********/esp-idf-v5.1.2/components/bootloader/subproject/main/ld/esp32s3/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp_app_format esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: ********/esp-idf-v5.1.2/components/bootloader ********/esp-idf-v5.1.2/components/bootloader_support ********/esp-idf-v5.1.2/components/efuse ********/esp-idf-v5.1.2/components/esp_app_format ********/esp-idf-v5.1.2/components/esp_common ********/esp-idf-v5.1.2/components/esp_hw_support ********/esp-idf-v5.1.2/components/esp_rom ********/esp-idf-v5.1.2/components/esp_system ********/esp-idf-v5.1.2/components/esptool_py ********/esp-idf-v5.1.2/components/freertos ********/esp-idf-v5.1.2/components/hal ********/esp-idf-v5.1.2/components/log ********/esp-idf-v5.1.2/components/bootloader/subproject/main ********/esp-idf-v5.1.2/components/bootloader/subproject/components/micro-ecc ********/esp-idf-v5.1.2/components/newlib ********/esp-idf-v5.1.2/components/partition_table ********/esp-idf-v5.1.2/components/soc ********/esp-idf-v5.1.2/components/spi_flash ********/esp-idf-v5.1.2/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/bootloader
[1101/1893] cd ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/esp-idf/main_esp32s3 && ********/.espressif/python_env/idf5.1_py3.10_env/bin/python ********/new_binding/lvgl_micropython/lib/micropython/tools/makemanifest.py -o ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/frozen_content.c -v BOARD_DIR=********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/boards/ESP32_GENERIC_S3 -v MPY_DIR=********/new_binding/lvgl_micropython/lib/micropython -v MPY_LIB_DIR=********/new_binding/lvgl_micropython/lib/micropython/lib/micropython-lib -v PORT_DIR=********/new_binding/lvgl_micropython/lib/micropython/ports/esp32 -b ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT -f-march=xtensawin --mpy-tool-flags= ********/new_binding/lvgl_micropython/build/manifest.py
MPY apa106.py
MPY _boot.py
MPY flashbdev.py
MPY inisetup.py
MPY espnow.py
MPY asyncio/__init__.py
MPY asyncio/core.py
MPY asyncio/event.py
MPY asyncio/funcs.py
MPY asyncio/lock.py
MPY asyncio/stream.py
MPY uasyncio.py
MPY requests/__init__.py
MPY mip/__init__.py
MPY ntptime.py
MPY webrepl.py
MPY webrepl_setup.py
MPY urequests.py
MPY aioespnow.py
MPY dht.py
MPY onewire.py
MPY ds18x20.py
MPY neopixel.py
MPY umqtt/robust.py
MPY umqtt/simple.py
MPY upysh.py
MPY display_driver_framework.py
MPY fs_driver.py
MPY lv_utils.py
GEN ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/frozen_content.c
[1102/1893] Performing build step for 'bootloader'
[1/110] Generating project_elf_src_esp32s3.c
[2/110] Building C object esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/eri.c.obj
....
[60/110] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[61/110] Building ASM object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_longjmp.S.obj
[62/110] Building C object esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_err.c.obj
[63/110] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32s3/esp_efuse_rtc_calib.c.obj
[64/110] Building ASM object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_cache_writeback_esp32s3.S.obj
[65/110] Building C object esp-idf/esp_common/CMakeFiles/__idf_esp_common.dir/src/esp_err_to_name.c.obj
....
[108/110] Linking C executable bootloader.elf
[109/110] Generating binary image from built executable
esptool.py v4.7.0
Creating esp32s3 image...
Merged 1 ELF section
Successfully created esp32s3 image.
Generated ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/bootloader/bootloader.bin
[110/110] cd ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/bootloader/esp-idf/esptool_py && ********/.espressif/python_env/idf5.1_py3.10_env/bin/python ********/esp-idf-v5.1.2/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/bootloader/bootloader.bin
Bootloader binary size 0x4a20 bytes. 0x35e0 bytes (42%) free.
[1103/1893] No install step for 'bootloader'
[1104/1893] Completed 'bootloader'
[1105/1893] Generating ../../genhdr/moduledefs.split
[1106/1893] Generating ../../genhdr/moduledefs.collected
Module registrations updated
[1107/1893] Generating ../../genhdr/moduledefs.h
[1108/1893] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3.dir********/new_binding/lvgl_micropython/lib/micropython/py/asmthumb.c.obj
....
[1611/1893] Linking C static library esp-idf/main_esp32s3/libmain_esp32s3.a
[1612/1893] Generating ld/sections.ld
[1613/1893] Building C object CMakeFiles/micropython.elf.dir/project_elf_src_esp32s3.c.obj
....
[1891/1893] Linking CXX executable micropython.elf
[1892/1893] Generating binary image from built executable
esptool.py v4.7.0
Creating esp32s3 image...
Merged 3 ELF sections
Successfully created esp32s3 image.
Generated ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/micropython.bin
[1893/1893] cd ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/esp-idf/esptool_py && ********/.espressif/python_env/idf5.1_py3.10_env/bin/python ********/esp-idf-v5.1.2/components/partition_table/check_sizes.py --offset 0x8000 partition --type app ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/partition_table/partition-table.bin ********/new_binding/lvgl_micropython/lib/micropython/ports/esp32/build-ESP32_GENERIC_S3-SPIRAM_OCT/micropython.bin
micropython.bin binary size 0x23cb70 bytes. Smallest app partition is 0x263000 bytes. 0x26490 bytes (6%) free.

Project build complete. To flash, run this command:
********/.espressif/python_env/idf5.1_py3.10_env/bin/python ../../../../../../esp-idf-v5.1.2/components/esptool_py/esptool/esptool.py -p (PORT) -b 460800 --before default_reset --after no_reset --chip esp32s3  write_flash --flash_mode dio --flash_size 8MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3-SPIRAM_OCT/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3-SPIRAM_OCT/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3-SPIRAM_OCT/micropython.bin
or run 'idf.py -p (PORT) flash'
bootloader  @0x000000    18976  (   13792 remaining)
partitions  @0x008000     3072  (    1024 remaining)
application @0x010000  2345840  (  156816 remaining)
total                  2411376
make: Leaving directory '********/new_binding/lvgl_micropython/lib/micropython/ports/esp32'
Compiler supported targets: xtensa-esp32s3-elf

Including User C Module(s) from ../../../../../micropython.cmake
Found User C Module(s): usermod_lcd_bus, usermod_heap_caps, usermod_lvgl, lvgl_interface

note the [4/4] idf (5.1.2) in the build log.

I know I am not compiling for the C6 is the ESP-IDF API different for the C6 vs the S3?

@mattytrentini
Copy link
Sponsor Contributor

I know I am not compiling for the C6 is the ESP-IDF API different for the C6 vs the S3?

Yes. Some APIs are deprecated but still supported (as legacy) on the S3 and other micros. Those legacy APIs don't exist for the C6. So some components need to be rewritten.

@kdschlosser
Copy link

ahhh OK. That makes sense then.

@mancausoft
Copy link

mancausoft commented Mar 12, 2024

I was able to compile micropython using the code from: #11869 (andrewleech:esp32c6)
I rebase it to: #13775 (DvdGiessen:esp32_idf52)

and fix ADC calibration and a problem with UART name.

The code is here: https://github.com/mancausoft/micropython/tree/esp32c6

I also have the image to test here: https://github.com/mancausoft/micropython/releases/tag/0.0.0

EDIT: I forgot to say that I'm using idf 5.2.0 to compile it

@Drill-N-Bass
Copy link

Drill-N-Bass commented Apr 30, 2024

Do you have a list of what is working currently and what's not for this board?

Is there currently a stable version anyehere - if so, where do I find it?

@mattytrentini
Copy link
Sponsor Contributor

I've just added a board definition for the M5Stack NanoC6 (limits the pins to and defines I2C(0) to use the 'grove' port).

>>> from machine import Pin, I2C
>>> help(Pin.board)
object <class 'board'> is of type type
  G1 -- Pin(1)
  G2 -- Pin(2)
  IR_LED -- Pin(3)
  LED_BLUE -- Pin(7)
  BUTTON -- Pin(9)
  NEOPIXEL_POWER -- Pin(19)
  NEOPIXEL -- Pin(20)
>>> I2C(0)
I2C(0, scl=1, sda=2, freq=400000)
>>>

Do you have a list of what is working currently and what's not for this board?

I've tested Pin, I2C, NeoPixel, and - lightly - network.WLAN. bluetooth appears to work but there may be some failing tests, it hasn't been thoroughly tested. Are there particular features you're interested in that I could possibly test?

Is there currently a stable version anywhere - if so, where do I find it?

It hasn't been merged yet, so builds aren't part of the regular CI system. For now, you ought to build it yourself, though I've attached the my latest build of the ESP32_GENERIC_C6 that you can use. To deploy:

> esptool.py --chip esp32c6 erase_flash # Only necessary when the partition layout changes, ie the first time you deploy
> esptool.py --chip esp32c6 --baud 460800 write_flash -z 0x0 esp32_generic_c6_firmware.bin

(You may need to use --port if you have multiple devices connected.)

@andrewleech
Copy link
Sponsor Contributor Author

Do you have a list of what is working currently and what's not for this board?

Is there currently a stable version anyehere - if so, where do I find it?

I don't know of anything not working at the moment, but I've tested even less that @mattytrentini to be honest!

pi-anl and others added 8 commits May 1, 2024 15:01
Signed-off-by: Andrew Leech <andrew@alelec.net>
Signed-off-by: IhorNehrutsa <IhorNehrutsa@gmail.com>
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
This new calibration routine exists for S3 in v5.1.1.
It works for all platforms in 5.2.1.

Signed-off-by: Andrew Leech <andrew@alelec.net>
Signed-off-by: Andrew Leech <andrew@alelec.net>
Signed-off-by: Andrew Leech <andrew@alelec.net>
In idf v5.2.1 if the port flag is set it's validated
even on jobs that don't access hardware like clean.
This causes the job to fail if device isn't connected.

Signed-off-by: Andrew Leech <andrew@alelec.net>
@ajurna
Copy link

ajurna commented May 1, 2024

I don't know of anything not working at the moment, but I've tested even less that @mattytrentini to be honest!

does that mean that zigbee is working?

@andrewleech
Copy link
Sponsor Contributor Author

I don't know of anything not working at the moment, but I've tested even less that @mattytrentini to be honest!

does that mean that zigbee is working?

Oh, I meant all standard micropython features. I don't know of anyone who's written a ZigBee stack / bindings for micropython yet. Same goes for matter and thread.

Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
@p2k
Copy link

p2k commented May 2, 2024

I've found an issue with the ADC implementation:

>>> adc = machine.ADC(machine.Pin(0), atten=machine.ADC.ATTN_11DB)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid bits

Here's a quick patch:

diff --git a/ports/esp32/adc.c b/ports/esp32/adc.c
index 7c9e0cfad..40ff7b53f 100644
--- a/ports/esp32/adc.c
+++ b/ports/esp32/adc.c
@@ -50,7 +50,7 @@ void madcblock_bits_helper(machine_adc_block_obj_t *self, mp_int_t bits) {
             self->width = ADC_WIDTH_BIT_12;
             break;
         #endif
-        #if CONFIG_IDF_TARGET_ESP32S2
+        #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C6
         case 13:
             self->width = ADC_WIDTH_BIT_13;
             break;

@mattytrentini
Copy link
Sponsor Contributor

mattytrentini commented May 3, 2024

I've found an issue with the ADC implementation:
[snip]

Hmm, it may need a little more work - that C6 ADC peripheral looks different again to the rest of the ESP32 family. Specifically, it has only one 12-bit SAR which can be assigned to seven pins. I think the single ADC channel is unique to the C6?

But thanks for the bug report and patch - that helps, a lot!

@p2k
Copy link

p2k commented May 3, 2024

For reference, this seems to be the relevant documentation. Indeed, it shows a 12-bit SAR with 7 channels/pins GPIO0 through GPIO6. The fact that 13 bit are enabled in my patch relate to the "Deprecated ADC APIs" being used here, which for some reason don't allow the other bit settings. The API documentation is unclear about all of this, even hinting at 9 through 13 bits being allowed and that there's 2 ADC units and up to 10 channels.

Not sure what to make of all of this, but I guess we'd have to fix machine_adc.c and machine_adc_block.c to reflect this, as you already pointed out.

@dpgeorge dpgeorge added this to the release-1.24.0 milestone May 14, 2024
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
@DaanOlbrechts
Copy link

I'm interested in this development since I have also obtained an ESP32-C6 dev board, but none of the builds work.
Over the last few days I've tried with the build linked here as well as building the thing myself, for all possible ESP-C6 board types currently in this branch.

While all of them flash fine, the only output I get over the serial interface is this:

ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0xed4
load:0x4086c410,len:0xaf0
load:0x4086e610,len:0x2b3c
entry 0x4086c410

Flashing other firmwares (e.g. the blink examples) works fine.

Does anyone have any idea what I am doing wrong here and/or how to troubleshoot this further?

@mattytrentini
Copy link
Sponsor Contributor

I'm interested in this development since I have also obtained an ESP32-C6 dev board

Can you please link to the board that you're using?

@DaanOlbrechts
Copy link

I'm interested in this development since I have also obtained an ESP32-C6 dev board

Can you please link to the board that you're using?

Certainly, it is the ESP32-C6-WROOM-1-N8 variant listed here.

@p2k
Copy link

p2k commented May 17, 2024

I'm interested in this development since I have also obtained an ESP32-C6 dev board, but none of the builds work. Over the last few days I've tried with the build linked here as well as building the thing myself, for all possible ESP-C6 board types currently in this branch.

While all of them flash fine, the only output I get over the serial interface is this:

ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0xed4
load:0x4086c410,len:0xaf0
load:0x4086e610,len:0x2b3c
entry 0x4086c410

Flashing other firmwares (e.g. the blink examples) works fine.

Does anyone have any idea what I am doing wrong here and/or how to troubleshoot this further?

Yes, certainly! Your problem looks like the one I had some days ago, to which I've found the solution. In short: Just use the other USB port on the Dev Kit, the C6 firmware by default does not use the serial aka UART port for its console.

EDIT: I've checked the link you sent and your board definitely has two USB ports, albeit they are labelled differently.

@andrewleech
Copy link
Sponsor Contributor Author

Ah that's interesting, I've got two C6 modules but both are small and only have the USB that's natively handled by the chip itself, they don't have a UART connected. I for one am very happy esp chips are moving towards built in USB rather than needing separate conversion chips.

I didn't realise other Dev boards for this chip might still default to a UART converter!

@p2k
Copy link

p2k commented May 17, 2024

When I first got the C6 Dev Kit and found that it has two USB ports, I honestly was a bit confused. But at the end of the day, this frees us to use the UART port for other applications; there's quite a few peripherals which work with a serial connection. The fact that the Dev Kit still has a conversion chip and thus a second USB port is probably meant for easier debugging purposes and, well, why not.

Meaning to say that I'm fine with the default setting of using the main/integrated USB for the Micropython console, but I still suggest that this should be documented somewhere.

@DaanOlbrechts
Copy link

Yes, certainly! Your problem looks like the one I had some days ago, to which I've found the solution. In short: Just use the other USB port on the Dev Kit, the C6 firmware by default does not use the serial aka UART port for its console.

Thanks for the assistance, this is exactly what is going on! The REPL is available on the second USB port.

@andrewleech
Copy link
Sponsor Contributor Author

For reference, this seems to be the relevant documentation.

The correct doc links are helpful too, certainly the best path would be to follow those docs and use the newer drivers, moving away from the 4.x deprecated drivers is a slow but desirable goal certainly!

@andrewleech
Copy link
Sponsor Contributor Author

Certainly, it is the ESP32-C6-WROOM-1-N8 variant listed here.

It would probably be worth making a board definition fit this that enables the UART repl as well to avoid the confusion!

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

Successfully merging this pull request may close these issues.

None yet