From 9fe1017b2291e6d3c07ab93ff999357842c56685 Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Sat, 20 Jul 2024 00:09:39 +0200 Subject: [PATCH 01/11] feat(hardware): Add support for board Freenove ESP32S3 (and compatible) --- code/include/defines.h | 100 ++++++++++++++++++++++++++++++++++++++--- code/platformio.ini | 91 ++++++++++++++++++++++++++++++++++++- 2 files changed, 184 insertions(+), 7 deletions(-) diff --git a/code/include/defines.h b/code/include/defines.h index 3a4b86bd2..b57d7e710 100644 --- a/code/include/defines.h +++ b/code/include/defines.h @@ -315,11 +315,16 @@ CONFIG_WPA_11R_SUPPORT=n //************************************ #if ENV_BOARD_TYPE == 1 #define BOARD_AITHINKER_ESP32CAM -#define BOARD_TYPE_NAME "ESP32CAM" // Keep Board type equal to main board environment name +#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 -#define BOARD_TYPE_NAME "XIAO-ESP32S3-Sense" // Keep Board type equal to main board environment name. +#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 +#define BOARD_TYPE_NAME "Freenove-ESP32S3" // 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" @@ -331,9 +336,11 @@ CONFIG_WPA_11R_SUPPORT=n // Define ENV_CAMERA_MODEL in platformio.ini //************************************ #if ENV_CAMERA_MODEL == 1 -#define CAMERA_AITHINKER_ESP32CAM_OV2640 +#define CAMERA_AITHINKER_ESP32CAM #elif ENV_CAMERA_MODEL == 2 -#define CAMERA_XIAO_ESP32S3_SENSE_OV2640 +#define CAMERA_XIAO_ESP32S3_SENSE +#elif ENV_CAMERA_MODEL == 3 +#define CAMERA_FREENOVE_ESP32S3 #else #error "Camera model (ENV_CAMERA_MODEL) not defined" #endif @@ -481,6 +488,68 @@ CONFIG_WPA_11R_SUPPORT=n #define GPIO_SPARE_6 GPIO_NUM_6 #define GPIO_SPARE_6_USAGE "spare" +#elif defined(BOARD_FREENOVE_ESP32S3) + #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 + + // SD card (operated with SDMMC peripheral) + //------------------------------------------------- + #define GPIO_SDCARD_CLK GPIO_NUM_39 + #define GPIO_SDCARD_CMD GPIO_NUM_38 + #define GPIO_SDCARD_D0 GPIO_NUM_40 + + + // LEDs + //------------------------------------------------- + #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_2 // Onboard status LED + #define GPIO_FLASHLIGHT_ONBOARD GPIO_NUM_48 // Onboard flashlight (WS2812) + + #define GPIO_FLASHLIGHT_DEFAULT GPIO_FLASHLIGHT_ONBOARD // Default flashlight GPIO pin (can be modified by activiating GPIO functionality in WebUI) + + //#define GPIO_FLASHLIGHT_DEFAULT_USE_PWM // Default flashlight LED is PWM controlled + #define GPIO_FLASHLIGHT_DEFAULT_USE_SMARTLED // Default flashlight SmartLED (e.g. onboard WS2812X) controlled + + #ifdef GPIO_FLASHLIGHT_DEFAULT_USE_SMARTLED + #define GPIO_FLASHLIGHT_DEFAULT_SMARTLED_TYPE LED_WS2812 // Flashlight default: SmartLED type + #define GPIO_FLASHLIGHT_DEFAULT_SMARTLED_QUANTITY 1 // Flashlight default: SmartLED Quantity + #endif + + + // Spare GPIO + //------------------------------------------------- + // Options for usage defintion: + // - 'spare': Free to use + // - 'restricted: usage': Restricted usable (WebUI expert view) + // - 'flashlight-pwm' or 'flashlight-smartled' or 'flashlight-digital' (ON/OFF) -> Map to 'flashlight-default' + // --> flashlight-default -> flashlight-smartled (Onboard LED, smartled controlled) + //------------------------------------------------- + #define GPIO_SPARE_PIN_COUNT 6 + + #define GPIO_SPARE_1 GPIO_NUM_1 + #define GPIO_SPARE_1_USAGE "spare" + + #define GPIO_SPARE_2 GPIO_NUM_14 + #define GPIO_SPARE_2_USAGE "spare" + + #define GPIO_SPARE_3 GPIO_NUM_21 + #define GPIO_SPARE_3_USAGE "spare" + + #define GPIO_SPARE_4 GPIO_NUM_46 + #define GPIO_SPARE_4_USAGE "spare" + + #define GPIO_SPARE_5 GPIO_NUM_47 + #define GPIO_SPARE_5_USAGE "spare" + + #define GPIO_SPARE_6 GPIO_FLASHLIGHT_DEFAULT // Flashlight default + #if defined(GPIO_FLASHLIGHT_DEFAULT_USE_PWM) + #define GPIO_SPARE6_USAGE FLASHLIGHT_PWM // Define flashlight-default as ... + #elif defined(GPIO_FLASHLIGHT_DEFAULT_USE_SMARTLED) + #define GPIO_SPARE_6_USAGE FLASHLIGHT_SMARTLED // Define flashlight-default as ... + #else + #define GPIO_SPARE_6_USAGE FLASHLIGHT_DIGITAL // Define flashlight-default as ... + #endif + #else #error "define.h: No board type defined or type unknown" #endif //Board types @@ -489,7 +558,7 @@ CONFIG_WPA_11R_SUPPORT=n // 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_OV2640 +#ifdef CAMERA_AITHINKER_ESP32CAM #define PWDN_GPIO_NUM GPIO_NUM_32 #define RESET_GPIO_NUM -1 #define XCLK_GPIO_NUM GPIO_NUM_0 @@ -508,7 +577,7 @@ CONFIG_WPA_11R_SUPPORT=n #define HREF_GPIO_NUM GPIO_NUM_23 #define PCLK_GPIO_NUM GPIO_NUM_22 -#elif defined(CAMERA_XIAO_ESP32S3_SENSE_OV2640) +#elif defined(CAMERA_XIAO_ESP32S3_SENSE) #define PWDN_GPIO_NUM -1 #define RESET_GPIO_NUM -1 #define XCLK_GPIO_NUM GPIO_NUM_10 @@ -526,6 +595,25 @@ CONFIG_WPA_11R_SUPPORT=n #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 diff --git a/code/platformio.ini b/code/platformio.ini index 98fba7a30..d43a2d050 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -154,7 +154,6 @@ build_flags = - ; ############################################################################# ; Board ; XIAO ESP32S3 Sense @@ -242,3 +241,93 @@ build_flags = ;-D DEBUG_ENABLE_PERFMON ;-D DEBUG_HIMEM_MEMORY_CHECK lib_ldf_mode = deep+ + + + +; ############################################################################# +; Board +; FREENOVE ESP32S3-WROOM-1-N16R8 (and compatible) +; ############################################################################# +[env:freenove-esp32s3] +extends = common:esp32-idf +board = 4d_systems_esp32s3_gen4_r8n16 +framework = espidf +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 + ; ### 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 +monitor_filters = default, esp32_exception_decoder + + +; +++++++++++++++++++++++++++++++++++++++++++ +; Use this environment if building locally +; Include parameter tooltips to HTML parameter config file +; and hash to HTML files (caching) +; +++++++++++++++++++++++++++++++++++++++++++ +[env:freenove-esp32s3-localbuild] +extends = env:freenove-esp32s3 +extra_scripts = post:scripts/localbuild.py # Add parameter tooltips to HTML page + # and hashes to all cached HTML files +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 + +; +++++++++++++++++++++++++++++++++++++++++++ +; Use this environment for task analysis (PR #1751) +; +++++++++++++++++++++++++++++++++++++++++++ +[env:freenove-esp32s3-task-analysis] +extends = env:freenove-esp32s3 +; sdkconfig.freenove-esp32s3-task-analysis.defaults override some sdkconfig.defaults +; and enable debug analysis options +build_flags = + ; ### Hardware: Define board type + camera model + ; ### (see 'include/defines.h' for definitions) + -D ENV_BOARD_TYPE=3 + -D ENV_CAMERA_MODEL=3 + ; ### Debug options : + -D TASK_ANALYSIS_ON + ;-D DEBUG_DETAIL_ON + ;please use only one HEAP tracing at time. + ;-D HEAP_TRACING_MAIN_WIFI + ;-D HEAP_TRACING_MAIN_START + ;-D HEAP_TRACING_CLASS_FLOW_CNN_GENERAL_DO_ALING_AND_CUT + + +; +++++++++++++++++++++++++++++++++++++++++++ +; Use this environment for detailed and deep debugging +; (default debugging is already possible with default environment) +; +++++++++++++++++++++++++++++++++++++++++++ +[env:freenove-esp32s3-debug] +extends = env:freenove-esp32s3 +; sdkconfig.freenove-esp32s3-debug.defaults override some sdkconfig.defaults +; and enable debug options and clangtidy +build_flags = + ; ### clangtidy build flags: + ${flags:clangtidy.build_flags} + ; ### Hardware: Define board type + camera model + ; ### (see 'include/defines.h' for definitions) + -D ENV_BOARD_TYPE=3 + -D ENV_CAMERA_MODEL=3 + ; ### Debug options : + -D DEBUG_DETAIL_ON + ;-D DEBUG_DISABLE_BROWNOUT_DETECTOR + ;-D DEBUG_ENABLE_PERFMON + ;-D DEBUG_HIMEM_MEMORY_CHECK +lib_ldf_mode = deep+ From 3630edc958d10dec7efaae718d51c0b1cd1eb333 Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Sat, 20 Jul 2024 00:13:09 +0200 Subject: [PATCH 02/11] Update build action --- .github/workflows/build-release.yaml | 35 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 20c41a694..c1a0f6545 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -17,7 +17,7 @@ jobs: release_created: ${{ steps.release.outputs.release_created }} upload_url: ${{ steps.release.outputs.upload_url }} version: "${{steps.release.outputs.major}}.${{steps.release.outputs.minor}}.${{steps.release.outputs.patch}}" - tag_name: ${{ steps.release.outputs.tag_name }} + tag_name: ${{ steps.release.outputs.tag_name }} steps: - uses: googleapis/release-please-action@v4 id: release @@ -41,6 +41,7 @@ jobs: plat: - esp32cam - xiao-esp32s3-sense + - freenove-esp32s3 steps: - name: Checkout branch if: ${{ ! needs.prepare-release.outputs.release_created }} @@ -69,7 +70,7 @@ jobs: ~/.platformio/.cache key: platformio-${{ github.run_id }} restore-keys: platformio # This matches above key as it is only used as a prefix. It restores the nearest cache - + - name: Cache PIO build files if: ${{ ! needs.prepare-release.outputs.release_created }} # do not use cached data when building a release uses: actions/cache@v4 @@ -77,7 +78,7 @@ jobs: path: ./code/.pio key: build-${{ matrix.plat }}-${{ github.run_id }} restore-keys: build-${{ matrix.plat }} # This matches above key as it is only used as a prefix. It restores the nearest cache - + - name: Setup python environment uses: actions/setup-python@v5 with: @@ -95,7 +96,7 @@ jobs: run: | python -m pip install markdown python ./tools/parameter-tooltip-generator/generate-param-doc-tooltips.py - + python ./tools/docs-generator/generate-api-docs.py rm -rf ./html @@ -119,9 +120,9 @@ jobs: rm -rf ./update mkdir -p ./update cp "./code/.pio/build/${{ matrix.plat }}/firmware.bin" "update/firmware.bin" - + cp -r ./html ./update/ - + rm -rf ./update/config/ mkdir -p ./update/config/ cp ./sd-card/config/*.tfl ./update/config/ 2>/dev/null || true @@ -140,7 +141,7 @@ jobs: # Package contents: # - /firmware.bin # - /partitions.bin - # - /bootloader.bin + # - /bootloader.bin # - sd-card.zip (Content for sd-card -> extract to root folder) ######################################################################################### - name: Manual setup package - Prepare artifact @@ -152,11 +153,11 @@ jobs: cp -f "./code/.pio/build/${{ matrix.plat }}/firmware.bin" "manual_setup/firmware.bin" cp -f "./code/.pio/build/${{ matrix.plat }}/bootloader.bin" "manual_setup/bootloader.bin" cp -f "./code/.pio/build/${{ matrix.plat }}/partitions.bin" "manual_setup/partitions.bin" - + rm -rf ./sd-card/html cp -r ./html ./sd-card/ # Overwrite the Web UI with the preprocessed files cd sd-card; zip -r ../manual_setup/sd-card.zip *; cd .. - + - name: Manual setup package - Upload artifact uses: actions/upload-artifact@v4 with: @@ -176,9 +177,9 @@ jobs: run: | rm -rf ./remote_setup mkdir -p ./remote_setup - + cp -r ./html ./remote_setup/ - + rm -rf ./remote_setup/config/ mkdir -p ./remote_setup/config/ cp ./sd-card/config/* ./remote_setup/config/ 2>/dev/null || true @@ -201,7 +202,7 @@ jobs: run: | rm -rf ./debug mkdir -p ./debug - + cp -f "./code/.pio/build/${{ matrix.plat }}/firmware.elf" "debug/firmware.elf" cp -f "./code/sdkconfig.${{ matrix.plat }}" "debug/sdkconfig.${{ matrix.plat }}" @@ -216,7 +217,7 @@ jobs: ## Create release - PART 2: Upload release related artifacts # # Artifacts will gets uploaded to newly created release tag. -######################################################################################### +######################################################################################### upload-release-artifacts: runs-on: ubuntu-latest needs: [prepare-release, build] @@ -238,19 +239,19 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ needs.prepare-release.outputs.tag_name }} - + - name: Set variables id: vars run: | echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT echo "branch=$(echo ${{ github.ref_name }} | tr / __)" >> $GITHUB_OUTPUT - + - name: Pull artifacts uses: actions/download-artifact@v4 - + - name: Prepare artifacts for release run: | - rm -rf release + rm -rf release mkdir -p release cd "AI-on-the-edge-device__update__${{ matrix.plat }}__SLFork_${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})" zip -r ../release/AI-on-the-edge-device__update__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * From ac928a911d343f8e59070b5f8d66f1450e5170b0 Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Sat, 20 Jul 2024 00:18:05 +0200 Subject: [PATCH 03/11] Update --- code/include/defines.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/include/defines.h b/code/include/defines.h index b57d7e710..7293b9e84 100644 --- a/code/include/defines.h +++ b/code/include/defines.h @@ -435,6 +435,8 @@ CONFIG_WPA_11R_SUPPORT=n #define GPIO_SDCARD_CLK GPIO_NUM_7 #define GPIO_SDCARD_CMD GPIO_NUM_9 #define GPIO_SDCARD_D0 GPIO_NUM_8 + #define GPIO_SDCARD_D1 GPIO_NUM_NC + #define GPIO_SDCARD_D2 GPIO_NUM_NC #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 @@ -498,6 +500,9 @@ CONFIG_WPA_11R_SUPPORT=n #define GPIO_SDCARD_CLK GPIO_NUM_39 #define GPIO_SDCARD_CMD GPIO_NUM_38 #define GPIO_SDCARD_D0 GPIO_NUM_40 + #define GPIO_SDCARD_D1 GPIO_NUM_NC + #define GPIO_SDCARD_D2 GPIO_NUM_NC + #define GPIO_SDCARD_D3 GPIO_NUM_NC // LEDs From 8236d29fbd1104e612feaa9d80e072edf65af7c5 Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Sat, 20 Jul 2024 00:39:06 +0200 Subject: [PATCH 04/11] Update sdkconfig --- .../sdkconfig.freenove-esp32s3-debug.defaults | 33 +++++++++++++ ...ig.freenove-esp32s3-task-analysis.defaults | 16 +++++++ code/sdkconfig.freenove-esp32s3.defaults | 46 +++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 code/sdkconfig.freenove-esp32s3-debug.defaults create mode 100644 code/sdkconfig.freenove-esp32s3-task-analysis.defaults create mode 100644 code/sdkconfig.freenove-esp32s3.defaults diff --git a/code/sdkconfig.freenove-esp32s3-debug.defaults b/code/sdkconfig.freenove-esp32s3-debug.defaults new file mode 100644 index 000000000..b7fe751c2 --- /dev/null +++ b/code/sdkconfig.freenove-esp32s3-debug.defaults @@ -0,0 +1,33 @@ +# +# Bootloader config +# +CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y +CONFIG_BOOTLOADER_LOG_LEVEL=2 +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=n + + +# +# LWIP +# +CONFIG_LWIP_ESP_LWIP_ASSERT=y + + +# +# Hardware Abstraction Layer (HAL) and Low Level (LL) +# +CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y + + +# +# Log output +# +CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y + + +# +# Common ESP-related +# +CONFIG_ESP_ERR_TO_NAME_LOOKUP=y +CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y diff --git a/code/sdkconfig.freenove-esp32s3-task-analysis.defaults b/code/sdkconfig.freenove-esp32s3-task-analysis.defaults new file mode 100644 index 000000000..38463b99f --- /dev/null +++ b/code/sdkconfig.freenove-esp32s3-task-analysis.defaults @@ -0,0 +1,16 @@ +# +# FreeRTOS Kernel +# +CONFIG_FREERTOS_USE_TRACE_FACILITY=1 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y + + +# +# Heap memory debugging +# +CONFIG_HEAP_TRACING_STANDALONE=y +# CONFIG_HEAP_POISONING_LIGHT=y +# CONFIG_HEAP_TASK_TRACKING=y +# CONFIG_HEAP_POISONING_COMPREHENSIVE=y + diff --git a/code/sdkconfig.freenove-esp32s3.defaults b/code/sdkconfig.freenove-esp32s3.defaults new file mode 100644 index 000000000..373e22fce --- /dev/null +++ b/code/sdkconfig.freenove-esp32s3.defaults @@ -0,0 +1,46 @@ +################################################## +# Application and board specific configuration +# Edit this file instead of sdkconfig.{board_type}! +# After editing make sure to explicitly delete +# sdkconfig.{board_type} to apply your changes! +################################################## + +# +# Serial flasher config +# +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="16MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y + + +# +# Partition Table +# +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_OFFSET=0x8000 +CONFIG_PARTITION_TABLE_MD5=y + + +# +# Common ESP-related +# +CONFIG_ESP_ERR_TO_NAME_LOOKUP=n +CONFIG_ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY=n + + +# +# SPI RAM config +# +CONFIG_SPIRAM_SIZE=-1 +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_USE_MALLOC=y +CONFIG_SPIRAM_MEMTEST=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=8192 +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=131072 +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=n +CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=n From 4ec60b7c74222a690d56c9af99f68e771b384ffc Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Sat, 20 Jul 2024 01:13:48 +0200 Subject: [PATCH 05/11] Update status led --> active high --- .../ClassControllCamera.cpp | 7 ++++++ code/components/jomjol_helper/statusled.cpp | 24 +++++++++++++++++++ code/include/defines.h | 9 ++++--- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/code/components/jomjol_controlcamera/ClassControllCamera.cpp b/code/components/jomjol_controlcamera/ClassControllCamera.cpp index 8b325d0cc..5aee2ddda 100644 --- a/code/components/jomjol_controlcamera/ClassControllCamera.cpp +++ b/code/components/jomjol_controlcamera/ClassControllCamera.cpp @@ -963,10 +963,17 @@ void CCamera::setStatusLED(bool _status) /* Set the GPIO as a push/pull output */ gpio_set_direction(GPIO_STATUS_LED_ONBOARD, GPIO_MODE_OUTPUT); +#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW if (!_status) gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); else gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); +#else + if (_status) + gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); + else + gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); +#endif } } diff --git a/code/components/jomjol_helper/statusled.cpp b/code/components/jomjol_helper/statusled.cpp index 5f8e7c87a..5d97db1df 100644 --- a/code/components/jomjol_helper/statusled.cpp +++ b/code/components/jomjol_helper/statusled.cpp @@ -25,7 +25,11 @@ void task_StatusLED(void *pvParameter) esp_rom_gpio_pad_select_gpio(GPIO_STATUS_LED_ONBOARD); // Init the GPIO gpio_set_direction(GPIO_STATUS_LED_ONBOARD, GPIO_MODE_OUTPUT); // Set the GPIO as a push/pull output +#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1);// LED off +#else + gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0);// LED off +#endif for (int i=0; i<2; ) // Default: repeat 2 times { @@ -34,9 +38,17 @@ void task_StatusLED(void *pvParameter) for (int j = 0; j < StatusLEDDataInt.iSourceBlinkCnt; ++j) { +#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); +#else + gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); +#endif vTaskDelay(StatusLEDDataInt.iBlinkTime / portTICK_PERIOD_MS); +#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); +#else + gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); +#endif vTaskDelay(StatusLEDDataInt.iBlinkTime / portTICK_PERIOD_MS); } @@ -44,9 +56,17 @@ void task_StatusLED(void *pvParameter) for (int j = 0; j < StatusLEDDataInt.iCodeBlinkCnt; ++j) { +#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); +#else + gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); +#endif vTaskDelay(StatusLEDDataInt.iBlinkTime / portTICK_PERIOD_MS); +#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); +#else + gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); +#endif vTaskDelay(StatusLEDDataInt.iBlinkTime / portTICK_PERIOD_MS); } vTaskDelay(1500 / portTICK_PERIOD_MS); // Delay to signal new round @@ -147,5 +167,9 @@ void StatusLEDOff(void) esp_rom_gpio_pad_select_gpio(GPIO_STATUS_LED_ONBOARD); // Init the GPIO gpio_set_direction(GPIO_STATUS_LED_ONBOARD, GPIO_MODE_OUTPUT); // Set the GPIO as a push/pull output +#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1);// LED off +#else + gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0);// LED off +#endif } \ No newline at end of file diff --git a/code/include/defines.h b/code/include/defines.h index 7293b9e84..55f8173cc 100644 --- a/code/include/defines.h +++ b/code/include/defines.h @@ -365,7 +365,8 @@ CONFIG_WPA_11R_SUPPORT=n // LEDs //------------------------------------------------- - #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_33 // Onboard red status LED + #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_33 // Onboard status LED (red, active low) + #define GPIO_STATUS_LED_ONBOARD_ACTIVELOW #define GPIO_FLASHLIGHT_ONBOARD GPIO_NUM_4 // Onboard flashlight LED #ifdef BOARD_SDCARD_SDMMC_BUS_WIDTH_1 @@ -442,7 +443,8 @@ CONFIG_WPA_11R_SUPPORT=n // LEDs //------------------------------------------------- - #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_21 // Onboard yellow status LED (USER LED) + #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_21 // Onboard yellow status LED (USER LED, yellow, active low) + #define GPIO_STATUS_LED_ONBOARD_ACTIVELOW #define GPIO_FLASHLIGHT_ONBOARD GPIO_NUM_NC // No onboard flashlight available #define GPIO_FLASHLIGHT_DEFAULT GPIO_NUM_1 // Default flashlight GPIO pin (can be modified by activiating GPIO functionality in WebUI) @@ -507,7 +509,8 @@ CONFIG_WPA_11R_SUPPORT=n // LEDs //------------------------------------------------- - #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_2 // Onboard status LED + #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_2 // Onboard status LED (blue, active high) + //#define GPIO_STATUS_LED_ONBOARD_ACTIVELOW #define GPIO_FLASHLIGHT_ONBOARD GPIO_NUM_48 // Onboard flashlight (WS2812) #define GPIO_FLASHLIGHT_DEFAULT GPIO_FLASHLIGHT_ONBOARD // Default flashlight GPIO pin (can be modified by activiating GPIO functionality in WebUI) From 1c5d9b7c9eedae3d927a1e9cd690cf0700af599f Mon Sep 17 00:00:00 2001 From: Slider0007 <115730895+Slider0007@users.noreply.github.com> Date: Sun, 21 Jul 2024 10:19:54 +0200 Subject: [PATCH 06/11] Update build action --- .github/workflows/build-release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index c1a0f6545..50d969a48 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -227,7 +227,8 @@ jobs: matrix: plat: - esp32cam - - esp32cam-debug + - xiao-esp32s3-sense + - freenove-esp32s3 # Sets permissions of the GITHUB_TOKEN to allow downloading artifacts permissions: From d0c6b5d471cc2a8dbf5b3c405ff792214488a96a Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Sun, 21 Jul 2024 20:31:15 +0200 Subject: [PATCH 07/11] Update --- .../jomjol_controlcamera/ClassControllCamera.cpp | 2 +- code/components/jomjol_helper/statusled.cpp | 12 ++++++------ code/include/defines.h | 11 ++++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/code/components/jomjol_controlcamera/ClassControllCamera.cpp b/code/components/jomjol_controlcamera/ClassControllCamera.cpp index 5aee2ddda..0b2f4fbf2 100644 --- a/code/components/jomjol_controlcamera/ClassControllCamera.cpp +++ b/code/components/jomjol_controlcamera/ClassControllCamera.cpp @@ -963,7 +963,7 @@ void CCamera::setStatusLED(bool _status) /* Set the GPIO as a push/pull output */ gpio_set_direction(GPIO_STATUS_LED_ONBOARD, GPIO_MODE_OUTPUT); -#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW +#ifdef GPIO_STATUS_LED_ONBOARD_LOWACTIVE if (!_status) gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); else diff --git a/code/components/jomjol_helper/statusled.cpp b/code/components/jomjol_helper/statusled.cpp index 5d97db1df..617d8cb5d 100644 --- a/code/components/jomjol_helper/statusled.cpp +++ b/code/components/jomjol_helper/statusled.cpp @@ -25,7 +25,7 @@ void task_StatusLED(void *pvParameter) esp_rom_gpio_pad_select_gpio(GPIO_STATUS_LED_ONBOARD); // Init the GPIO gpio_set_direction(GPIO_STATUS_LED_ONBOARD, GPIO_MODE_OUTPUT); // Set the GPIO as a push/pull output -#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW +#ifdef GPIO_STATUS_LED_ONBOARD_LOWACTIVE gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1);// LED off #else gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0);// LED off @@ -38,13 +38,13 @@ void task_StatusLED(void *pvParameter) for (int j = 0; j < StatusLEDDataInt.iSourceBlinkCnt; ++j) { -#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW +#ifdef GPIO_STATUS_LED_ONBOARD_LOWACTIVE gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); #else gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); #endif vTaskDelay(StatusLEDDataInt.iBlinkTime / portTICK_PERIOD_MS); -#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW +#ifdef GPIO_STATUS_LED_ONBOARD_LOWACTIVE gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); #else gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); @@ -56,13 +56,13 @@ void task_StatusLED(void *pvParameter) for (int j = 0; j < StatusLEDDataInt.iCodeBlinkCnt; ++j) { -#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW +#ifdef GPIO_STATUS_LED_ONBOARD_LOWACTIVE gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); #else gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); #endif vTaskDelay(StatusLEDDataInt.iBlinkTime / portTICK_PERIOD_MS); -#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW +#ifdef GPIO_STATUS_LED_ONBOARD_LOWACTIVE gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1); #else gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0); @@ -167,7 +167,7 @@ void StatusLEDOff(void) esp_rom_gpio_pad_select_gpio(GPIO_STATUS_LED_ONBOARD); // Init the GPIO gpio_set_direction(GPIO_STATUS_LED_ONBOARD, GPIO_MODE_OUTPUT); // Set the GPIO as a push/pull output -#ifdef GPIO_STATUS_LED_ONBOARD_ACTIVELOW +#ifdef GPIO_STATUS_LED_ONBOARD_LOWACTIVE gpio_set_level(GPIO_STATUS_LED_ONBOARD, 1);// LED off #else gpio_set_level(GPIO_STATUS_LED_ONBOARD, 0);// LED off diff --git a/code/include/defines.h b/code/include/defines.h index 55f8173cc..2e55f81ca 100644 --- a/code/include/defines.h +++ b/code/include/defines.h @@ -366,7 +366,8 @@ CONFIG_WPA_11R_SUPPORT=n // LEDs //------------------------------------------------- #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_33 // Onboard status LED (red, active low) - #define GPIO_STATUS_LED_ONBOARD_ACTIVELOW + #define GPIO_STATUS_LED_ONBOARD_LOWACTIVE // Enable if status LED is low active + #define GPIO_FLASHLIGHT_ONBOARD GPIO_NUM_4 // Onboard flashlight LED #ifdef BOARD_SDCARD_SDMMC_BUS_WIDTH_1 @@ -444,9 +445,9 @@ CONFIG_WPA_11R_SUPPORT=n // LEDs //------------------------------------------------- #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_21 // Onboard yellow status LED (USER LED, yellow, active low) - #define GPIO_STATUS_LED_ONBOARD_ACTIVELOW - #define GPIO_FLASHLIGHT_ONBOARD GPIO_NUM_NC // No onboard flashlight available + #define GPIO_STATUS_LED_ONBOARD_LOWACTIVE // Enable if status LED is low active + #define GPIO_FLASHLIGHT_ONBOARD GPIO_NUM_NC // No onboard flashlight available #define GPIO_FLASHLIGHT_DEFAULT GPIO_NUM_1 // Default flashlight GPIO pin (can be modified by activiating GPIO functionality in WebUI) #define GPIO_FLASHLIGHT_DEFAULT_USE_PWM // Default flashlight LED is PWM controlled @@ -510,9 +511,9 @@ CONFIG_WPA_11R_SUPPORT=n // LEDs //------------------------------------------------- #define GPIO_STATUS_LED_ONBOARD GPIO_NUM_2 // Onboard status LED (blue, active high) - //#define GPIO_STATUS_LED_ONBOARD_ACTIVELOW - #define GPIO_FLASHLIGHT_ONBOARD GPIO_NUM_48 // Onboard flashlight (WS2812) + //#define GPIO_STATUS_LED_ONBOARD_LOWACTIVE // Enable if status LED is low active + #define GPIO_FLASHLIGHT_ONBOARD GPIO_NUM_48 // Onboard flashlight (WS2812) #define GPIO_FLASHLIGHT_DEFAULT GPIO_FLASHLIGHT_ONBOARD // Default flashlight GPIO pin (can be modified by activiating GPIO functionality in WebUI) //#define GPIO_FLASHLIGHT_DEFAULT_USE_PWM // Default flashlight LED is PWM controlled From a53179643993bfd8b1def0e5fdc9e000bce747d7 Mon Sep 17 00:00:00 2001 From: Slider0007 <115730895+Slider0007@users.noreply.github.com> Date: Thu, 15 Aug 2024 19:32:31 +0200 Subject: [PATCH 08/11] build action: add board specific subfolder --- .github/workflows/build-release.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 50d969a48..481c46fb9 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -255,16 +255,16 @@ jobs: rm -rf release mkdir -p release cd "AI-on-the-edge-device__update__${{ matrix.plat }}__SLFork_${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})" - zip -r ../release/AI-on-the-edge-device__update__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * + zip -r ../release/${{ matrix.plat }}/AI-on-the-edge-device__update__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * cd .. cd "AI-on-the-edge-device__manual-setup__${{ matrix.plat }}__SLFork_${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})" - zip -r ../release/AI-on-the-edge-device__manual-setup__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * + zip -r ../release/${{ matrix.plat }}/AI-on-the-edge-device__manual-setup__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * cd .. cd "AI-on-the-edge-device__remote-setup__${{ matrix.plat }}__SLFork_${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})" - zip -r ../release/AI-on-the-edge-device__remote-setup__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * + zip -r ../release/${{ matrix.plat }}/AI-on-the-edge-device__remote-setup__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * cd .. cd "AI-on-the-edge-device__debug-files__${{ matrix.plat }}__SLFork_${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})" - zip -r ../release/AI-on-the-edge-device__debug-files__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * + zip -r ../release/${{ matrix.plat }}/AI-on-the-edge-device__debug-files__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * cd .. - name: Upload artifacts to release tag From 73b0341f614f8a7cd6d9e8531db09539332e1e25 Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Fri, 27 Sep 2024 19:12:38 +0200 Subject: [PATCH 09/11] Rename board to ESP32S3-N16R8 --- .github/workflows/build-release.yaml | 12 +- README.md | 22 ++- code/.gitignore | 7 +- code/include/defines.h | 2 +- code/platformio.ini | 156 +----------------- code/sdkconfig.esp32cam-debug.defaults | 33 ---- code/sdkconfig.esp32cam-himem.defaults | 2 - .../sdkconfig.esp32cam-task-analysis.defaults | 15 -- .../sdkconfig.freenove-esp32s3-debug.defaults | 33 ---- ...sdkconfig.freenove-esp32s3-n16r8.defaults} | 0 ...ig.freenove-esp32s3-task-analysis.defaults | 16 -- ...dkconfig.xiao-esp32s3-sense-debug.defaults | 33 ---- ....xiao-esp32s3-sense-task-analysis.defaults | 16 -- 13 files changed, 27 insertions(+), 320 deletions(-) delete mode 100644 code/sdkconfig.esp32cam-debug.defaults delete mode 100644 code/sdkconfig.esp32cam-himem.defaults delete mode 100644 code/sdkconfig.esp32cam-task-analysis.defaults delete mode 100644 code/sdkconfig.freenove-esp32s3-debug.defaults rename code/{sdkconfig.freenove-esp32s3.defaults => sdkconfig.freenove-esp32s3-n16r8.defaults} (100%) delete mode 100644 code/sdkconfig.freenove-esp32s3-task-analysis.defaults delete mode 100644 code/sdkconfig.xiao-esp32s3-sense-debug.defaults delete mode 100644 code/sdkconfig.xiao-esp32s3-sense-task-analysis.defaults diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 481c46fb9..da8275611 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -41,7 +41,7 @@ jobs: plat: - esp32cam - xiao-esp32s3-sense - - freenove-esp32s3 + - freenove-esp32s3-n16r8 steps: - name: Checkout branch if: ${{ ! needs.prepare-release.outputs.release_created }} @@ -228,7 +228,7 @@ jobs: plat: - esp32cam - xiao-esp32s3-sense - - freenove-esp32s3 + - freenove-esp32s3-n16r8 # Sets permissions of the GITHUB_TOKEN to allow downloading artifacts permissions: @@ -255,16 +255,16 @@ jobs: rm -rf release mkdir -p release cd "AI-on-the-edge-device__update__${{ matrix.plat }}__SLFork_${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})" - zip -r ../release/${{ matrix.plat }}/AI-on-the-edge-device__update__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * + zip -r ../release/AI-on-the-edge-device__update__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * cd .. cd "AI-on-the-edge-device__manual-setup__${{ matrix.plat }}__SLFork_${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})" - zip -r ../release/${{ matrix.plat }}/AI-on-the-edge-device__manual-setup__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * + zip -r ../release/AI-on-the-edge-device__manual-setup__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * cd .. cd "AI-on-the-edge-device__remote-setup__${{ matrix.plat }}__SLFork_${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})" - zip -r ../release/${{ matrix.plat }}/AI-on-the-edge-device__remote-setup__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * + zip -r ../release/AI-on-the-edge-device__remote-setup__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * cd .. cd "AI-on-the-edge-device__debug-files__${{ matrix.plat }}__SLFork_${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})" - zip -r ../release/${{ matrix.plat }}/AI-on-the-edge-device__debug-files__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * + zip -r ../release/AI-on-the-edge-device__debug-files__${{ matrix.plat }}__SLFork_v${{ needs.prepare-release.outputs.version }}.zip * cd .. - name: Upload artifacts to release tag diff --git a/README.md b/README.md index 39c924f4c..fdfee00cb 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,18 @@ As a result, you get the digitized value of your meter. There are several option ## Supported Hardware +### Board + | Board Type | SOC | Firmware Release | Remarks -|:--- |:--- |:--- |:--- -| [ESP32-CAM](http://www.ai-thinker.com/pro_view-24.html) | ESP32 | All | - Only boards with >4MB RAM are supported
- Beware of inferior quality Chinese clones -| [XIAO ESP32 Sense](https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html) | ESP32S3 | $\ge$ v17.0.0 |- No onboard illumination: Separate illumination (PWM controlable LED / Intelligent LED) necessary
- Running quite hot, small heat sink recommended +|:--- |:--- |:--- |:--- +| [ESP32-CAM](http://www.ai-thinker.com/pro_view-24.html) | ESP32 | All | - Only boards with >4MB RAM are supported
- Beware of inferior quality Chinese clones +| [XIAO ESP32 Sense](https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html) | ESP32S3 | $\ge$ v17.0.0 |- No onboard illumination: Separate illumination (PWM controlable LED / Intelligent LED) necessary
- Running quite hot, small heat sink recommended +| [Freenove ESP32S3 WROOM](https://github.com/Freenove/Freenove_ESP32_S3_WROOM_Board) | ESP32S3 | $\ge$ v17.0.0 |- SOC and pin compatible Chinese clones supported + +### Camera +| Camera Type | Resolution | Firmware Release | Remarks +|:--- |:--- |:--- |:--- +| [OV2640](https://www.arducam.com/ov2640/) | 2MP (max. 1600x1200) | All | - Officially EOL since 2009, but still very popular
- Pin and function compatible Chinese clones are supported ## Device Installation @@ -68,8 +76,8 @@ A possibly already available development version (upcoming release version) can ### 3. Install MCU Part Of Firmware Initially the MCU of the device has to be flashed via a direct USB connection. Further updates can be performed directly over the air (OTA).
-For initial installation, use content of `AI-on-the-edge-device__manual-setup__{Board Type}__*.zip`.
-NOTE: OTA updates will be performed with `AI-on-the-edge-device__update__{Board Type}__*.zip` package. +For initial installation, use content of `AI-on-the-edge-device__manual-setup__{board type}__*.zip`.
+NOTE: OTA updates will be performed with `AI-on-the-edge-device__update__{board type}__*.zip` package. IMPORTANT: Make sure to use correct firmware package for your board type. @@ -81,9 +89,9 @@ See [documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/Installa Note: Installation using web installer is not supported by this forked repo. ### 4. Install SD Card Content -The SD card can be setup using the device's local WLAN hotspot after the MCU firmware got successfully installed (`AI-on-the-edge-device__remote-setup__*.zip`). See the +The SD card can be setup using the device's local WLAN hotspot after the MCU firmware got successfully installed (`AI-on-the-edge-device__remote-setup__{board type}__*.zip`). See the [documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/#remote-setup-using-the-built-in-access-point) for details. For this to work, the SD card must be FAT formated (which is the default on a new SD card).
-Alternatively the SD card still can be setup manually without using hotspot, see the [documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/#3-sd-card) for details (`AI-on-the-edge-device__manual-setup__*.zip`). +Alternatively the SD card still can be setup manually without using hotspot, see the [documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/#3-sd-card) for details (`AI-on-the-edge-device__manual-setup__{board type}__*.zip`). ⚠️ Do not use github source files in any case, use only release related zip package. Otherwise functionality cannot be fully guaranteed! diff --git a/code/.gitignore b/code/.gitignore index 463a19e9f..3f0dc8118 100644 --- a/code/.gitignore +++ b/code/.gitignore @@ -7,10 +7,5 @@ version.cpp dependencies.lock sdkconfig.esp32cam -sdkconfig.esp32cam-debug -sdkconfig.esp32cam-himem -sdkconfig.esp32cam-task-analysis -sdkconfig.esp32cam-localbuild sdkconfig.xiao-esp32s3-sense -sdkconfig.xiao-esp32s3-sense-debug -sdkconfig.xiao-esp32s3-sense-task-analysis +sdkconfig.freenove-esp32s3-n16r8 diff --git a/code/include/defines.h b/code/include/defines.h index 2e55f81ca..9f9ffde61 100644 --- a/code/include/defines.h +++ b/code/include/defines.h @@ -324,7 +324,7 @@ CONFIG_WPA_11R_SUPPORT=n #elif ENV_BOARD_TYPE == 3 #define BOARD_FREENOVE_ESP32S3 -#define BOARD_TYPE_NAME "Freenove-ESP32S3" // Keep Board type equal to main board environment name. +#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" diff --git a/code/platformio.ini b/code/platformio.ini index d43a2d050..40ca569b0 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -92,67 +92,6 @@ build_flags = -D ENV_BOARD_TYPE=1 -D ENV_CAMERA_MODEL=1 -; +++++++++++++++++++++++++++++++++++++++++++ -; Use this environment for task analysis (PR #1751) -; +++++++++++++++++++++++++++++++++++++++++++ -[env:esp32cam-task-analysis] -extends = env:esp32cam -; sdkconfig.esp32cam-task-analysis.defaults override some sdkconfig.defaults -; and enable debug analysis options -build_flags = - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=1 - -D ENV_CAMERA_MODEL=1 - ; ### Debug options : - -D TASK_ANALYSIS_ON - ;-D DEBUG_DETAIL_ON - ;please use only one HEAP tracing at time. - ;-D HEAP_TRACING_MAIN_WIFI - ;-D HEAP_TRACING_MAIN_START - ;-D HEAP_TRACING_CLASS_FLOW_CNN_GENERAL_DO_ALING_AND_CUT - - -; +++++++++++++++++++++++++++++++++++++++++++ -; Use this environment for detailed and deep debugging -; (default debugging is already possible with default environment) -; +++++++++++++++++++++++++++++++++++++++++++ -[env:esp32cam-debug] -extends = env:esp32cam -; sdkconfig.esp32cam-debug.defaults override some sdkconfig.defaults -; and enable debug options and clangtidy -build_flags = - ; ### clangtidy build flags: - ${flags:clangtidy.build_flags} - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=1 - -D ENV_CAMERA_MODEL=1 - ; ### Debug options : - -D DEBUG_DETAIL_ON - ;-D DEBUG_DISABLE_BROWNOUT_DETECTOR - ;-D DEBUG_ENABLE_PERFMON - ;-D DEBUG_HIMEM_MEMORY_CHECK -lib_ldf_mode = deep+ - - -; +++++++++++++++++++++++++++++++++++++++++++ -; Enable HIMEM support (8 MB SPIRAM boards) -; !!! RAM usage in HIMEM is not supported by firmware up to now !!! -; https://github.com/espressif/esp-idf/blob/master/examples/system/himem/README.md -; +++++++++++++++++++++++++++++++++++++++++++ -[env:esp32cam-himem] -extends = env:esp32cam -; sdkconfig.esp32cam-dev-himem.defaults override some sdkconfig.defaults -build_flags = - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=1 - -D ENV_CAMERA_MODEL=1 - ; ### Debug options : - ;-D DEBUG_HIMEM_MEMORY_CHECK - - ; ############################################################################# ; Board @@ -199,56 +138,12 @@ build_flags = -D ENV_BOARD_TYPE=2 -D ENV_CAMERA_MODEL=2 -; +++++++++++++++++++++++++++++++++++++++++++ -; Use this environment for task analysis (PR #1751) -; +++++++++++++++++++++++++++++++++++++++++++ -[env:xiao-esp32s3-sense-task-analysis] -extends = env:xiao-esp32s3-sense -; sdkconfig.xiao-esp32s3-sense-task-analysis.defaults override some sdkconfig.defaults -; and enable debug analysis options -build_flags = - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=2 - -D ENV_CAMERA_MODEL=2 - ; ### Debug options : - -D TASK_ANALYSIS_ON - ;-D DEBUG_DETAIL_ON - ;please use only one HEAP tracing at time. - ;-D HEAP_TRACING_MAIN_WIFI - ;-D HEAP_TRACING_MAIN_START - ;-D HEAP_TRACING_CLASS_FLOW_CNN_GENERAL_DO_ALING_AND_CUT - - -; +++++++++++++++++++++++++++++++++++++++++++ -; Use this environment for detailed and deep debugging -; (default debugging is already possible with default environment) -; +++++++++++++++++++++++++++++++++++++++++++ -[env:xiao-esp32s3-sense-debug] -extends = env:xiao-esp32s3-sense -; sdkconfig.xiao-esp32s3-sense-debug.defaults override some sdkconfig.defaults -; and enable debug options and clangtidy -build_flags = - ; ### clangtidy build flags: - ${flags:clangtidy.build_flags} - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=2 - -D ENV_CAMERA_MODEL=2 - ; ### Debug options : - -D DEBUG_DETAIL_ON - ;-D DEBUG_DISABLE_BROWNOUT_DETECTOR - ;-D DEBUG_ENABLE_PERFMON - ;-D DEBUG_HIMEM_MEMORY_CHECK -lib_ldf_mode = deep+ - - ; ############################################################################# ; Board -; FREENOVE ESP32S3-WROOM-1-N16R8 (and compatible) +; Freenove ESP32S3-WROOM-1-N16R8 (Freenove pin compatible clones) ; ############################################################################# -[env:freenove-esp32s3] +[env:freenove-esp32s3-n16r8] extends = common:esp32-idf board = 4d_systems_esp32s3_gen4_r8n16 framework = espidf @@ -276,8 +171,8 @@ monitor_filters = default, esp32_exception_decoder ; Include parameter tooltips to HTML parameter config file ; and hash to HTML files (caching) ; +++++++++++++++++++++++++++++++++++++++++++ -[env:freenove-esp32s3-localbuild] -extends = env:freenove-esp32s3 +[env:freenove-esp32s3-n16r8-localbuild] +extends = env:freenove-esp32s3-n16r8 extra_scripts = post:scripts/localbuild.py # Add parameter tooltips to HTML page # and hashes to all cached HTML files build_flags = @@ -288,46 +183,3 @@ build_flags = ; ### (see 'include/defines.h' for definitions) -D ENV_BOARD_TYPE=3 -D ENV_CAMERA_MODEL=3 - -; +++++++++++++++++++++++++++++++++++++++++++ -; Use this environment for task analysis (PR #1751) -; +++++++++++++++++++++++++++++++++++++++++++ -[env:freenove-esp32s3-task-analysis] -extends = env:freenove-esp32s3 -; sdkconfig.freenove-esp32s3-task-analysis.defaults override some sdkconfig.defaults -; and enable debug analysis options -build_flags = - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=3 - -D ENV_CAMERA_MODEL=3 - ; ### Debug options : - -D TASK_ANALYSIS_ON - ;-D DEBUG_DETAIL_ON - ;please use only one HEAP tracing at time. - ;-D HEAP_TRACING_MAIN_WIFI - ;-D HEAP_TRACING_MAIN_START - ;-D HEAP_TRACING_CLASS_FLOW_CNN_GENERAL_DO_ALING_AND_CUT - - -; +++++++++++++++++++++++++++++++++++++++++++ -; Use this environment for detailed and deep debugging -; (default debugging is already possible with default environment) -; +++++++++++++++++++++++++++++++++++++++++++ -[env:freenove-esp32s3-debug] -extends = env:freenove-esp32s3 -; sdkconfig.freenove-esp32s3-debug.defaults override some sdkconfig.defaults -; and enable debug options and clangtidy -build_flags = - ; ### clangtidy build flags: - ${flags:clangtidy.build_flags} - ; ### Hardware: Define board type + camera model - ; ### (see 'include/defines.h' for definitions) - -D ENV_BOARD_TYPE=3 - -D ENV_CAMERA_MODEL=3 - ; ### Debug options : - -D DEBUG_DETAIL_ON - ;-D DEBUG_DISABLE_BROWNOUT_DETECTOR - ;-D DEBUG_ENABLE_PERFMON - ;-D DEBUG_HIMEM_MEMORY_CHECK -lib_ldf_mode = deep+ diff --git a/code/sdkconfig.esp32cam-debug.defaults b/code/sdkconfig.esp32cam-debug.defaults deleted file mode 100644 index b7fe751c2..000000000 --- a/code/sdkconfig.esp32cam-debug.defaults +++ /dev/null @@ -1,33 +0,0 @@ -# -# Bootloader config -# -CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y -CONFIG_BOOTLOADER_LOG_LEVEL=2 -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 -CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=n - - -# -# LWIP -# -CONFIG_LWIP_ESP_LWIP_ASSERT=y - - -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y - - -# -# Log output -# -CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y - - -# -# Common ESP-related -# -CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y diff --git a/code/sdkconfig.esp32cam-himem.defaults b/code/sdkconfig.esp32cam-himem.defaults deleted file mode 100644 index a08ce236e..000000000 --- a/code/sdkconfig.esp32cam-himem.defaults +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SPIRAM_BANKSWITCH_ENABLE=y -CONFIG_SPIRAM_BANKSWITCH_RESERVE=4 diff --git a/code/sdkconfig.esp32cam-task-analysis.defaults b/code/sdkconfig.esp32cam-task-analysis.defaults deleted file mode 100644 index ceac8ef38..000000000 --- a/code/sdkconfig.esp32cam-task-analysis.defaults +++ /dev/null @@ -1,15 +0,0 @@ -# -# FreeRTOS Kernel -# -CONFIG_FREERTOS_USE_TRACE_FACILITY=1 -CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y -CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y - - -# -# Heap memory debugging -# -CONFIG_HEAP_TRACING_STANDALONE=y -# CONFIG_HEAP_POISONING_LIGHT=y -# CONFIG_HEAP_TASK_TRACKING=y -# CONFIG_HEAP_POISONING_COMPREHENSIVE=y diff --git a/code/sdkconfig.freenove-esp32s3-debug.defaults b/code/sdkconfig.freenove-esp32s3-debug.defaults deleted file mode 100644 index b7fe751c2..000000000 --- a/code/sdkconfig.freenove-esp32s3-debug.defaults +++ /dev/null @@ -1,33 +0,0 @@ -# -# Bootloader config -# -CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y -CONFIG_BOOTLOADER_LOG_LEVEL=2 -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 -CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=n - - -# -# LWIP -# -CONFIG_LWIP_ESP_LWIP_ASSERT=y - - -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y - - -# -# Log output -# -CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y - - -# -# Common ESP-related -# -CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y diff --git a/code/sdkconfig.freenove-esp32s3.defaults b/code/sdkconfig.freenove-esp32s3-n16r8.defaults similarity index 100% rename from code/sdkconfig.freenove-esp32s3.defaults rename to code/sdkconfig.freenove-esp32s3-n16r8.defaults diff --git a/code/sdkconfig.freenove-esp32s3-task-analysis.defaults b/code/sdkconfig.freenove-esp32s3-task-analysis.defaults deleted file mode 100644 index 38463b99f..000000000 --- a/code/sdkconfig.freenove-esp32s3-task-analysis.defaults +++ /dev/null @@ -1,16 +0,0 @@ -# -# FreeRTOS Kernel -# -CONFIG_FREERTOS_USE_TRACE_FACILITY=1 -CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y -CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y - - -# -# Heap memory debugging -# -CONFIG_HEAP_TRACING_STANDALONE=y -# CONFIG_HEAP_POISONING_LIGHT=y -# CONFIG_HEAP_TASK_TRACKING=y -# CONFIG_HEAP_POISONING_COMPREHENSIVE=y - diff --git a/code/sdkconfig.xiao-esp32s3-sense-debug.defaults b/code/sdkconfig.xiao-esp32s3-sense-debug.defaults deleted file mode 100644 index b7fe751c2..000000000 --- a/code/sdkconfig.xiao-esp32s3-sense-debug.defaults +++ /dev/null @@ -1,33 +0,0 @@ -# -# Bootloader config -# -CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y -CONFIG_BOOTLOADER_LOG_LEVEL=2 -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 -CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=n - - -# -# LWIP -# -CONFIG_LWIP_ESP_LWIP_ASSERT=y - - -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y - - -# -# Log output -# -CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y - - -# -# Common ESP-related -# -CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y diff --git a/code/sdkconfig.xiao-esp32s3-sense-task-analysis.defaults b/code/sdkconfig.xiao-esp32s3-sense-task-analysis.defaults deleted file mode 100644 index 38463b99f..000000000 --- a/code/sdkconfig.xiao-esp32s3-sense-task-analysis.defaults +++ /dev/null @@ -1,16 +0,0 @@ -# -# FreeRTOS Kernel -# -CONFIG_FREERTOS_USE_TRACE_FACILITY=1 -CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y -CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y - - -# -# Heap memory debugging -# -CONFIG_HEAP_TRACING_STANDALONE=y -# CONFIG_HEAP_POISONING_LIGHT=y -# CONFIG_HEAP_TASK_TRACKING=y -# CONFIG_HEAP_POISONING_COMPREHENSIVE=y - From 4b49e62117f656d1af0f47c9be6a6972734c6060 Mon Sep 17 00:00:00 2001 From: Slider0007 <115730895+Slider0007@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:26:57 +0200 Subject: [PATCH 10/11] Add freenove-esp32s3-n16r8 readme --- .../Firmware/freenove-esp32s3-n16r8.md | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 docs/Installation/Firmware/freenove-esp32s3-n16r8.md diff --git a/docs/Installation/Firmware/freenove-esp32s3-n16r8.md b/docs/Installation/Firmware/freenove-esp32s3-n16r8.md new file mode 100644 index 000000000..2b0935fc3 --- /dev/null +++ b/docs/Installation/Firmware/freenove-esp32s3-n16r8.md @@ -0,0 +1,49 @@ +# Firmware Installation (Freenove ESP32S3) + +## Manual Firmware Installation / Manual Firmware Update + + ### 1. Flash microcontroller content (ESP32S3 based microcontroller) + + - Put your board into bootloader mode (IO0 grounded + board reset) + - Three files to be flashed with correct flash offset + + | Filename | Offset | Description + |:------------------|:------------|:------ + | bootloader.bin | 0x0 | Bootloader + | partitions.bin | 0x8000 | Partition definition + | firmware.bin | 0x10000 | User application + + - Use `Flash Download Tool` from Espressif or the console-based `esptool` to flash the files. + Usage is described [here](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/#flashing-using-the-flash-tool-from-espressif-gui). + + + ### 2. Prepare SD Card + - Format SD card with FAT32 (Windows recommenend. In MacOS formated cards could not working properly) + - Copy folders `/config` and `/html` from zip file to SD card root folder + + + ### 3. Configure WLAN + + #### Option 1: Modify content directly in config file + Use config.json template from `sdcard/config/template` folder, copy it to + `sdcard/config` folder and to configure your wlan connection.
+ Note 1: If device is already booted once, a full config with default configuration is already sitting in `/config` folder. + You can also use this file, search for section network and adapt the wlan config there. + Note 2: Be careful with syntax. Messing up the JSON notation, config is getting rejected. + + #### Option 2: Use Access Point feature + Usage is decribed [here](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/#remote-setup-using-the-built-in-access-point). + + + +## Web-based Firmware Installer + + --> Not supported up to now. + + + +## OTA (Over-The-Air) Firmware Update + + Select firmware package zip from github repository in WebUI OTA Updater page. + The device is getting updated automatically. The existing configuration will not be overwritten. + From 0948eb9b71d0a32a40fc9ae675db16e179d09dbd Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Fri, 11 Oct 2024 13:49:53 +0200 Subject: [PATCH 11/11] 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