Skip to content

Commit d05ffaf

Browse files
committed
Merge pull request #1973 from petermm/fix-deprecated-xTaskGetAffinity
Fix deprecated xTaskGetAffinity-> xTaskGetCoreID These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 9e6ed9f + 5d27fbf commit d05ffaf

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/platforms/esp32/components/avm_sys/smp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ static void *scheduler_thread_entry_point(void *arg)
6666
{
6767
g_sub_main_thread = true;
6868
void *result = (void *) scheduler_entry_point((GlobalContext *) arg);
69+
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0))
70+
BaseType_t core = xTaskGetCoreID(NULL);
71+
#else
6972
BaseType_t core = xTaskGetAffinity(NULL);
73+
#endif
7074
if (core != -1) {
7175
uint32_t desired = 1;
7276
uint32_t expected = 3;

src/platforms/esp32/components/avm_sys/sys.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ void sys_init_platform(GlobalContext *glb)
236236
// other cores, supposing it's pinned to core 0.
237237
esp_pthread_cfg_t esp_pthread_cfg = esp_pthread_get_default_config();
238238
esp_pthread_cfg.prio = uxTaskPriorityGet(NULL);
239+
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0))
240+
BaseType_t affinity = xTaskGetCoreID(NULL);
241+
#else
239242
BaseType_t affinity = xTaskGetAffinity(NULL);
243+
#endif
240244
if (affinity == -1) {
241245
esp_pthread_cfg.pin_to_core = tskNO_AFFINITY;
242246
} else {

0 commit comments

Comments
 (0)