Skip to content

Commit 158a9b7

Browse files
committed
add option to configure board
1 parent 8343519 commit 158a9b7

File tree

6 files changed

+102
-0
lines changed

6 files changed

+102
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,35 @@ The default configuration for ESP32-S3-BOX.
66

77
For ESP32-S3-BOX-3 or M5Stack-CoreS3 - uncomment BSP in `idf_component.yml`
88

9+
## Selected board
10+
11+
The project is by default configured for ESP32-S3-BOX-3. In case of different board please run one of following exports and then CMake command:
12+
13+
- ESP32-S3-BOX-3
14+
```shell
15+
export SDKCONFIG_DEFAULTS=sdkconfig.defaults.esp-box-3
16+
```
17+
18+
- ESP32-S3-BOX (prior Dec. 2023)
19+
```shell
20+
export SDKCONFIG_DEFAULTS=sdkconfig.defaults.esp-box
21+
```
22+
23+
- ESP32-P4
24+
```shell
25+
export SDKCONFIG_DEFAULTS=sdkconfig.defaults.esp32_p4_function_ev_board
26+
```
27+
28+
- M5Stack-CoreS3
29+
```shell
30+
export SDKCONFIG_DEFAULTS=sdkconfig.defaults.m5stack_core_s3
31+
```
32+
33+
Finish the configuration (copy of proper idf_component.yml to main):
34+
35+
```shell
36+
cmake -P SelectBoard.cmake
37+
```
938

1039
## Quick start
1140

SelectBoard.cmake

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Check if SDKCONFIG_DEFAULTS is set
2+
if(NOT DEFINED ENV{SDKCONFIG_DEFAULTS})
3+
message(FATAL_ERROR "Environment variable SDKCONFIG_DEFAULTS is not set.")
4+
else()
5+
set(SDKCONFIG_DEFAULTS $ENV{SDKCONFIG_DEFAULTS})
6+
endif()
7+
8+
message(STATUS "Using SDKCONFIG_DEFAULTS: ${SDKCONFIG_DEFAULTS}")
9+
10+
# Map SDKCONFIG_DEFAULTS to the corresponding idf_component.yml template
11+
if(SDKCONFIG_DEFAULTS STREQUAL "sdkconfig.defaults.esp-box")
12+
set(IDF_COMPONENT_YML_TEMPLATE "${CMAKE_SOURCE_DIR}/idf_component_templates/esp-box.yml")
13+
elseif(SDKCONFIG_DEFAULTS STREQUAL "sdkconfig.defaults.esp-box-3")
14+
set(IDF_COMPONENT_YML_TEMPLATE "${CMAKE_SOURCE_DIR}/idf_component_templates/esp-box-3.yml")
15+
elseif(SDKCONFIG_DEFAULTS STREQUAL "sdkconfig.defaults.m5stack_core_s3")
16+
set(IDF_COMPONENT_YML_TEMPLATE "${CMAKE_SOURCE_DIR}/idf_component_templates/m5stack_core_s3.yml")
17+
elseif(SDKCONFIG_DEFAULTS STREQUAL "sdkconfig.defaults.esp32_p4_function_ev_board")
18+
set(IDF_COMPONENT_YML_TEMPLATE "${CMAKE_SOURCE_DIR}/idf_component_templates/esp32_p4_function_ev_board.yml")
19+
else()
20+
message(FATAL_ERROR "Unsupported SDKCONFIG_DEFAULTS: ${SDKCONFIG_DEFAULTS}")
21+
endif()
22+
23+
message(STATUS "IDF_COMPONENT_YML_TEMPLATE: ${IDF_COMPONENT_YML_TEMPLATE}")
24+
25+
# Destination path
26+
set(IDF_COMPONENT_YML_DEST "${CMAKE_SOURCE_DIR}/main/idf_component.yml")
27+
28+
message(STATUS "Copying ${IDF_COMPONENT_YML_TEMPLATE} to ${IDF_COMPONENT_YML_DEST}")
29+
30+
# Copy the appropriate idf_component.yml template
31+
configure_file(${IDF_COMPONENT_YML_TEMPLATE} ${IDF_COMPONENT_YML_DEST} COPYONLY)
32+
33+
# Verify that the file was copied
34+
if(EXISTS ${IDF_COMPONENT_YML_DEST})
35+
message(STATUS "File copied successfully to ${IDF_COMPONENT_YML_DEST}")
36+
else()
37+
message(FATAL_ERROR "Failed to copy ${IDF_COMPONENT_YML_TEMPLATE} to ${IDF_COMPONENT_YML_DEST}")
38+
endif()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
description: ESP32 Graphical Bootloader
2+
3+
dependencies:
4+
espressif/esp-box-3: "^1.2.0"
5+
# Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver
6+
esp_codec_dev:
7+
public: true
8+
version: "==1.1.0"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
description: ESP32 Graphical Bootloader
2+
3+
dependencies:
4+
espressif/esp-box: "^3.1.0"
5+
# Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver
6+
esp_codec_dev:
7+
public: true
8+
version: "==1.1.0"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
description: ESP32 Graphical Bootloader
2+
3+
dependencies:
4+
espressif/esp32_p4_function_ev_board: "^2.0.0"
5+
#espressif/esp-box-3: "^1.2.0"
6+
# Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver
7+
# esp_codec_dev:
8+
# public: true
9+
# version: "==1.1.0"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
description: ESP32 Graphical Bootloader
2+
3+
dependencies:
4+
# espressif/esp-box-3: "^1.2.0"
5+
# Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver
6+
esp_codec_dev:
7+
public: true
8+
version: "==1.1.0"
9+
m5stack_core_s3:
10+
version: "^1.0.0"

0 commit comments

Comments
 (0)