Skip to content

Commit ee8667f

Browse files
committed
Identified problems fixed
1 parent f60362c commit ee8667f

4 files changed

Lines changed: 23 additions & 11 deletions

File tree

ARM.CMSIS-FreeRTOS.pdsc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<license>License/license.txt</license>
99

1010
<releases>
11-
<release version="10.2.0-RC">
11+
<release version="10.2.0-RC1">
1212
FreeRTOS 10.2.0
1313
Maintenance for CMSIS 5.5.1:
1414
- Updated to CMSIS API 2.1.3

CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
#if ((__ARM_ARCH_7M__ == 1U) || \
5454
(__ARM_ARCH_7EM__ == 1U) || \
5555
(__ARM_ARCH_8M_MAIN__ == 1U))
56-
#define IS_IRQ_MASKED() ((KernelState == osKernelRunning) && ((__get_PRIMASK() != 0U) || (__get_BASEPRI() != 0U)))
56+
#define IS_IRQ_MASKED() ((__get_PRIMASK() != 0U) || (__get_BASEPRI() != 0U))
5757
#elif (__ARM_ARCH_6M__ == 1U)
58-
#define IS_IRQ_MASKED() ((KernelState == osKernelRunning) && (__get_PRIMASK() != 0U))
58+
#define IS_IRQ_MASKED() (__get_PRIMASK() != 0U)
5959
#elif (__ARM_ARCH_7A__ == 1U)
6060
/* CPSR mask bits */
6161
#define CPSR_MASKBIT_I 0x80U
@@ -75,7 +75,7 @@
7575
#define IS_IRQ_MODE() (__get_IPSR() != 0U)
7676
#endif
7777

78-
#define IS_IRQ() (IS_IRQ_MODE() || IS_IRQ_MASKED())
78+
#define IS_IRQ() (IS_IRQ_MODE() || (IS_IRQ_MASKED() && (KernelState == osKernelRunning)))
7979

8080
/* Limits */
8181
#define MAX_BITS_TASK_NOTIFY 31U
@@ -164,6 +164,18 @@ void SysTick_Handler (void) {
164164
}
165165
#endif /* SysTick */
166166

167+
/*
168+
Setup SVC to reset value.
169+
*/
170+
__STATIC_INLINE void SVC_Setup (void) {
171+
#if (__ARM_ARCH_7A__ == 0U)
172+
/* Service Call interrupt might be configured before kernel start */
173+
/* and when its priority is lower or equal to BASEPRI, svc intruction */
174+
/* causes a Hard Fault. */
175+
NVIC_SetPriority (SVCall_IRQn, 0U);
176+
#endif
177+
}
178+
167179
/*---------------------------------------------------------------------------*/
168180

169181
osStatus_t osKernelInitialize (void) {
@@ -242,7 +254,7 @@ osStatus_t osKernelStart (void) {
242254
else {
243255
if (KernelState == osKernelReady) {
244256
/* Ensure SVC priority is at the reset value */
245-
NVIC_SetPriority (SVCall_IRQn, 0U);
257+
SVC_Setup();
246258
/* Change state to enable IRQ masking check */
247259
KernelState = osKernelRunning;
248260
/* Start the kernel scheduler */
@@ -368,11 +380,11 @@ uint32_t osKernelGetTickFreq (void) {
368380
}
369381

370382
uint32_t osKernelGetSysTimerCount (void) {
371-
uint32_t irqmask;
383+
uint32_t irqmask = IS_IRQ_MASKED();
372384
TickType_t ticks;
373385
uint32_t val;
374386

375-
irqmask = __disable_irq();
387+
__disable_irq();
376388

377389
ticks = xTaskGetTickCount();
378390
val = OS_Tick_GetCount();

Config/ARMCA/FreeRTOSConfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#define configTOTAL_HEAP_SIZE ((size_t)4096)
5050
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
5151
#define configSUPPORT_DYNAMIC_ALLOCATION 1
52-
#define configSUPPORT_STATIC_ALLOCATION 1
52+
#define configSUPPORT_STATIC_ALLOCATION 0
5353

5454
/* Constants related to the behaviour or the scheduler. */
5555
#define configMAX_PRIORITIES 5
@@ -60,7 +60,7 @@
6060
#define configUSE_16_BIT_TICKS 0
6161

6262
/* Software timer definitions. */
63-
#define configUSE_TIMERS 1
63+
#define configUSE_TIMERS 0
6464
#define configTIMER_TASK_PRIORITY 2
6565
#define configTIMER_QUEUE_LENGTH 5
6666
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2)

Config/ARMCM/FreeRTOSConfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern uint32_t SystemCoreClock;
5151
#define configTOTAL_HEAP_SIZE ((size_t)4096)
5252
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
5353
#define configSUPPORT_DYNAMIC_ALLOCATION 1
54-
#define configSUPPORT_STATIC_ALLOCATION 1
54+
#define configSUPPORT_STATIC_ALLOCATION 0
5555

5656
/* Constants related to the behaviour or the scheduler. */
5757
#define configMAX_PRIORITIES 5
@@ -62,7 +62,7 @@ extern uint32_t SystemCoreClock;
6262
#define configUSE_16_BIT_TICKS 0
6363

6464
/* Software timer definitions. */
65-
#define configUSE_TIMERS 1
65+
#define configUSE_TIMERS 0
6666
#define configTIMER_TASK_PRIORITY 2
6767
#define configTIMER_QUEUE_LENGTH 5
6868
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2)

0 commit comments

Comments
 (0)