Skip to content

Commit 2d97d85

Browse files
committed
Update to micropython 1.24.1
This requires handling the following upstream commits: decf8e6a8b all: Remove the "STATIC" macro and just use "static" instead. 27279e69b4 esp32: Add IDF-version-specific sdkconfig. and, importantly acbdbcd95e esp32: Workaround IDF issue placing ISR ringbuf functions in IRAM Replacing STATIC was easy. Adding the IDF version specific was just implemented as upstream. However, the new linker.lf files are not in a path that is being searched properly. I believe this can only be fixed in micropython itself by providing a better file reference. The suggested upstream fix is available here: micropython/micropython#16658 and is _required_ for this patch. Signed-off-by: Karl Palsson <[email protected]>
1 parent 6c3dcb1 commit 2d97d85

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

boards/CUSTOM_ESP32/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ endforeach()
2525
configure_file(${CMAKE_BINARY_DIR}/sdkconfig.combined.in ${CMAKE_BINARY_DIR}/sdkconfig.combined COPYONLY)
2626
set(SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR}/sdkconfig.combined)
2727

28+
# Use the default linker fragments unless you need otherwise
29+
set(MICROPY_USER_LDFRAGMENTS ${MICROPY_PORT_DIR}/main_${IDF_TARGET}/linker.lf)
30+
2831
# Include main IDF cmake file and define the project.
2932
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
3033
project(micropython)

boards/CUSTOM_ESP32/mpconfigboard.cmake

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ set(SDKCONFIG_DEFAULTS
66
${MICROPY_PORT_DIR}/boards/sdkconfig.base
77
${MICROPY_PORT_DIR}/boards/sdkconfig.ble
88
)
9+
include($ENV{IDF_PATH}/tools/cmake/version.cmake)
10+
set(IDF_VERSION "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")
11+
12+
if (IDF_VERSION VERSION_GREATER_EQUAL "5.2.0")
13+
list(APPEND SDKCONFIG_DEFAULTS ${MICROPY_PORT_DIR}/boards/sdkconfig.idf52)
14+
message(STATUS "Adding the SDK config, final list is: ${SDKCONFIG_DEFAULTS}")
15+
endif()
16+
917

1018
# Set the user C modules to include in the build.
1119
set(USER_C_MODULES

lib/micropython

src/cmodules/cexample/modcexample.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "py/runtime.h"
33

44
// This is the function which will be called from Python as cexample.add_ints(a, b).
5-
STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) {
5+
static mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) {
66
// Extract the ints from the micropython input objects.
77
int a = mp_obj_get_int(a_obj);
88
int b = mp_obj_get_int(b_obj);
@@ -11,18 +11,18 @@ STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) {
1111
return mp_obj_new_int(a + b);
1212
}
1313
// Define a Python reference to the function above.
14-
STATIC MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints);
14+
static MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints);
1515

1616
// Define all properties of the module.
1717
// Table entries are key/value pairs of the attribute name (a string)
1818
// and the MicroPython object reference.
1919
// All identifiers and strings are written as MP_QSTR_xxx and will be
2020
// optimized to word-sized integers by the build system (interned strings).
21-
STATIC const mp_rom_map_elem_t example_module_globals_table[] = {
21+
static const mp_rom_map_elem_t example_module_globals_table[] = {
2222
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cexample) },
2323
{ MP_ROM_QSTR(MP_QSTR_add_ints), MP_ROM_PTR(&example_add_ints_obj) },
2424
};
25-
STATIC MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table);
25+
static MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table);
2626

2727
// Define module object.
2828
const mp_obj_module_t example_user_cmodule = {

src/cmodules/cexample2/modcexample2.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#include "py/runtime.h"
22

3-
STATIC mp_obj_t example_sub_ints(mp_obj_t a_obj, mp_obj_t b_obj) {
3+
static mp_obj_t example_sub_ints(mp_obj_t a_obj, mp_obj_t b_obj) {
44
int a = mp_obj_get_int(a_obj);
55
int b = mp_obj_get_int(b_obj);
66
return mp_obj_new_int(a - b);
77
}
8-
STATIC MP_DEFINE_CONST_FUN_OBJ_2(example_sub_ints_obj, example_sub_ints);
8+
static MP_DEFINE_CONST_FUN_OBJ_2(example_sub_ints_obj, example_sub_ints);
99

10-
STATIC const mp_rom_map_elem_t example_module_globals_table[] = {
10+
static const mp_rom_map_elem_t example_module_globals_table[] = {
1111
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cexample2) },
1212
{ MP_ROM_QSTR(MP_QSTR_sub_ints), MP_ROM_PTR(&example_sub_ints_obj) },
1313
};
14-
STATIC MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table);
14+
static MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table);
1515

1616
const mp_obj_module_t example_user_cmodule2 = {
1717
.base = { &mp_type_module },

0 commit comments

Comments
 (0)