Procházet zdrojové kódy

feat(esp32p4): base idf_as_lib support

Armando před 2 roky
rodič
revize
5bd644942a

+ 1 - 1
examples/build_system/cmake/idf_as_lib/CMakeLists.txt

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
 
 project(idf_as_lib C)
 
-set(targets "esp32" "esp32s2" "esp32s3" "esp32c3" "esp32c2" "esp32c6" "esp32h2")
+set(targets "esp32" "esp32s2" "esp32s3" "esp32c3" "esp32c2" "esp32c6" "esp32h2" "esp32p4")
 
 if("${TARGET}" IN_LIST targets)
     # Include for ESP-IDF build system functions

+ 17 - 0
examples/build_system/cmake/idf_as_lib/build-esp32p4.sh

@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+PARAM=""
+
+# Retrive the target from the current filename, if no target specified,
+# the variable will be empty
+TARGET=$(echo $0 | cut -s -f2 -d- | cut -s -f1 -d.)
+if [[ -n $TARGET ]]
+then
+    # Target is not null, specify the build parameters
+    PARAM="-DCMAKE_TOOLCHAIN_FILE=$IDF_PATH/tools/cmake/toolchain-${TARGET}.cmake -DTARGET=${TARGET} -GNinja"
+fi
+
+rm -rf build && mkdir build && cd build
+cmake .. $PARAM
+cmake --build .

+ 4 - 0
examples/build_system/cmake/idf_as_lib/run-esp32p4.sh

@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+cd build
+python $IDF_PATH/components/esptool_py/esptool/esptool.py -p $1 write_flash @flash_project_args
+python -m esp_idf_monitor -p $1 idf_as_lib.elf