File tree Expand file tree Collapse file tree 5 files changed +31
-13
lines changed Expand file tree Collapse file tree 5 files changed +31
-13
lines changed Original file line number Diff line number Diff line change @@ -18,12 +18,22 @@ if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigboard.cmake)
18
18
message (FATAL_ERROR "Invalid MICROPY_BOARD specified: ${MICROPY_BOARD} " )
19
19
endif ()
20
20
21
+ # Include main IDF cmake file.
22
+ include ($ENV{IDF_PATH} /tools/cmake/project.cmake )
23
+
21
24
# Define the output sdkconfig so it goes in the build directory.
22
25
set (SDKCONFIG ${CMAKE_BINARY_DIR} /sdkconfig )
23
26
24
27
# Include board config; this is expected to set SDKCONFIG_DEFAULTS (among other options).
25
28
include (${MICROPY_BOARD_DIR} /mpconfigboard.cmake )
26
29
30
+ # Add sdkconfig fragments that depend on the IDF version.
31
+ if (IDF_VERSION_MAJOR EQUAL 4 AND IDF_VERSION_MINOR LESS 2 )
32
+ set (SDKCONFIG_DEFAULTS ${SDKCONFIG_DEFAULTS} boards/sdkconfig.nimble_core0 )
33
+ else ()
34
+ set (SDKCONFIG_DEFAULTS ${SDKCONFIG_DEFAULTS} boards/sdkconfig.nimble_core1 )
35
+ endif ()
36
+
27
37
# Concatenate all sdkconfig files into a combined one for the IDF to use.
28
38
file (WRITE ${CMAKE_BINARY_DIR} /sdkconfig.combined.in "" )
29
39
foreach (SDKCONFIG_DEFAULT ${SDKCONFIG_DEFAULTS} )
@@ -33,6 +43,5 @@ endforeach()
33
43
configure_file (${CMAKE_BINARY_DIR} /sdkconfig.combined.in ${CMAKE_BINARY_DIR} /sdkconfig.combined COPYONLY )
34
44
set (SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR} /sdkconfig.combined )
35
45
36
- # Include main IDF cmake file and define the project.
37
- include ($ENV{IDF_PATH} /tools/cmake/project.cmake )
46
+ # Define the project.
38
47
project (micropython )
Original file line number Diff line number Diff line change @@ -7,11 +7,3 @@ CONFIG_BTDM_CTRL_MODE_BTDM=
7
7
CONFIG_BT_NIMBLE_ENABLED=y
8
8
9
9
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
10
-
11
- # Pin to the same core as MP.
12
- # Until we move to IDF 4.2+, we need NimBLE on core 0, and for synchronisation
13
- # with the ringbuffer and scheduler MP needs to be on the same core.
14
- # See https://github.com/micropython/micropython/issues/5489
15
- CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y
16
- CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=n
17
- CONFIG_BT_NIMBLE_PINNED_TO_CORE=0
Original file line number Diff line number Diff line change
1
+ # For IDF <4.2, we need NimBLE on core 0, and for synchronisation
2
+ # with the ringbuffer and scheduler MP needs to be on the same core.
3
+ # See https://github.com/micropython/micropython/issues/5489
4
+ CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y
5
+ CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=n
6
+ CONFIG_BT_NIMBLE_PINNED_TO_CORE=0
Original file line number Diff line number Diff line change
1
+ # For IDF >=4.2, we are able to put NimBLE on core 1, and for synchronisation
2
+ # with the ringbuffer and scheduler MP needs to be on the same core.
3
+ # MP on core 1 prevents interference with WiFi for time sensitive operations.
4
+ CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=n
5
+ CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y
6
+ CONFIG_BT_NIMBLE_PINNED_TO_CORE=1
Original file line number Diff line number Diff line change 38
38
#define MICROPY_PLATFORM_VERSION "IDF" IDF_VER
39
39
40
40
// The core that the MicroPython task(s) are pinned to.
41
- // Until we move to IDF 4.2+, we need NimBLE on core 0, and for synchronisation
42
- // with the ringbuffer and scheduler MP needs to be on the same core.
43
- // See https://github.com/micropython/micropython/issues/5489
41
+ // Now that we have IDF 4.2.0+, we are once again able to pin to core 1
42
+ // and avoid the Wifi/BLE timing problems on the same core.
43
+ // Best effort here to remain backwards compatible in rare version edge cases...
44
+ // See https://github.com/micropython/micropython/issues/5489 for history
45
+ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL (4 , 2 , 0 )
46
+ #define MP_TASK_COREID (1)
47
+ #else
44
48
#define MP_TASK_COREID (0)
49
+ #endif
45
50
46
51
extern TaskHandle_t mp_main_task_handle ;
47
52
You can’t perform that action at this time.
0 commit comments