Skip to content

Commit a4c33e3

Browse files
lucasssvazJason2866github-actions[bot]me-no-devpre-commit-ci-lite[bot]
authored
feat(esp32p4): Add initial ESP32-P4 support (#10358)
* feat(esp32p4): Initial changes required for ESP32-P4 * esp32-p4: Initial changes to build with Arduino Signed-off-by: Lucas Saavedra Vaz <[email protected]> * fix(esp32p4): Fix lib builder errors * change(esp32p4): Unhide board * ci(esp32p4): Add ESP32-P4 to workflow * change(esptool): Update esptool to 4.8.0 * fix(build): Fix redefinition errors * fix(build): Remove old commands * change(esptool): Remove unsupported 32-bit tools * fix(get.py): Force exe generation * Revert "fix(get.py): Force exe generation" This reverts commit 979b16b. * fix(get.py): Fix system check * change(tools): Push generated binaries to PR * ci(esp32p4): Add missing ESP32-P4 entries * fix(esp32p4): Add chip info * fix(esp32p4): Fix build commands * docs(esp32p4): Add missing references to P4 * fix(esp32p4): Fix clock sources definitions * fix(esp32p4): Set CPU frequency to 360 MHz so it is stable in all chips * refactor(esp32p4): Change preprocessor conditionals for maintainability Co-authored-by: me-no-dev <[email protected]> * fix(esp32p4): Add missing menu options * fix(esp32p4): Mark as not in development json in readme * fix(esp32p4): Add P4 to ci.json files * ci(pre-commit): Apply automatic fixes * fix(get.py): Remove unused include * ci(pre-commit): Apply automatic fixes * change(tools): Push generated binaries to PR * ci(pre-commit): Apply automatic fixes * fix(ci.json): Fix formatting --------- Signed-off-by: Lucas Saavedra Vaz <[email protected]> Co-authored-by: Jason2866 <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: me-no-dev <[email protected]> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 6768208 commit a4c33e3

File tree

169 files changed

+1079
-706
lines changed

Some content is hidden

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

169 files changed

+1079
-706
lines changed

.github/scripts/on-push.sh

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then
9191
fi
9292

9393
#build sketches for different targets
94+
build "esp32p4" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$SKETCHES_FILE" "$SKETCHES_ESP32"
9495
build "esp32s3" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$SKETCHES_FILE" "$SKETCHES_ESP32"
9596
build "esp32s2" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$SKETCHES_FILE" "$SKETCHES_ESP32"
9697
build "esp32c3" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$SKETCHES_FILE" "$SKETCHES_ESP32"

.github/scripts/sketch_utils.sh

+4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
8989
esp32c3_opts="PartitionScheme=huge_app,FlashMode=dio"
9090
esp32c6_opts="PartitionScheme=huge_app,FlashMode=dio"
9191
esp32h2_opts="PartitionScheme=huge_app,FlashMode=dio"
92+
esp32p4_opts="PartitionScheme=huge_app,FlashMode=dio"
9293

9394
# Select the common part of the FQBN based on the target. The rest will be
9495
# appended depending on the passed options.
@@ -112,6 +113,9 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
112113
"esp32h2")
113114
fqbn="espressif:esp32:esp32h2:${options:-$esp32h2_opts}"
114115
;;
116+
"esp32p4")
117+
fqbn="espressif:esp32:esp32p4:${options:-$esp32p4_opts}"
118+
;;
115119
esac
116120

117121
# Make it look like a JSON array.

.github/workflows/lib.yml

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
- esp32s3
4343
- esp32c6
4444
- esp32h2
45+
- esp32p4
4546

4647
include:
4748
- target: esp32
@@ -56,6 +57,8 @@ jobs:
5657
fqbn: espressif:esp32:esp32c6
5758
- target: esp32h2
5859
fqbn: espressif:esp32:esp32h2
60+
- target: esp32p4
61+
fqbn: espressif:esp32:esp32p4
5962

6063

6164
steps:

.github/workflows/push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ jobs:
233233
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
234234
# for details.
235235
idf_ver: ["release-v5.3"]
236-
idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6", "esp32h2"]
236+
idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"]
237237
container: espressif/idf:${{ matrix.idf_ver }}
238238
steps:
239239
- name: Check out arduino-esp32 as a component

