Skip to content

add esp32P4 support to start with #17356

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions ports/esp32/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
* THE SOFTWARE.
*/

#if MICROPY_PY_MACHINE_ADC


#include "py/mphal.h"
#include "adc.h"
#include "driver/adc.h"
Expand Down Expand Up @@ -106,3 +109,5 @@ mp_int_t madcblock_read_uv_helper(machine_adc_block_obj_t *self, adc_channel_t c

return (mp_int_t)uv * 1000;
}

#endif // MICROPY_PY_MACHINE_ADC
24 changes: 24 additions & 0 deletions ports/esp32/boards/ESP32_GENERIC_P4/board.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"deploy": [
"../deploy.md"
],
"deploy_options": {
"flash_offset": "0x1000"
},
"docs": "",
"features": [
"BLE",
"External Flash",
"WiFi"
],
"images": [
""
],
"mcu": "esp32p4",
"product": "Expressif ESP32P4",
"thumbnail": "",
"url": "https://www.espressif.com/en/products/modules",
"variants": {
},
"vendor": "Espressif"
}
18 changes: 18 additions & 0 deletions ports/esp32/boards/ESP32_GENERIC_P4/board.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
The following files are firmware that should work on most ESP32-based boards
with 4MiB of flash, including WROOM WROVER, SOLO, PICO, and MINI modules.

This board has multiple variants available:

* If your board is based on a WROVER module, or otherwise has SPIRAM (also known
as PSRAM) then it's recommended to use the "spiram" variant. Look for heading
**Support for SPIRAM / WROVER)**.
* If your board has a ESP32-D2WD chip (with only 2MiB flash) then use the "d2wd"
variant. Look for heading **ESP32 D2WD**.
* If your board has a single-core ESP32 (e.g. the "SOLO" modules) then choose
the "unicore" variant. Look for heading **ESP32 Unicore**.
* If you'd like to perform Over-the-Air updates of the MicroPython firmware,
then choose the "ota" variant. This variant has less room in the flash for
Python files as a result of supporting OTA. Look for heading **Support for
OTA**.

Otherwise, download the generic variant (under the first heading below).
6 changes: 6 additions & 0 deletions ports/esp32/boards/ESP32_GENERIC_P4/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(IDF_TARGET esp32p4)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
boards/ESP32_GENERIC_P4/sdkconfig.board
)
46 changes: 46 additions & 0 deletions ports/esp32/boards/ESP32_GENERIC_P4/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Both of these can be set by mpconfigboard.cmake if a BOARD_VARIANT is
// specified.

#ifndef MICROPY_HW_BOARD_NAME
#define MICROPY_HW_BOARD_NAME "Generic ESP32P4 module"
#endif

#ifndef MICROPY_HW_MCU_NAME
#define MICROPY_HW_MCU_NAME "ESP32P4"
#endif


// not fixed in mpy 1.26.0
#define MICROPY_PY_MACHINE_DAC (0)

#define MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE (0)
#define MICROPY_HW_ENABLE_USBDEV (0)

#define MICROPY_PY_ESPNOW (0)

#define MICROPY_PY_MACHINE_ADC (0)
#define MICROPY_PY_MACHINE_ADC_ATTEN_WIDTH (0)
#define MICROPY_PY_MACHINE_ADC_INIT (0)
#define MICROPY_PY_MACHINE_ADC_READ (0)
#define MICROPY_PY_MACHINE_ADC_READ_UV (0)
#define MICROPY_PY_MACHINE_ADC_BLOCK (0)



#ifndef USB_SERIAL_JTAG_PACKET_SZ_BYTES
#define USB_SERIAL_JTAG_PACKET_SZ_BYTES (64)
#endif

// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
#define MICROPY_HW_ENABLE_UART_REPL (1)

#define MICROPY_PY_MACHINE_I2S (1)

/*
#define MICROPY_HW_I2C0_SCL (32)
#define MICROPY_HW_I2C0_SDA (31)

#define MICROPY_HW_SPI1_MOSI (44)
#define MICROPY_HW_SPI1_MISO (39)
#define MICROPY_HW_SPI1_SCK (43)
*/
60 changes: 60 additions & 0 deletions ports/esp32/boards/ESP32_GENERIC_P4/sdkconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

# Flash
CONFIG_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHMODE="qio"
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_AFTER_NORESET=y
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MiB.csv"

# Memory
CONFIG_SPIRAM=y
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_SPIRAM_MODE_HEX=y
CONFIG_SPIRAM_SPEED_200M=y
CONFIG_SPIRAM_MEMTEST=
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768


