Skip to content

Commit 34e24f7

Browse files
Yogesh PandeYogesh Pande
Yogesh Pande
authored and
Yogesh Pande
committed
Revert "Merge pull request #1 from 0xc0170/dev_update_rtos"
This reverts commit 4ae6b05, reversing changes made to 1ee1150.
1 parent 4ac9644 commit 34e24f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1262
-2276
lines changed

core/mbed-rtos/rtos/Mutex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Mutex {
5757
osMutexId _osMutexId;
5858
osMutexDef_t _osMutexDef;
5959
#ifdef CMSIS_OS_RTX
60-
#if defined(__MBED_CMSIS_RTOS_CA9) || defined(__MBED_CMSIS_RTOS_CM)
60+
#ifdef __MBED_CMSIS_RTOS_CA9
6161
int32_t _mutex_data[4];
6262
#else
6363
int32_t _mutex_data[3];

core/mbed-rtos/rtos/RtosTimer.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ class RtosTimer {
6161
private:
6262
osTimerId _timer_id;
6363
osTimerDef_t _timer;
64-
#if defined(CMSIS_OS_RTX) && !defined(__MBED_CMSIS_RTOS_CM)
64+
#ifdef CMSIS_OS_RTX
6565
uint32_t _timer_data[5];
66-
#else
67-
uint32_t _timer_data[6];
6866
#endif
6967
};
7068

core/mbed-rtos/rtos/Thread.cpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace rtos {
2828

2929
Thread::Thread(void (*task)(void const *argument), void *argument,
3030
osPriority priority, uint32_t stack_size, unsigned char *stack_pointer) {
31-
#ifdef __MBED_CMSIS_RTOS_CM
31+
#ifdef CMSIS_OS_RTX
3232
_thread_def.pthread = task;
3333
_thread_def.tpriority = priority;
3434
_thread_def.stacksize = stack_size;
@@ -71,10 +71,8 @@ int32_t Thread::signal_clr(int32_t signals) {
7171
}
7272

7373
Thread::State Thread::get_state() {
74-
#if !defined(__MBED_CMSIS_RTOS_CA9) && !defined(__MBED_CMSIS_RTOS_CM)
75-
#ifdef CMSIS_OS_RTX
74+
#ifndef __MBED_CMSIS_RTOS_CA9
7675
return ((State)_thread_def.tcb.state);
77-
#endif
7876
#else
7977
uint8_t status;
8078
status = osThreadGetState(_tid);
@@ -84,55 +82,39 @@ Thread::State Thread::get_state() {
8482

8583
uint32_t Thread::stack_size() {
8684
#ifndef __MBED_CMSIS_RTOS_CA9
87-
#if defined(CMSIS_OS_RTX) && !defined(__MBED_CMSIS_RTOS_CM)
8885
return _thread_def.tcb.priv_stack;
8986
#else
9087
return 0;
9188
#endif
92-
#else
93-
return 0;
94-
#endif
9589
}
9690

9791
uint32_t Thread::free_stack() {
9892
#ifndef __MBED_CMSIS_RTOS_CA9
99-
#if defined(CMSIS_OS_RTX) && !defined(__MBED_CMSIS_RTOS_CM)
10093
uint32_t bottom = (uint32_t)_thread_def.tcb.stack;
10194
return _thread_def.tcb.tsk_stack - bottom;
10295
#else
10396
return 0;
10497
#endif
105-
#else
106-
return 0;
107-
#endif
10898
}
10999

110100
uint32_t Thread::used_stack() {
111101
#ifndef __MBED_CMSIS_RTOS_CA9
112-
#if defined(CMSIS_OS_RTX) && !defined(__MBED_CMSIS_RTOS_CM)
113102
uint32_t top = (uint32_t)_thread_def.tcb.stack + _thread_def.tcb.priv_stack;
114103
return top - _thread_def.tcb.tsk_stack;
115104
#else
116105
return 0;
117106
#endif
118-
#else
119-
return 0;
120-
#endif
121107
}
122108

123109
uint32_t Thread::max_stack() {
124110
#ifndef __MBED_CMSIS_RTOS_CA9
125-
#if defined(CMSIS_OS_RTX) && !defined(__MBED_CMSIS_RTOS_CM)
126111
uint32_t high_mark = 0;
127112
while (_thread_def.tcb.stack[high_mark] == 0xE25A2EA5)
128113
high_mark++;
129114
return _thread_def.tcb.priv_stack - (high_mark * 4);
130115
#else
131116
return 0;
132117
#endif
133-
#else
134-
return 0;
135-
#endif
136118
}
137119

138120
osEvent Thread::signal_wait(int32_t signals, uint32_t millisec) {
@@ -157,11 +139,9 @@ void Thread::attach_idle_hook(void (*fptr)(void)) {
157139

158140
Thread::~Thread() {
159141
terminate();
160-
#ifdef __MBED_CMSIS_RTOS_CM
161142
if (_dynamic_stack) {
162143
delete[] (_thread_def.stack_pointer);
163144
}
164-
#endif
165145
}
166146

167147
}

core/mbed-rtos/rtx/TARGET_CORTEX_M/HAL_CM.c

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*----------------------------------------------------------------------------
2-
* CMSIS-RTOS - RTX
2+
* RL-ARM - RTX
33
*----------------------------------------------------------------------------
44
* Name: HAL_CM.C
55
* Purpose: Hardware Abstraction Layer for Cortex-M
6-
* Rev.: V4.79
6+
* Rev.: V4.60
77
*----------------------------------------------------------------------------
88
*
9-
* Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH
9+
* Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH
1010
* All rights reserved.
1111
* Redistribution and use in source and binary forms, with or without
1212
* modification, are permitted provided that the following conditions are met:
@@ -33,7 +33,7 @@
3333
*---------------------------------------------------------------------------*/
3434

3535
#include "rt_TypeDef.h"
36-
#include "RTX_Config.h"
36+
#include "RTX_Conf.h"
3737
#include "rt_HAL_CM.h"
3838

3939

@@ -58,15 +58,12 @@ void rt_init_stack (P_TCB p_TCB, FUNCP task_body) {
5858

5959
/* Prepare a complete interrupt frame for first task start */
6060
size = p_TCB->priv_stack >> 2;
61-
if (size == 0U) {
62-
size = (U16)os_stackinfo >> 2;
63-
}
6461

6562
/* Write to the top of stack. */
6663
stk = &p_TCB->stack[size];
6764

6865
/* Auto correct to 8-byte ARM stack alignment. */
69-
if ((U32)stk & 0x04U) {
66+
if ((U32)stk & 0x04) {
7067
stk--;
7168
}
7269

@@ -77,8 +74,8 @@ void rt_init_stack (P_TCB p_TCB, FUNCP task_body) {
7774
stk[14] = (U32)task_body;
7875

7976
/* Clear R4-R11,R0-R3,R12,LR registers. */
80-
for (i = 0U; i < 14U; i++) {
81-
stk[i] = 0U;
77+
for (i = 0; i < 14; i++) {
78+
stk[i] = 0;
8279
}
8380

8481
/* Assign a void pointer to R0. */
@@ -90,50 +87,31 @@ void rt_init_stack (P_TCB p_TCB, FUNCP task_body) {
9087
/* Task entry point. */
9188
p_TCB->ptask = task_body;
9289

93-
/* Initialize stack with magic pattern. */
94-
if (os_stackinfo & 0x10000000U) {
95-
if (size > (16U+1U)) {
96-
for (i = ((size - 16U)/2U) - 1U; i; i--) {
97-
stk -= 2U;
98-
stk[1] = MAGIC_PATTERN;
99-
stk[0] = MAGIC_PATTERN;
100-
}
101-
if (--stk > p_TCB->stack) {
102-
*stk = MAGIC_PATTERN;
103-
}
104-
}
105-
}
106-
107-
#ifdef __MBED_CMSIS_RTOS_CM
10890
/* Set a magic word for checking of stack overflow.
109-
For the main thread (ID: 0x02) the stack is in a memory area shared with the
91+
For the main thread (ID: 0x01) the stack is in a memory area shared with the
11092
heap, therefore the last word of the stack is a moving target.
11193
We want to do stack/heap collision detection instead.
11294
*/
113-
if (p_TCB->task_id != 0x02)
95+
if (p_TCB->task_id != 0x01)
11496
p_TCB->stack[0] = MAGIC_WORD;
115-
#else
116-
/* Set a magic word for checking of stack overflow. */
117-
p_TCB->stack[0] = MAGIC_WORD;
118-
#endif
11997
}
12098

12199

122100
/*--------------------------- rt_ret_val ----------------------------------*/
123101

124102
static __inline U32 *rt_ret_regs (P_TCB p_TCB) {
125103
/* Get pointer to task return value registers (R0..R3) in Stack */
126-
#if defined(__TARGET_FPU_VFP)
104+
#if (__TARGET_FPU_VFP)
127105
if (p_TCB->stack_frame) {
128106
/* Extended Stack Frame: R4-R11,S16-S31,R0-R3,R12,LR,PC,xPSR,S0-S15,FPSCR */
129-
return (U32 *)(p_TCB->tsk_stack + (8U*4U) + (16U*4U));
107+
return (U32 *)(p_TCB->tsk_stack + 8*4 + 16*4);
130108
} else {
131109
/* Basic Stack Frame: R4-R11,R0-R3,R12,LR,PC,xPSR */
132-
return (U32 *)(p_TCB->tsk_stack + (8U*4U));
110+
return (U32 *)(p_TCB->tsk_stack + 8*4);
133111
}
134112
#else
135113
/* Stack Frame: R4-R11,R0-R3,R12,LR,PC,xPSR */
136-
return (U32 *)(p_TCB->tsk_stack + (8U*4U));
114+
return (U32 *)(p_TCB->tsk_stack + 8*4);
137115
#endif
138116
}
139117

@@ -157,9 +135,9 @@ void rt_ret_val2(P_TCB p_TCB, U32 v0, U32 v1) {
157135

158136
#ifdef DBG_MSG
159137
void dbg_init (void) {
160-
if (((DEMCR & DEMCR_TRCENA) != 0U) &&
161-
((ITM_CONTROL & ITM_ITMENA) != 0U) &&
162-
((ITM_ENABLE & (1UL << 31)) != 0U)) {
138+
if ((DEMCR & DEMCR_TRCENA) &&
139+
(ITM_CONTROL & ITM_ITMENA) &&
140+
(ITM_ENABLE & (1UL << 31))) {
163141
dbg_msg = __TRUE;
164142
}
165143
}
@@ -169,22 +147,24 @@ void dbg_init (void) {
169147

170148
#ifdef DBG_MSG
171149
void dbg_task_notify (P_TCB p_tcb, BOOL create) {
172-
while (ITM_PORT31_U32 == 0U);
150+
while (ITM_PORT31_U32 == 0);
173151
ITM_PORT31_U32 = (U32)p_tcb->ptask;
174-
while (ITM_PORT31_U32 == 0U);
175-
ITM_PORT31_U16 = (U16)((create << 8) | p_tcb->task_id);
152+
while (ITM_PORT31_U32 == 0);
153+
ITM_PORT31_U16 = (create << 8) | p_tcb->task_id;
176154
}
177155
#endif
178156

179157
/*--------------------------- dbg_task_switch -------------------------------*/
180158

181159
#ifdef DBG_MSG
182160
void dbg_task_switch (U32 task_id) {
183-
while (ITM_PORT31_U32 == 0U);
184-
ITM_PORT31_U8 = (U8)task_id;
161+
while (ITM_PORT31_U32 == 0);
162+
ITM_PORT31_U8 = task_id;
185163
}
186164
#endif
187165

166+
188167
/*----------------------------------------------------------------------------
189168
* end of file
190169
*---------------------------------------------------------------------------*/
170+

0 commit comments

Comments
 (0)