From fe7056bebc30083171b5f5fbfb4314dee491bef3 Mon Sep 17 00:00:00 2001 From: MMS Date: Sun, 12 Feb 2023 21:18:34 -0500 Subject: [PATCH] 2.0.4 --- 3rd_party/nucleo-c031c6/README.txt | 4 ++-- include/sst.h | 1 + include/sst.hpp | 1 + .../armclang/nucleo-h743zi.uvoptx | 10 ++++----- sst_c/ports/arm-cm/sst_port.c | 17 +++++++++++++++ sst_c/src/sst.c | 3 ++- .../armclang/nucleo-h743zi.uvoptx | 21 ++----------------- sst_cpp/ports/arm-cm/sst_port.cpp | 16 ++++++++++++++ sst_cpp/src/sst.cpp | 2 +- 9 files changed, 47 insertions(+), 28 deletions(-) diff --git a/3rd_party/nucleo-c031c6/README.txt b/3rd_party/nucleo-c031c6/README.txt index a827f0e..e4e6bc9 100644 --- a/3rd_party/nucleo-c031c6/README.txt +++ b/3rd_party/nucleo-c031c6/README.txt @@ -1,3 +1,3 @@ -This directory contains embedded code for the STM32 NUCLEO-L152RE +This directory contains embedded code for the STM32 NUCLEO-C031C6 board. This code is then used to build ET tests for this board. -See also the examples/ directory, make_nucleo-l152re makefiles. \ No newline at end of file +See also the examples/ directory, make_nucleo-l152re makefiles. diff --git a/include/sst.h b/include/sst.h index 71042ca..0e06cfc 100644 --- a/include/sst.h +++ b/include/sst.h @@ -91,6 +91,7 @@ int SST_Task_run(void); /* run SST tasks static */ /* SST Kernel facilities ---------------------------------------------------*/ void SST_init(void); +void SST_start(void); void SST_onStart(void); #ifndef SST_LOG2 diff --git a/include/sst.hpp b/include/sst.hpp index e82c949..cc65850 100644 --- a/include/sst.hpp +++ b/include/sst.hpp @@ -87,6 +87,7 @@ class Task { // SST Kernel facilities ----------------------------------------------------- void init(void); +void start(void); void onStart(void); void onIdle(void); diff --git a/sst_c/examples/blinky_button/armclang/nucleo-h743zi.uvoptx b/sst_c/examples/blinky_button/armclang/nucleo-h743zi.uvoptx index b3ee36e..37a06c8 100644 --- a/sst_c/examples/blinky_button/armclang/nucleo-h743zi.uvoptx +++ b/sst_c/examples/blinky_button/armclang/nucleo-h743zi.uvoptx @@ -140,7 +140,7 @@ 0 DLGTARM - (1010=1221,723,1671,1280,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=3268,1338,3745,1653,0) + (1010=2367,534,2817,1091,1)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=3268,1338,3745,1653,0) 0 @@ -152,18 +152,18 @@ 0 0 - 283 + 67 1 -
134221674
+
134221976
0 0 0 0 0 1 - ..\bsp_nucleo-h743zi.c + ..\..\..\ports\arm-cm\sst_port.c - \\blinky_button\../bsp_nucleo-h743zi.c\283 + \\blinky_button\../../../ports/arm-cm/sst_port.c\67
diff --git a/sst_c/ports/arm-cm/sst_port.c b/sst_c/ports/arm-cm/sst_port.c index 2619615..6a03dbf 100644 --- a/sst_c/ports/arm-cm/sst_port.c +++ b/sst_c/ports/arm-cm/sst_port.c @@ -32,6 +32,7 @@ DBC_MODULE_NAME("sst_port") /* for DBC assertions in this module */ #define NVIC_EN ((uint32_t volatile *)0xE000E100U) #define NVIC_IP ((uint32_t volatile *)0xE000E400U) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define SCB_AIRCR *((uint32_t volatile *)0xE000ED0CU) #define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) /*..........................................................................*/ @@ -62,6 +63,22 @@ void SST_init(void) { | (1U << 31U); /* lazy stacking (LSPEN) */ #endif } +/*..........................................................................*/ +void SST_start(void) { + /* Set the NVIC priority grouping to default 0 + * + * NOTE: + * Typically the SST port to ARM Cortex-M should waste no NVIC priority + * bits for grouping. This code ensures this setting, but priority + * grouping can be still overridden in the application-specific + * callback SST_onStart(). + */ + uint32_t tmp = SCB_AIRCR; + /* clear the key bits 31:16 and priority grouping bits 10:8 */ + tmp &= ~((0xFFFFU << 16U) | (0x7U << 8U)); + SCB_AIRCR = (0x05FAU << 16U) | tmp; +} + /* SST Task facilities -----------------------------------------------------*/ void SST_Task_setPrio(SST_Task * const me, SST_TaskPrio prio) { diff --git a/sst_c/src/sst.c b/sst_c/src/sst.c index 010a2be..7ee13de 100644 --- a/sst_c/src/sst.c +++ b/sst_c/src/sst.c @@ -30,7 +30,8 @@ DBC_MODULE_NAME("sst") /* for DBC assertions in this module */ /*..........................................................................*/ int SST_Task_run(void) { - SST_onStart(); /* configure and start the interrupts */ + SST_start(); /* port-specific start of multitasking */ + SST_onStart(); /* application callback to config & start interrupts */ for (;;) { /* idle loop of the SST kernel */ SST_onIdle(); diff --git a/sst_cpp/examples/blinky_button/armclang/nucleo-h743zi.uvoptx b/sst_cpp/examples/blinky_button/armclang/nucleo-h743zi.uvoptx index 86ff9b0..8d236c7 100644 --- a/sst_cpp/examples/blinky_button/armclang/nucleo-h743zi.uvoptx +++ b/sst_cpp/examples/blinky_button/armclang/nucleo-h743zi.uvoptx @@ -140,7 +140,7 @@ 0 DLGTARM - (1010=1221,723,1671,1280,1)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=3268,1338,3745,1653,0) + (1010=2346,607,2796,1164,1)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=3268,1338,3745,1653,0) 0 @@ -148,24 +148,7 @@ - - - 0 - 0 - 725 - 1 -
134218620
- 0 - 0 - 0 - 0 - 0 - 1 - C:\GitHub\Super-Simple-Tasker\sst_c\targets\nucleo-h743zi\arm\startup_stm32h743xx.s - - \\blinky_button\../../targets/nucleo-h743zi/arm/startup_stm32h743xx.s\725 -
-
+ 0 diff --git a/sst_cpp/ports/arm-cm/sst_port.cpp b/sst_cpp/ports/arm-cm/sst_port.cpp index 4915f10..99a28cc 100644 --- a/sst_cpp/ports/arm-cm/sst_port.cpp +++ b/sst_cpp/ports/arm-cm/sst_port.cpp @@ -30,6 +30,7 @@ #define NVIC_EN ((uint32_t volatile *)0xE000E100U) #define NVIC_IP ((uint32_t volatile *)0xE000E400U) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14U) +#define SCB_AIRCR *((uint32_t volatile *)0xE000ED0CU) #define FPU_FPCCR *((uint32_t volatile *)0xE000EF34U) //............................................................................ @@ -67,6 +68,21 @@ void init(void) { | (1U << 31U); // lazy stacking (LSPEN) #endif } +//............................................................................ +void start(void) { + // Set the NVIC priority grouping to default 0 + // + // NOTE: + // Typically the SST port to ARM Cortex-M should waste no NVIC priority + // bits for grouping. This code ensures this setting, but priority + // grouping can be still overridden in the application-specific + // callback SST_onStart(). + // + std::uint32_t tmp = SCB_AIRCR; + // clear the key bits 31:16 and priority grouping bits 10:8 + tmp &= ~((0xFFFFU << 16U) | (0x7U << 8U)); + SCB_AIRCR = (0x05FAU << 16U) | tmp; +} // SST Task facilities ------------------------------------------------------- void Task::setPrio(TaskPrio prio) noexcept { diff --git a/sst_cpp/src/sst.cpp b/sst_cpp/src/sst.cpp index 461e620..3c83490 100644 --- a/sst_cpp/src/sst.cpp +++ b/sst_cpp/src/sst.cpp @@ -36,8 +36,8 @@ DBC_MODULE_NAME("sst") // for DBC assertions in this module namespace SST { // SST kernel facilities ----------------------------------------------------- -//............................................................................ int Task::run(void) { + SST::start(); // port-specific start of multitasking onStart(); // configure and start the interrupts for (;;) { // idle loop of the SST kernel