Skip to content

Commit

Permalink
Use hardware specific partition table
Browse files Browse the repository at this point in the history
  • Loading branch information
Slider0007 committed Oct 11, 2024
1 parent b6e441a commit 0948eb9
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 127 deletions.
163 changes: 74 additions & 89 deletions code/include/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
8 changes: 0 additions & 8 deletions code/partitions.csv

This file was deleted.

7 changes: 7 additions & 0 deletions code/partitions_16MB.csv
Original file line number Diff line number Diff line change
@@ -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,
6 changes: 6 additions & 0 deletions code/partitions_4MB.csv
Original file line number Diff line number Diff line change
@@ -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,
7 changes: 7 additions & 0 deletions code/partitions_4MB_legacy.csv
Original file line number Diff line number Diff line change
@@ -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,
7 changes: 7 additions & 0 deletions code/partitions_8MB.csv
Original file line number Diff line number Diff line change
@@ -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,
51 changes: 21 additions & 30 deletions code/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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



Expand All @@ -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
Expand All @@ -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


; #############################################################################
Expand All @@ -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
Expand All @@ -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

0 comments on commit 0948eb9

Please sign in to comment.