.github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
strategy:
8989
matrix:
9090
type: ${{ fromJson(needs.gen-matrix.outputs.build-types) }}
91-
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
91+
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32p4']
9292
with:
9393
type: ${{ matrix.type }}
9494
chip: ${{ matrix.chip }}
@@ -105,7 +105,7 @@ jobs:
105105
fail-fast: false
106106
matrix:
107107
type: ${{ fromJson(needs.gen-matrix.outputs.hw-types) }}
108-
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
108+
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32p4']
109109
with:
110110
type: ${{ matrix.type }}
111111
chip: ${{ matrix.chip }}

.github/workflows/tests_wokwi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ jobs:
165165
fail-fast: false
166166
matrix:
167167
type: ['validation']
168-
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
168+
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32p4']
169169
steps:
170170
- name: Report pending
171171
uses: actions/github-script@v7

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Here are the ESP32 series supported by the Arduino-ESP32 project:
5959
| ESP32-S3 | Yes | Yes | [ESP32-S3](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) |
6060
| ESP32-C6 | Yes | Yes | [ESP32-C6](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf) |
6161
| ESP32-H2 | Yes | Yes | [ESP32-H2](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf) |
62+
| ESP32-P4 | No | No | [ESP32-P4](https://www.espressif.com/sites/default/files/documentation/esp32-p4_datasheet_en.pdf) |
6263

6364
> [!NOTE]
6465
> ESP32-C2 is also supported by Arduino-ESP32 but requires rebuilding the static libraries. This is not trivial and requires a good understanding of the ESP-IDF

boards.txt

+88-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ esp32c2.menu.EraseFlash.all.upload.erase_cmd=-e
163163
##############################################################
164164

165165
esp32p4.name=ESP32P4 Dev Module
166-
esp32p4.hide=true
167166

168167
esp32p4.bootloader.tool=esptool_py
169168
esp32p4.bootloader.tool.default=esptool_py
@@ -188,10 +187,10 @@ esp32p4.build.mcu=esp32p4
188187
esp32p4.build.core=esp32
189188
esp32p4.build.variant=esp32p4
190189
esp32p4.build.board=ESP32P4_DEV
191-
esp32p4.build.bootloader_addr=0x0
190+
esp32p4.build.bootloader_addr=0x2000
192191

193192
esp32p4.build.cdc_on_boot=0
194-
esp32p4.build.f_cpu=400000000L
193+
esp32p4.build.f_cpu=360000000L
195194
esp32p4.build.flash_size=4MB
196195
esp32p4.build.flash_freq=80m
197196
esp32p4.build.img_freq=80m
@@ -203,6 +202,25 @@ esp32p4.build.defines=
203202
## IDE 2.0 Seems to not update the value
204203
esp32p4.menu.JTAGAdapter.default=Disabled
205204
esp32p4.menu.JTAGAdapter.default.build.copy_jtag_files=0
205+
esp32p4.menu.JTAGAdapter.builtin=Integrated USB JTAG
206+
esp32p4.menu.JTAGAdapter.builtin.build.openocdscript=esp32p4-builtin.cfg
207+
esp32p4.menu.JTAGAdapter.builtin.build.copy_jtag_files=1
208+
esp32p4.menu.JTAGAdapter.external=FTDI Adapter
209+
esp32p4.menu.JTAGAdapter.external.build.openocdscript=esp32p4-ftdi.cfg
210+
esp32p4.menu.JTAGAdapter.external.build.copy_jtag_files=1
211+
esp32p4.menu.JTAGAdapter.bridge=ESP USB Bridge
212+
esp32p4.menu.JTAGAdapter.bridge.build.openocdscript=esp32p4-bridge.cfg
213+
esp32p4.menu.JTAGAdapter.bridge.build.copy_jtag_files=1
214+
215+
esp32p4.menu.CDCOnBoot.default=Disabled
216+
esp32p4.menu.CDCOnBoot.default.build.cdc_on_boot=0
217+
esp32p4.menu.CDCOnBoot.cdc=Enabled
218+
esp32p4.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
219+
220+
esp32p4.menu.PSRAM.disabled=Disabled
221+
esp32p4.menu.PSRAM.disabled.build.defines=
222+
esp32p4.menu.PSRAM.enabled=Enabled
223+
esp32p4.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM
206224

207225
esp32p4.menu.CDCOnBoot.default=Disabled
208226
esp32p4.menu.CDCOnBoot.default.build.cdc_on_boot=0
@@ -211,20 +229,87 @@ esp32p4.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
211229

212230
esp32p4.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
213231
esp32p4.menu.PartitionScheme.default.build.partitions=default
232+
esp32p4.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
233+
esp32p4.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
234+
esp32p4.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS)
235+
esp32p4.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
236+
esp32p4.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
237+
esp32p4.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
238+
esp32p4.menu.PartitionScheme.minimal.build.partitions=minimal
214239
esp32p4.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
215240
esp32p4.menu.PartitionScheme.no_fs.build.partitions=no_fs
216241
esp32p4.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
242+
esp32p4.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
243+
esp32p4.menu.PartitionScheme.no_ota.build.partitions=no_ota
244+
esp32p4.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
245+
esp32p4.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
246+
esp32p4.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
247+
esp32p4.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
248+
esp32p4.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
249+
esp32p4.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
250+
esp32p4.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
251+
esp32p4.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
252+
esp32p4.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
253+
esp32p4.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
217254
esp32p4.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
218255
esp32p4.menu.PartitionScheme.huge_app.build.partitions=huge_app
219256
esp32p4.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
257+
esp32p4.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
258+
esp32p4.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
259+
esp32p4.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
260+
esp32p4.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS)
261+
esp32p4.menu.PartitionScheme.fatflash.build.partitions=ffat
262+
esp32p4.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
263+
esp32p4.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
264+
esp32p4.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
265+
esp32p4.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
220266
esp32p4.menu.PartitionScheme.custom=Custom
221267
esp32p4.menu.PartitionScheme.custom.build.partitions=
222268
esp32p4.menu.PartitionScheme.custom.upload.maximum_size=16777216
223269

