Skip to content

Commit d4ce717

Browse files
committed
esp32: Customise ULP module inclusion.
Add the ability to disable the built in ULP module using mpconfigport.h Add the ability to compile custom ULP image into the build by defining the cmake variables: ulp_app_name ulp_sources ulp_exp_dep_srcs Signed-off-by: Damian Nowacki (purewack) <bobimaster15@gmail.com>
1 parent 1360584 commit d4ce717

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

ports/esp32/esp32_common.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ idf_component_register(
202202
${IDF_COMPONENTS}
203203
)
204204

205+
# If a ULP binary image is to be embedded into the build, you can define the
206+
# appropriate variables to have ESP-IDF build it for your board using your
207+
# mpconfigboard.cmake
208+
if(DEFINED ulp_app_name)
209+
message("ULP embedded APP: ${ulp_app_name} ${ulp_sources} ${ulp_exp_dep_srcs}")
210+
ulp_embed_binary(${ulp_app_name} "${ulp_sources}" "${ulp_exp_dep_srcs}")
211+
endif()
212+
205213
# Set the MicroPython target as the current (main) IDF component target.
206214
set(MICROPY_TARGET ${COMPONENT_TARGET})
207215

ports/esp32/esp32_ulp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "py/runtime.h"
2828

29-
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
29+
#if MICROPY_PY_ULP && (CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3)
3030

3131
#if CONFIG_IDF_TARGET_ESP32
3232
#include "esp32/ulp.h"
@@ -104,4 +104,4 @@ MP_DEFINE_CONST_OBJ_TYPE(
104104
locals_dict, &esp32_ulp_locals_dict
105105
);
106106

107-
#endif // CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
107+
#endif // MICROPY_PY_ULP && (CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3)

ports/esp32/modesp32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static const mp_rom_map_elem_t esp32_module_globals_table[] = {
232232
{ MP_ROM_QSTR(MP_QSTR_NVS), MP_ROM_PTR(&esp32_nvs_type) },
233233
{ MP_ROM_QSTR(MP_QSTR_Partition), MP_ROM_PTR(&esp32_partition_type) },
234234
{ MP_ROM_QSTR(MP_QSTR_RMT), MP_ROM_PTR(&esp32_rmt_type) },
235-
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
235+
#if MICROPY_PY_ULP && (CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3)
236236
{ MP_ROM_QSTR(MP_QSTR_ULP), MP_ROM_PTR(&esp32_ulp_type) },
237237
#endif
238238

ports/esp32/mpconfigport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
#define MICROPY_GC_SPLIT_HEAP_AUTO (1)
8888

8989
// extended modules
90+
#ifndef MICROPY_PY_ULP
91+
#define MICROPY_PY_ULP (1)
92+
#endif
9093
#ifndef MICROPY_PY_ESPNOW
9194
#define MICROPY_PY_ESPNOW (1)
9295
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy