From 0948eb9b71d0a32a40fc9ae675db16e179d09dbd Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Fri, 11 Oct 2024 13:49:53 +0200 Subject: [PATCH] Use hardware specific partition table --- code/include/defines.h | 163 +++++++++++++++------------------ code/partitions.csv | 8 -- code/partitions_16MB.csv | 7 ++ code/partitions_4MB.csv | 6 ++ code/partitions_4MB_legacy.csv | 7 ++ code/partitions_8MB.csv | 7 ++ code/platformio.ini | 51 +++++------ 7 files changed, 122 insertions(+), 127 deletions(-) delete mode 100644 code/partitions.csv create mode 100644 code/partitions_16MB.csv create mode 100644 code/partitions_4MB.csv create mode 100644 code/partitions_4MB_legacy.csv create mode 100644 code/partitions_8MB.csv diff --git a/code/include/defines.h b/code/include/defines.h index ffa6b247c..d50ad88fe 100644 --- a/code/include/defines.h +++ b/code/include/defines.h @@ -277,40 +277,23 @@ CONFIG_WPA_11R_SUPPORT=n //************************************************************************* // Define BOARD type -// Define ENV_BOARD_TYPE in platformio.ini +// Define in platformio.ini //************************************ -#if ENV_BOARD_TYPE == 1 -#define BOARD_AITHINKER_ESP32CAM +#if defined(BOARD_AITHINKER_ESP32CAM) #define BOARD_TYPE_NAME "ESP32CAM" // Keep Board type equal to main board environment name // This is used for OTA update package verification (converted to lower case) -#elif ENV_BOARD_TYPE == 2 -#define BOARD_XIAO_ESP32S3 + +#elif defined(BOARD_XIAO_ESP32S3) #define BOARD_TYPE_NAME "XIAO-ESP32S3-Sense" // Keep Board type equal to main board environment name. // This is used for OTA update package verification (converted to lower case) -#elif ENV_BOARD_TYPE == 3 -#define BOARD_FREENOVE_ESP32S3 +#elif defined(BOARD_FREENOVE_ESP32S3_N16R8) #define BOARD_TYPE_NAME "Freenove-ESP32S3-N16R8"// Keep Board type equal to main board environment name. // This is used for OTA update package verification (converted to lower case) #else -#error "Board type (ENV_BOARD_TYPE) not defined" +#error "Board type not defined" #define BOARD_AITHINKER_ESP32CAM -#define BOARD_TYPE_NAME "Board unknown" -#endif - - -// Define CAMERA model -// Define ENV_CAMERA_MODEL in platformio.ini -//************************************ -#if ENV_CAMERA_MODEL == 1 -#define CAMERA_AITHINKER_ESP32CAM -#elif ENV_CAMERA_MODEL == 2 -#define CAMERA_XIAO_ESP32S3_SENSE -#elif ENV_CAMERA_MODEL == 3 -#define CAMERA_FREENOVE_ESP32S3 -#else -#define CAMERA_AITHINKER_ESP32CAM_OV2640 -#error "Camera model (ENV_CAMERA_MODEL) not defined" +#define BOARD_TYPE_NAME "Board unknown" #endif @@ -331,6 +314,28 @@ CONFIG_WPA_11R_SUPPORT=n #define GPIO_SDCARD_D3 GPIO_NUM_13 // Needs to be high to init SD in MMC mode. After init GPIO can be used as spare GPIO + // Camera pin config + // Further models: https://github.com/Mjrovai/XIAO-ESP32S3-Sense/blob/main/camera_round_display_save_jpeg/camera_pins.h + //------------------------------------------------- + #define PWDN_GPIO_NUM GPIO_NUM_32 + #define RESET_GPIO_NUM -1 + #define XCLK_GPIO_NUM GPIO_NUM_0 + #define SIOD_GPIO_NUM GPIO_NUM_26 + #define SIOC_GPIO_NUM GPIO_NUM_27 + + #define Y9_GPIO_NUM GPIO_NUM_35 + #define Y8_GPIO_NUM GPIO_NUM_34 + #define Y7_GPIO_NUM GPIO_NUM_39 + #define Y6_GPIO_NUM GPIO_NUM_36 + #define Y5_GPIO_NUM GPIO_NUM_21 + #define Y4_GPIO_NUM GPIO_NUM_19 + #define Y3_GPIO_NUM GPIO_NUM_18 + #define Y2_GPIO_NUM GPIO_NUM_5 + #define VSYNC_GPIO_NUM GPIO_NUM_25 + #define HREF_GPIO_NUM GPIO_NUM_23 + #define PCLK_GPIO_NUM GPIO_NUM_22 + + // LEDs //------------------------------------------------- #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_33 // Onboard status LED (red, active low) @@ -410,6 +415,28 @@ CONFIG_WPA_11R_SUPPORT=n #define GPIO_SDCARD_D3 GPIO_NUM_21 // Needs to be high to init with MMC mode. After init GPIO can be used as status LED + // Camera pin config + // Further models: https://github.com/Mjrovai/XIAO-ESP32S3-Sense/blob/main/camera_round_display_save_jpeg/camera_pins.h + //------------------------------------------------- + #define PWDN_GPIO_NUM -1 + #define RESET_GPIO_NUM -1 + #define XCLK_GPIO_NUM GPIO_NUM_10 + #define SIOD_GPIO_NUM GPIO_NUM_40 + #define SIOC_GPIO_NUM GPIO_NUM_39 + + #define Y9_GPIO_NUM GPIO_NUM_48 + #define Y8_GPIO_NUM GPIO_NUM_11 + #define Y7_GPIO_NUM GPIO_NUM_12 + #define Y6_GPIO_NUM GPIO_NUM_14 + #define Y5_GPIO_NUM GPIO_NUM_16 + #define Y4_GPIO_NUM GPIO_NUM_18 + #define Y3_GPIO_NUM GPIO_NUM_17 + #define Y2_GPIO_NUM GPIO_NUM_15 + #define VSYNC_GPIO_NUM GPIO_NUM_38 + #define HREF_GPIO_NUM GPIO_NUM_47 + #define PCLK_GPIO_NUM GPIO_NUM_13 + + // LEDs //------------------------------------------------- #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_21 // Onboard yellow status LED (USER LED, yellow, active low) @@ -461,7 +488,7 @@ CONFIG_WPA_11R_SUPPORT=n #define GPIO_SPARE_6 GPIO_NUM_6 #define GPIO_SPARE_6_USAGE "spare" -#elif defined(BOARD_FREENOVE_ESP32S3) +#elif defined(BOARD_FREENOVE_ESP32S3_N16R8) #ifndef BOARD_SDCARD_SDMMC_BUS_WIDTH_1 #define BOARD_SDCARD_SDMMC_BUS_WIDTH_1 // Only 1 line SD card operation is supported (hardware related) #endif @@ -476,6 +503,28 @@ CONFIG_WPA_11R_SUPPORT=n #define GPIO_SDCARD_D3 GPIO_NUM_NC + // Camera pin config + // Further models: https://github.com/Mjrovai/XIAO-ESP32S3-Sense/blob/main/camera_round_display_save_jpeg/camera_pins.h + //------------------------------------------------- + #define PWDN_GPIO_NUM -1 + #define RESET_GPIO_NUM -1 + #define XCLK_GPIO_NUM GPIO_NUM_15 + #define SIOD_GPIO_NUM GPIO_NUM_4 + #define SIOC_GPIO_NUM GPIO_NUM_5 + + #define Y9_GPIO_NUM GPIO_NUM_16 + #define Y8_GPIO_NUM GPIO_NUM_17 + #define Y7_GPIO_NUM GPIO_NUM_18 + #define Y6_GPIO_NUM GPIO_NUM_12 + #define Y5_GPIO_NUM GPIO_NUM_10 + #define Y4_GPIO_NUM GPIO_NUM_8 + #define Y3_GPIO_NUM GPIO_NUM_9 + #define Y2_GPIO_NUM GPIO_NUM_11 + #define VSYNC_GPIO_NUM GPIO_NUM_6 + #define HREF_GPIO_NUM GPIO_NUM_7 + #define PCLK_GPIO_NUM GPIO_NUM_13 + + // LEDs //------------------------------------------------- #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_2 // Onboard status LED (blue, active high) @@ -531,68 +580,4 @@ CONFIG_WPA_11R_SUPPORT=n #error "define.h: No board type defined or type unknown" #endif //Board types - -// Camera models -// Further models: https://github.com/Mjrovai/XIAO-ESP32S3-Sense/blob/main/camera_round_display_save_jpeg/camera_pins.h -//************************************ -#ifdef CAMERA_AITHINKER_ESP32CAM - #define PWDN_GPIO_NUM GPIO_NUM_32 - #define RESET_GPIO_NUM -1 - #define XCLK_GPIO_NUM GPIO_NUM_0 - #define SIOD_GPIO_NUM GPIO_NUM_26 - #define SIOC_GPIO_NUM GPIO_NUM_27 - - #define Y9_GPIO_NUM GPIO_NUM_35 - #define Y8_GPIO_NUM GPIO_NUM_34 - #define Y7_GPIO_NUM GPIO_NUM_39 - #define Y6_GPIO_NUM GPIO_NUM_36 - #define Y5_GPIO_NUM GPIO_NUM_21 - #define Y4_GPIO_NUM GPIO_NUM_19 - #define Y3_GPIO_NUM GPIO_NUM_18 - #define Y2_GPIO_NUM GPIO_NUM_5 - #define VSYNC_GPIO_NUM GPIO_NUM_25 - #define HREF_GPIO_NUM GPIO_NUM_23 - #define PCLK_GPIO_NUM GPIO_NUM_22 - -#elif defined(CAMERA_XIAO_ESP32S3_SENSE) - #define PWDN_GPIO_NUM -1 - #define RESET_GPIO_NUM -1 - #define XCLK_GPIO_NUM GPIO_NUM_10 - #define SIOD_GPIO_NUM GPIO_NUM_40 - #define SIOC_GPIO_NUM GPIO_NUM_39 - - #define Y9_GPIO_NUM GPIO_NUM_48 - #define Y8_GPIO_NUM GPIO_NUM_11 - #define Y7_GPIO_NUM GPIO_NUM_12 - #define Y6_GPIO_NUM GPIO_NUM_14 - #define Y5_GPIO_NUM GPIO_NUM_16 - #define Y4_GPIO_NUM GPIO_NUM_18 - #define Y3_GPIO_NUM GPIO_NUM_17 - #define Y2_GPIO_NUM GPIO_NUM_15 - #define VSYNC_GPIO_NUM GPIO_NUM_38 - #define HREF_GPIO_NUM GPIO_NUM_47 - #define PCLK_GPIO_NUM GPIO_NUM_13 - -#elif defined(CAMERA_FREENOVE_ESP32S3) - #define PWDN_GPIO_NUM -1 - #define RESET_GPIO_NUM -1 - #define XCLK_GPIO_NUM GPIO_NUM_15 - #define SIOD_GPIO_NUM GPIO_NUM_4 - #define SIOC_GPIO_NUM GPIO_NUM_5 - - #define Y9_GPIO_NUM GPIO_NUM_16 - #define Y8_GPIO_NUM GPIO_NUM_17 - #define Y7_GPIO_NUM GPIO_NUM_18 - #define Y6_GPIO_NUM GPIO_NUM_12 - #define Y5_GPIO_NUM GPIO_NUM_10 - #define Y4_GPIO_NUM GPIO_NUM_8 - #define Y3_GPIO_NUM GPIO_NUM_9 - #define Y2_GPIO_NUM GPIO_NUM_11 - #define VSYNC_GPIO_NUM GPIO_NUM_6 - #define HREF_GPIO_NUM GPIO_NUM_7 - #define PCLK_GPIO_NUM GPIO_NUM_13 -#else - #error "define.h: No camera model defined or model unknown" -#endif //Camera models - #endif //DEFINES_H \ No newline at end of file diff --git a/code/partitions.csv b/code/partitions.csv deleted file mode 100644 index b0c6981b0..000000000 --- a/code/partitions.csv +++ /dev/null @@ -1,8 +0,0 @@ -# Name, Type, SubType, Offset, Size, Flags -# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap -nvs, data, nvs, , 0x4000, -otadata, data, ota, , 0x2000, -phy_init, data, phy, , 0x1000, -# factory, app, factory, , 1600k, -ota_0, app, ota_0, , 1900k, -ota_1, app, ota_1, , 1900k, \ No newline at end of file diff --git a/code/partitions_16MB.csv b/code/partitions_16MB.csv new file mode 100644 index 000000000..1cb331c0a --- /dev/null +++ b/code/partitions_16MB.csv @@ -0,0 +1,7 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, , 0x5000, +otadata, data, ota, , 0x2000, +ota_0, app, ota_0, , 2048K, +ota_1, app, ota_1, , 2048K, +coredump, data, coredump, , 64K, +littlefs, data, littlefs, , 0xBE0000, \ No newline at end of file diff --git a/code/partitions_4MB.csv b/code/partitions_4MB.csv new file mode 100644 index 000000000..239443215 --- /dev/null +++ b/code/partitions_4MB.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, , 0x5000, +otadata, data, ota, , 0x2000, +ota_0, app, ota_0, , 0x1EC000, +ota_1, app, ota_1, , 0x1EC000, +coredump, data, coredump, , 64K, \ No newline at end of file diff --git a/code/partitions_4MB_legacy.csv b/code/partitions_4MB_legacy.csv new file mode 100644 index 000000000..2c193b4e0 --- /dev/null +++ b/code/partitions_4MB_legacy.csv @@ -0,0 +1,7 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, , 0x4000, +otadata, data, ota, , 0x2000, +phy_init, data, phy, , 0x1000, +ota_0, app, ota_0, , 1900k, +ota_1, app, ota_1, , 1900k, +coredump, data, coredump, , 64K, \ No newline at end of file diff --git a/code/partitions_8MB.csv b/code/partitions_8MB.csv new file mode 100644 index 000000000..d1984f7ad --- /dev/null +++ b/code/partitions_8MB.csv @@ -0,0 +1,7 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, , 0x5000, +otadata, data, ota, , 0x2000, +ota_0, app, ota_0, , 2048K, +ota_1, app, ota_1, , 2048K, +coredump, data, coredump, , 64K, +littlefs, data, littlefs, , 0x3F800, \ No newline at end of file diff --git a/code/platformio.ini b/code/platformio.ini index bda780c6f..077a3dd20 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -53,21 +53,19 @@ build_flags = ; ############################################################################# [env:esp32cam] extends = common:esp32-idf -board = esp32cam framework = espidf +board = esp32cam +board_build.partitions = partitions_4MB_legacy.csv build_flags = ; ### Common flags: ${common:esp32-idf.build_flags} ${flags:runtime.build_flags} - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=1 - -D ENV_CAMERA_MODEL=1 + ; ### Hardware: Define board type (see 'include/defines.h' for definitions) + -D BOARD_AITHINKER_ESP32CAM ; ### Software modules: Uncomment to disable ;-D ENV_DISABLE_MQTT ;-D ENV_DISABLE_INFLUXDB ;-D ENV_DISABLE_SOFTAP -board_build.partitions = partitions.csv monitor_speed = 115200 monitor_rts = 0 monitor_dtr = 0 @@ -87,10 +85,8 @@ build_flags = ; ### Common flags: ${common:esp32-idf.build_flags} ${flags:runtime.build_flags} - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=1 - -D ENV_CAMERA_MODEL=1 + ; ### Hardware: Define board type (see 'include/defines.h' for definitions) + -D BOARD_AITHINKER_ESP32CAM @@ -100,21 +96,19 @@ build_flags = ; ############################################################################# [env:xiao-esp32s3-sense] extends = common:esp32-idf -board = seeed_xiao_esp32s3 framework = espidf +board = seeed_xiao_esp32s3 +board_build.partitions = partitions_8MB.csv build_flags = ; ### common imported : ${common:esp32-idf.build_flags} ${flags:runtime.build_flags} - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=2 - -D ENV_CAMERA_MODEL=2 + ; ### Hardware: Define board type (see 'include/defines.h' for definitions) + -D BOARD_XIAO_ESP32S3 ; ### Software modules: Uncomment to disable ;-D ENV_DISABLE_MQTT ;-D ENV_DISABLE_INFLUXDB ;-D ENV_DISABLE_SOFTAP -board_build.partitions = partitions.csv monitor_speed = 115200 monitor_rts = 0 monitor_dtr = 0 @@ -134,10 +128,8 @@ build_flags = ; ### common imported : ${common:esp32-idf.build_flags} ${flags:runtime.build_flags} - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=2 - -D ENV_CAMERA_MODEL=2 + ; ### Hardware: Define board type (see 'include/defines.h' for definitions) + -D BOARD_XIAO_ESP32S3 ; ############################################################################# @@ -146,21 +138,22 @@ build_flags = ; ############################################################################# [env:freenove-esp32s3-n16r8] extends = common:esp32-idf -board = 4d_systems_esp32s3_gen4_r8n16 framework = espidf +# 'freenove_esp32_s3_wroom' not yet supported, but already in dev: (#1469) Freenove ESP32-S3-WROOM added +board = 4d_systems_esp32s3_gen4_r8n16 +board_upload.flash_size = 16MB +board_upload.maximum_size = 16777216 +board_build.partitions = partitions_16MB.csv build_flags = ; ### common imported : ${common:esp32-idf.build_flags} ${flags:runtime.build_flags} - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=3 - -D ENV_CAMERA_MODEL=3 + ; ### Hardware: Define board type (see 'include/defines.h' for definitions) + -D BOARD_FREENOVE_ESP32S3_N16R8 ; ### Software modules: Uncomment to disable ;-D ENV_DISABLE_MQTT ;-D ENV_DISABLE_INFLUXDB ;-D ENV_DISABLE_SOFTAP -board_build.partitions = partitions.csv monitor_speed = 115200 monitor_rts = 0 monitor_dtr = 0 @@ -180,7 +173,5 @@ build_flags = ; ### common imported : ${common:esp32-idf.build_flags} ${flags:runtime.build_flags} - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=3 - -D ENV_CAMERA_MODEL=3 + ; ### Hardware: Define board type (see 'include/defines.h' for definitions) + -D BOARD_FREENOVE_ESP32S3_N16R8