270+
## From https://docs.espressif.com/projects/esp-idf/en/latest/esp32p4/api-reference/kconfig.html#config-esp-default-cpu-freq-mhz
271+
esp32p4.menu.CPUFreq.360=360MHz
272+
esp32p4.menu.CPUFreq.360.build.f_cpu=360000000L
273+
esp32p4.menu.CPUFreq.40=40MHz
274+
esp32p4.menu.CPUFreq.40.build.f_cpu=40000000L
275+
276+
esp32p4.menu.FlashMode.qio=QIO
277+
esp32p4.menu.FlashMode.qio.build.flash_mode=dio
278+
esp32p4.menu.FlashMode.qio.build.boot=qio
279+
esp32p4.menu.FlashMode.dio=DIO
280+
esp32p4.menu.FlashMode.dio.build.flash_mode=dio
281+
esp32p4.menu.FlashMode.dio.build.boot=dio
282+
283+
esp32p4.menu.FlashFreq.80=80MHz
284+
esp32p4.menu.FlashFreq.80.build.flash_freq=80m
285+
esp32p4.menu.FlashFreq.40=40MHz
286+
esp32p4.menu.FlashFreq.40.build.flash_freq=40m
287+
288+
esp32p4.menu.FlashSize.4M=4MB (32Mb)
289+
esp32p4.menu.FlashSize.4M.build.flash_size=4MB
290+
esp32p4.menu.FlashSize.8M=8MB (64Mb)
291+
esp32p4.menu.FlashSize.8M.build.flash_size=8MB
292+
esp32p4.menu.FlashSize.8M.build.partitions=default_8MB
293+
esp32p4.menu.FlashSize.2M=2MB (16Mb)
294+
esp32p4.menu.FlashSize.2M.build.flash_size=2MB
295+
esp32p4.menu.FlashSize.2M.build.partitions=minimal
296+
esp32p4.menu.FlashSize.16M=16MB (128Mb)
297+
esp32p4.menu.FlashSize.16M.build.flash_size=16MB
298+
224299
esp32p4.menu.UploadSpeed.921600=921600
225300
esp32p4.menu.UploadSpeed.921600.upload.speed=921600
226301
esp32p4.menu.UploadSpeed.115200=115200
227302
esp32p4.menu.UploadSpeed.115200.upload.speed=115200
303+
esp32p4.menu.UploadSpeed.256000.windows=256000
304+
esp32p4.menu.UploadSpeed.256000.upload.speed=256000
305+
esp32p4.menu.UploadSpeed.230400.windows.upload.speed=256000
306+
esp32p4.menu.UploadSpeed.230400=230400
307+
esp32p4.menu.UploadSpeed.230400.upload.speed=230400
308+
esp32p4.menu.UploadSpeed.460800.linux=460800
309+
esp32p4.menu.UploadSpeed.460800.macosx=460800
310+
esp32p4.menu.UploadSpeed.460800.upload.speed=460800
311+
esp32p4.menu.UploadSpeed.512000.windows=512000
312+
esp32p4.menu.UploadSpeed.512000.upload.speed=512000
228313

