From 3576e54d79474ab83a220d3296f82174d6e3e333 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Tue, 26 Feb 2019 20:58:02 +0800 Subject: [PATCH] freertos: Make xPortGetCoreID() volatile When xPortGetCoreID() is called twice within a function, it might only be called once after compilation. This commit makes the inline assembly of the function volatile. Closes #3093 --- components/freertos/include/freertos/portable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/freertos/include/freertos/portable.h b/components/freertos/include/freertos/portable.h index 33b740e89..ce189f31c 100644 --- a/components/freertos/include/freertos/portable.h +++ b/components/freertos/include/freertos/portable.h @@ -205,7 +205,7 @@ BaseType_t xPortInterruptedFromISRContext(); /* Multi-core: get current core ID */ static inline uint32_t IRAM_ATTR xPortGetCoreID() { int id; - __asm__ ( + __asm__ __volatile__ ( "rsr.prid %0\n" " extui %0,%0,13,1" :"=r"(id));