Skip to content

Commit 0c6f762

Browse files
committed
2.3.2
Corrected SST_Task_lock() for ARMv7-M and higher
1 parent 99f708d commit 0c6f762

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

sst_c/ports/arm-cm/sst_port.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,12 @@ SST_LockKey SST_Task_lock(SST_TaskPrio ceiling) {
162162
*/
163163
uint32_t nvic_prio = ((0xFFU >> nvic_prio_shift) + 1U - ceiling)
164164
<< nvic_prio_shift;
165-
SST_LockKey basepri_;
165+
SST_LockKey basepri_; /* initialized in the following asm() instruction */
166166
__asm volatile ("mrs %0,BASEPRI" : "=r" (basepri_) :: );
167167
if (basepri_ > nvic_prio) { /* current priority lower than the ceiling? */
168168
__asm volatile ("cpsid i\n msr BASEPRI,%0\n cpsie i"
169169
:: "r" (nvic_prio) : );
170170
}
171-
else {
172-
basepri_ = nvic_prio;
173-
}
174171
return basepri_;
175172
#endif
176173
}

sst_cpp/ports/arm-cm/sst_port.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,12 @@ LockKey Task::lock(TaskPrio ceiling) {
165165
//
166166
uint32_t nvic_prio = ((0xFFU >> nvic_prio_shift) + 1U - ceiling)
167167
<< nvic_prio_shift;
168-
LockKey basepri_;
168+
LockKey basepri_; // initialized in the following asm() instruction
169169
__asm volatile ("mrs %0,BASEPRI" : "=r" (basepri_) :: );
170170
if (basepri_ > nvic_prio) { // current priority lower than the ceiling?
171171
__asm volatile ("cpsid i\n msr BASEPRI,%0\n cpsie i"
172172
:: "r" (nvic_prio) : );
173173
}
174-
else {
175-
basepri_ = nvic_prio;
176-
}
177174
return basepri_;
178175
#endif
179176
}

0 commit comments

Comments
 (0)