229314
esp32p4.menu.DebugLevel.none=None
230315
esp32p4.menu.DebugLevel.none.build.code_debug=0

cores/esp32/Esp.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ extern "C" {
6060
#elif CONFIG_IDF_TARGET_ESP32H2
6161
#include "esp32h2/rom/spi_flash.h"
6262
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32h2 is located at 0x0000
63+
#elif CONFIG_IDF_TARGET_ESP32P4
64+
#include "esp32p4/rom/spi_flash.h"
65+
#define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32p4 is located at 0x2000
6366
#else
6467
#error Target CONFIG_IDF_TARGET is not supported
6568
#endif
@@ -335,6 +338,8 @@ uint32_t EspClass::getFlashChipSpeed(void) {
335338
return magicFlashChipSpeed(fhdr.spi_speed);
336339
}
337340

341+
// FIXME for P4
342+
#if !defined(CONFIG_IDF_TARGET_ESP32P4)
338343
FlashMode_t EspClass::getFlashChipMode(void) {
339344
#if CONFIG_IDF_TARGET_ESP32S2
340345
uint32_t spi_ctrl = REG_READ(PERIPHS_SPI_FLASH_CTRL);
@@ -361,6 +366,7 @@ FlashMode_t EspClass::getFlashChipMode(void) {
361366
}
362367
return (FM_DOUT);
363368
}
369+
#endif // if !defined(CONFIG_IDF_TARGET_ESP32P4)
364370

365371
uint32_t EspClass::magicFlashChipSize(uint8_t byte) {
366372
/*

cores/esp32/HardwareSerial.h

+12
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ typedef enum {
125125
#define SOC_RX0 (gpio_num_t)17
126126
#elif CONFIG_IDF_TARGET_ESP32H2
127127
#define SOC_RX0 (gpio_num_t)23
128+
#elif CONFIG_IDF_TARGET_ESP32P4
129+
#define SOC_RX0 (gpio_num_t)38
128130
#endif
129131
#endif
130132

@@ -141,6 +143,8 @@ typedef enum {
141143
#define SOC_TX0 (gpio_num_t)16
142144
#elif CONFIG_IDF_TARGET_ESP32H2
143145
#define SOC_TX0 (gpio_num_t)24
146+
#elif CONFIG_IDF_TARGET_ESP32P4
147+
#define SOC_TX0 (gpio_num_t)37
144148
#endif
145149
#endif
146150

@@ -162,6 +166,8 @@ typedef enum {
162166
#define RX1 (gpio_num_t)4
163167
#elif CONFIG_IDF_TARGET_ESP32H2
164168
#define RX1 (gpio_num_t)0
169+
#elif CONFIG_IDF_TARGET_ESP32P4
170+
#define RX1 (gpio_num_t)11
165171
#endif
166172
#endif
167173

@@ -180,6 +186,8 @@ typedef enum {
180186
#define TX1 (gpio_num_t)5
181187
#elif CONFIG_IDF_TARGET_ESP32H2
182188
#define TX1 (gpio_num_t)1
189+
#elif CONFIG_IDF_TARGET_ESP32P4
190+
#define TX1 (gpio_num_t)10
183191
#endif
184192
#endif
185193
#endif /* SOC_UART_HP_NUM > 1 */
@@ -192,6 +200,8 @@ typedef enum {
192200
#define RX2 (gpio_num_t)4
193201
#elif CONFIG_IDF_TARGET_ESP32S3
194202
#define RX2 (gpio_num_t)19
203+
#elif CONFIG_IDF_TARGET_ESP32P4
204+
#define RX2 (gpio_num_t)15
195205
#endif
196206
#endif
197207

@@ -200,6 +210,8 @@ typedef enum {
200210
#define TX2 (gpio_num_t)25
201211
#elif CONFIG_IDF_TARGET_ESP32S3
202212
#define TX2 (gpio_num_t)20
213+
#elif CONFIG_IDF_TARGET_ESP32P4
214+
#define TX2 (gpio_num_t)14
203215
#endif
204216
#endif
205217
#endif /* SOC_UART_HP_NUM > 2 */

cores/esp32/chip-debug-report.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ static void printPkgVersion(void) {
6464
#elif CONFIG_IDF_TARGET_ESP32H2
6565
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SYS_4_REG, EFUSE_PKG_VERSION);
6666
chip_report_printf("%lu", pkg_ver);
67+
#elif CONFIG_IDF_TARGET_ESP32P4
68+
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SYS_2_REG, EFUSE_PKG_VERSION);
69+
chip_report_printf("%lu", pkg_ver);
6770
#else
6871
chip_report_printf("Unknown");
6972
#endif
@@ -84,6 +87,7 @@ static void printChipInfo(void) {
8487
case CHIP_ESP32C3: chip_report_printf("ESP32-C3\n"); break;
8588
case CHIP_ESP32C6: chip_report_printf("ESP32-C6\n"); break;
8689
case CHIP_ESP32H2: chip_report_printf("ESP32-H2\n"); break;
90+
case CHIP_ESP32P4: chip_report_printf("ESP32-P4\n"); break;
8791
default: chip_report_printf("Unknown %d\n", info.model); break;
8892
}
8993
printPkgVersion();
@@ -105,6 +109,8 @@ static void printChipInfo(void) {
105109
static void printFlashInfo(void) {
106110
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
107111
#define ESP_FLASH_IMAGE_BASE 0x1000
112+
#elif CONFIG_IDF_TARGET_ESP32P4
113+
#define ESP_FLASH_IMAGE_BASE 0x2000
108114
#else
109115
#define ESP_FLASH_IMAGE_BASE 0x0000
110116
#endif

cores/esp32/esp32-hal-adc.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static bool adcDetachBus(void *pin) {
7575
if (err != ESP_OK) {
7676
return false;
7777
}
78-
#elif !defined(CONFIG_IDF_TARGET_ESP32H2)
78+
#elif (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4))
7979
err = adc_cali_delete_scheme_line_fitting(adc_handle[adc_unit].adc_cali_handle);
8080
if (err != ESP_OK) {
8181
return false;
@@ -127,7 +127,7 @@ esp_err_t __analogChannelConfig(adc_bitwidth_t width, adc_attenuation_t atten, i
127127
log_e("adc_cali_create_scheme_curve_fitting failed with error: %d", err);
128128
return err;
129129
}
130-
#elif !defined(CONFIG_IDF_TARGET_ESP32H2) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
130+
#elif (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4)) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
131131
log_d("Deleting ADC_UNIT_%d line cali handle", adc_unit);
132132
err = adc_cali_delete_scheme_line_fitting(adc_handle[adc_unit].adc_cali_handle);
133133
if (err != ESP_OK) {
@@ -310,7 +310,7 @@ uint32_t __analogReadMilliVolts(uint8_t pin) {
310310
.bitwidth = __analogWidth,
311311
};
312312
err = adc_cali_create_scheme_curve_fitting(&cali_config, &adc_handle[adc_unit].adc_cali_handle);
313-
#elif !defined(CONFIG_IDF_TARGET_ESP32H2) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
313+
#elif (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4)) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
314314
adc_cali_line_fitting_config_t cali_config = {
315315
.unit_id = adc_unit,
316316
.bitwidth = __analogWidth,
@@ -379,7 +379,7 @@ static bool adcContinuousDetachBus(void *adc_unit_number) {
379379
if (err != ESP_OK) {
380380
return false;
381381
}
382-
#elif !defined(CONFIG_IDF_TARGET_ESP32H2)
382+
#elif (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4))
383383
err = adc_cali_delete_scheme_line_fitting(adc_handle[adc_unit].adc_cali_handle);
384384
if (err != ESP_OK) {
385385
return false;
@@ -552,7 +552,7 @@ bool analogContinuous(const uint8_t pins[], size_t pins_count, uint32_t conversi
552552
.bitwidth = __adcContinuousWidth,
553553
};
554554
err = adc_cali_create_scheme_curve_fitting(&cali_config, &adc_handle[adc_unit].adc_cali_handle);
555-
#elif !defined(CONFIG_IDF_TARGET_ESP32H2) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
555+
#elif (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4)) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
556556
adc_cali_line_fitting_config_t cali_config = {
557557
.unit_id = adc_unit,
558558
.bitwidth = __adcContinuousWidth,

0 commit comments

Comments
 (0)