Enable configuring target variants (#7019)

This change enables picking the right board configuration from the
variants/ folder. Previously, we would always pick the default
configuration (e.g., "esp32" instead of "heltec_wifi_lora_32_V2").
This commit is contained in:
Dr. Christian Kohlschütter 2022-08-22 13:16:38 +02:00 committed by GitHub
parent fe1d9e00d5
commit 4146d27b8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -168,7 +168,7 @@ set(BLE_SRCS
) )
set(includedirs set(includedirs
variants/${IDF_TARGET}/ variants/${CONFIG_ARDUINO_VARIANT}/
cores/esp32/ cores/esp32/
libraries/ArduinoOTA/src libraries/ArduinoOTA/src
libraries/AsyncUDP/src libraries/AsyncUDP/src
@ -210,13 +210,13 @@ set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl b
idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})
string(TOUPPER ${CONFIG_IDF_TARGET} idf_target_caps) string(TOUPPER ${CONFIG_ARDUINO_VARIANT} idf_target_caps)
target_compile_options(${COMPONENT_TARGET} PUBLIC target_compile_options(${COMPONENT_TARGET} PUBLIC
-DARDUINO=10812 -DARDUINO=10812
-DARDUINO_${idf_target_caps}_DEV -DARDUINO_${idf_target_caps}_DEV
-DARDUINO_ARCH_ESP32 -DARDUINO_ARCH_ESP32
-DARDUINO_BOARD="${idf_target_caps}_DEV" -DARDUINO_BOARD="${idf_target_caps}_DEV"
-DARDUINO_VARIANT="${CONFIG_IDF_TARGET}" -DARDUINO_VARIANT="${CONFIG_ARDUINO_VARIANT}"
-DESP32) -DESP32)
if(CONFIG_AUTOSTART_ARDUINO) if(CONFIG_AUTOSTART_ARDUINO)

View file

@ -1,5 +1,14 @@
menu "Arduino Configuration" menu "Arduino Configuration"
config ARDUINO_VARIANT
string "Arduino target variant (board)"
default IDF_TARGET
help
The name of a target variant (e.g., a specific board) in the variants/
folder, e.g. "heltec_wifi_lora_32_V2". The name is case sensitive.
Specifying a variant name different from the target enables additional
customization, for example the definition of GPIO pins.
config ENABLE_ARDUINO_DEPENDS config ENABLE_ARDUINO_DEPENDS
bool bool
select LWIP_SO_RCVBUF select LWIP_SO_RCVBUF