# ULP : not fixed
CONFIG_SOC_ULP_SUPPORTED=n
CONFIG_ULP_COPROC_ENABLED=n
CONFIG_ULP_COPROC_TYPE_FSM=n

# Touchpad : not fixed
CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=n
SOC_TOUCH_SENSOR_SUPPORTED=n
CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=n


# Wifi
#CONFIG_ESP_HOSTED_ENABLED=n
CONFIG_ESP_HOST_WIFI_ENABLED=y


# Ble
CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR=y
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_CONTROLLER_ENABLED=y

CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="MPY ESP32"
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4

# Put NimBLE on core 1, and for synchronisation
# with the ringbuffer and scheduler MP needs to be on the same core.
# MP on core 1 prevents interference with WiFi for time sensitive operations.
# Only on: ESP32, ESP32S2, ESP32S3
#CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=n
#CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y
#CONFIG_BT_NIMBLE_PINNED_TO_CORE=1

# Increase NimBLE task stack size from the default, because Python code
# (BLE IRQ handlers) will most likely run on this task.
CONFIG_BT_NIMBLE_TASK_STACK_SIZE=6144
24 changes: 24 additions & 0 deletions ports/esp32/boards/M5STACK_TAB5/board.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"deploy": [
"../deploy.md"
],
"deploy_options": {
"flash_offset": "0x1000"
},
"docs": "",
"features": [
"BLE",
"External Flash",
"WiFi"
],
"images": [
""
],
"mcu": "esp32p4",
"product": "M5STACK TAB5",
"thumbnail": "",
"url": "https://docs.m5stack.com/en/core/Tab5",
"variants": {
},
"vendor": "Espressif"
}
18 changes: 18 additions & 0 deletions ports/esp32/boards/M5STACK_TAB5/board.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This board need wifi_remote / esp_hosted with specific version to support wifi and ble on the ESP32C6 hosted.
modify esp32/main/idf_component.yml before compile :

## IDF Component Manager Manifest File
dependencies:
espressif/mdns: ~1.1.0
espressif/esp_tinyusb:
rules:
- if: target in [esp32s2, esp32s3]
version: ~1.0.0
## Required IDF version for M5STACK tab5
idf: '>=5.3'
espressif/esp_hosted: 1.4.0
espressif/esp_wifi_remote: 0.8.5
##chmorgan/esp-audio-player: 1.0.7
chmorgan/esp-file-iterator: 1.0.0
##espressif/led_strip: 3.0.0
espressif/esp_lcd_ili9881c: ^1.0.1
6 changes: 6 additions & 0 deletions ports/esp32/boards/M5STACK_TAB5/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(IDF_TARGET esp32p4)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
boards/M5STACK_TAB5/sdkconfig.board
)
46 changes: 46 additions & 0 deletions ports/esp32/boards/M5STACK_TAB5/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Both of these can be set by mpconfigboard.cmake if a BOARD_VARIANT is
// specified.

#ifndef MICROPY_HW_BOARD_NAME
#define MICROPY_HW_BOARD_NAME "Generic ESP32P4 module"
#endif

#ifndef MICROPY_HW_MCU_NAME
#define MICROPY_HW_MCU_NAME "ESP32P4"
#endif


// not fixed in mpy 1.26.0
#define MICROPY_PY_MACHINE_DAC (0)

#define MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE (0)
#define MICROPY_HW_ENABLE_USBDEV (0)

#define MICROPY_PY_ESPNOW (0)

#define MICROPY_PY_MACHINE_ADC (0)
#define MICROPY_PY_MACHINE_ADC_ATTEN_WIDTH (0)
#define MICROPY_PY_MACHINE_ADC_INIT (0)
#define MICROPY_PY_MACHINE_ADC_READ (0)
#define MICROPY_PY_MACHINE_ADC_READ_UV (0)
#define MICROPY_PY_MACHINE_ADC_BLOCK (0)



#ifndef USB_SERIAL_JTAG_PACKET_SZ_BYTES
#define USB_SERIAL_JTAG_PACKET_SZ_BYTES (64)
#endif

// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
#define MICROPY_HW_ENABLE_UART_REPL (1)

#define MICROPY_PY_MACHINE_I2S (1)

/*
#define MICROPY_HW_I2C0_SCL (32)
#define MICROPY_HW_I2C0_SDA (31)

#define MICROPY_HW_SPI1_MOSI (44)
#define MICROPY_HW_SPI1_MISO (39)
#define MICROPY_HW_SPI1_SCK (43)
*/
Loading
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy