weston-embedded / uc-os3 Goto Github PK
View Code? Open in Web Editor NEWµC/OS-III is a preemptive, highly portable, and scalable real-time kernel. Designed for ease of use on a huge number of CPU architectures.
License: Apache License 2.0
µC/OS-III is a preemptive, highly portable, and scalable real-time kernel. Designed for ease of use on a huge number of CPU architectures.
License: Apache License 2.0
There is missing one case, as shown in bold below:
void OS_FlagTaskRdy (OS_TCB p_tcb,
OS_FLAGS flags_rdy,
CPU_TS ts)
{
#if (OS_CFG_TS_EN == 0u)
(void)ts; / Prevent compiler warning for not using 'ts' */
#endif
p_tcb->FlagsRdy = flags_rdy;
p_tcb->PendStatus = OS_STATUS_PEND_OK; /* Clear pend status /
p_tcb->PendOn = OS_TASK_PEND_ON_NOTHING; / Indicate no longer pending /
#if (OS_CFG_TS_EN > 0u)
p_tcb->TS = ts;
#endif
switch (p_tcb->TaskState) {
case OS_TASK_STATE_PEND:
case OS_TASK_STATE_PEND_TIMEOUT:
#if (OS_CFG_TICK_EN > 0u)
if (p_tcb->TaskState == OS_TASK_STATE_PEND_TIMEOUT) {
OS_TickListRemove(p_tcb); / Remove from tick list /
}
#endif
OS_RdyListInsert(p_tcb); / Insert the task in the ready list /
p_tcb->TaskState = OS_TASK_STATE_RDY;
break;
case OS_TASK_STATE_PEND_SUSPENDED:
case OS_TASK_STATE_PEND_TIMEOUT_SUSPENDED:
#if (OS_CFG_TICK_EN > 0u)
if (p_tcb->TaskState == OS_TASK_STATE_PEND_TIMEOUT) {
OS_TickListRemove(p_tcb); / Remove from tick list /
}
#endif
p_tcb->TaskState = OS_TASK_STATE_SUSPENDED;
break;
case OS_TASK_STATE_RDY:
case OS_TASK_STATE_DLY:
case OS_TASK_STATE_DLY_SUSPENDED:
case OS_TASK_STATE_SUSPENDED:
default:
/ Default case. */
break;
}
OS_PendListRemove(p_tcb);
}
#endif
I notice a parameter named p_stk_limit in function OSTaskStkInit(), but itseems useless. What is it used for? Redundant?
void SysTick_Handler (void) {
CPU_SR_ALLOC(); /* Allocate storage for CPU status register */
CPU_CRITICAL_ENTER();
OSIntEnter(); /* Tell uC/OS-II that we are starting an ISR */
CPU_CRITICAL_EXIT();
OSTimeTick(); /* Call uC/OS-II's OSTimeTick() */
OSIntExit(); /* Tell uC/OS-II that we are leaving the ISR */
}
Need to change the comments to indicate OS-III not OS-II
Hello, I am going through the companion book and noticed that the above two files are listed in the book but are missing in this repository. Could you please explain why?
uC-OS3/Ports/ARM-Cortex-M/ARMv7-M/GNU/os_cpu_a.S
Lines 158 to 160 in 7af6c6e
Must be:
.thumb_func
OSCtxSw:
.thumb_func
OSIntCtxSw:
When a task to change its priority is blocked on a mutex, its priority change may affect the priority of the owner of the mutex. Specifically, in this function, if the priority of the task is to be reduced, that is, prio_ new>prio_ Cur, at this time, if the priority of the owner of the mutex is higher than prio_ Cur, which is not handled in this case, that is, the loop should be ended, but this is not done in the function.
case OS_TASK_PEND_ON_MUTEX:
#if (OS_CFG_MUTEX_EN > 0u)
OS_PendListChangePrio(p_tcb);
p_tcb_owner = ((OS_MUTEX *)((void )p_tcb->PendObjPtr))->OwnerTCBPtr;
if (prio_cur > prio_new) { / Are we increasing the priority? /
if (p_tcb_owner->Prio <= prio_new) { / Yes, do we need to give this prio to the owner? */
p_tcb_owner = (OS_TCB )0;
} else {
/ Block is empty when trace is disabled. /
OS_TRACE_MUTEX_TASK_PRIO_INHERIT(p_tcb_owner, prio_new);
}
} else {
if (p_tcb_owner->Prio == prio_cur) { / No, is it required to check for a lower prio? */
prio_new = OS_MutexGrpPrioFindHighest(p_tcb_owner);
prio_new = (prio_new > p_tcb_owner->BasePrio) ? p_tcb_owner->BasePrio : prio_new;
if (prio_new == p_tcb_owner->Prio) {
p_tcb_owner = (OS_TCB )0;
} else {
/ Block is empty when trace is disabled. */
OS_TRACE_MUTEX_TASK_PRIO_DISINHERIT(p_tcb_owner, prio_new);
}
}
A condition to end the loop is missing here
}
#endif
break;
I'm wondering why this macro does not appear anywhere in this repository, despite being a significant feature (direct vs. deferred post) described in the uCOS-III book?
Thanks!
in uC-OS3/Ports/ARM-Cortex-R/ARMv7-R/IAR/os_cpu_a_vfp-d16.asm
line 176 & 177
why STMFD LR twice?
The documentation (https://doc.micrium.com/display/kernel304/Conventions) says there are templates provided. I do not see any µC/CPU templates after downloading.
I see a crash in OSIntExit on line 372 in os_core.c:
OSTCBHighRdyPtr->CtxSwCtr++;
The reason being that OSTCBHighRdyPtr is 0. It seems this happens when an interrupt occurs while the ready list is being manipulated. For example I had this stack:
-001|OSIntExit()
| cpu_sr = 64
-002|BSP_IntHandler(:int_id = 38)
| int_id = 38
| cpu_sr = 64
-003|BSP_IntHandlerUSART2()
-->|exception
-004|OS_PrioRemove(prio = ?)
| prio = ?
-005|OS_RdyListRemove(p_tcb = 0x20007CA8)
| p_tcb = 0x20007CA8
-006|OSTimeDly(:dly = 100, :opt = 0, :p_err = 0x20008B2E)
| dly = 100
| opt = 0
| p_err = 0x20008B2E
| cpu_sr = 0
-007|OS_StatTask(p_arg = ?)
| p_arg = ?
| err = OS_ERR_NONE
| dly = 100
-008|OS_TaskReturn()
| err = 2056
---|end of frame
The variable OSPrioHighRdy contained 5 in my case, the contents of the ready list was this:
OSRdyList = (
(HeadPtr = 0x0, TailPtr = 0x0, NbrEntries = 0),
(HeadPtr = 0x0, TailPtr = 0x0, NbrEntries = 0),
(HeadPtr = 0x0, TailPtr = 0x0, NbrEntries = 0),
(HeadPtr = 0x0, TailPtr = 0x0, NbrEntries = 0),
(HeadPtr = 0x0, TailPtr = 0x0, NbrEntries = 0),
(HeadPtr = 0x0, TailPtr = 0x0, NbrEntries = 0),
(HeadPtr = 0x0, TailPtr = 0x0, NbrEntries = 0),
(HeadPtr = 0x2000B53C, TailPtr = 0x2000B53C, NbrEntries = 1),
(HeadPtr = 0x0, TailPtr = 0x0, NbrEntries = 0),
(HeadPtr = 0x20007AF8, TailPtr = 0x20007AF8, NbrEntries = 1))
Entry 5 is all zeros. I'm guessing that it had just removed this entry when the interrupt occurred?
Hello,
I want run uC-OS3 on STM32H5 which based on ARMv8-M, but I have not found "ARMv8-M" on "Ports" folder.
So, I hope uC-OS3 will support ARMv8-M.
Thank you!
During a context switch our current OS port for ARMv7-M is pushing/popping FPU registers by default. Therefore, the new improvement will get rid of this and only save/restore those registers if the task is using them. The new modification will improve task context switch time.
This feature can cause debugging issues if memory is not cleared on reset. Having an option will allow it to be disabled independently of the other debugging features.
I think there is one missing case in this function, which should be added as shown in bold below:
void OS_FlagTaskRdy (OS_TCB p_tcb,
OS_FLAGS flags_rdy,
CPU_TS ts)
{
#if (OS_CFG_TS_EN == 0u)
(void)ts; / Prevent compiler warning for not using 'ts' */
#endif
p_tcb->FlagsRdy = flags_rdy;
p_tcb->PendStatus = OS_STATUS_PEND_OK; /* Clear pend status */
p_tcb->PendOn = OS_TASK_PEND_ON_NOTHING; /* Indicate no longer pending */
#if (OS_CFG_TS_EN > 0u)
p_tcb->TS = ts;
#endif
switch (p_tcb->TaskState) {
case OS_TASK_STATE_PEND:
case OS_TASK_STATE_PEND_TIMEOUT:
#if (OS_CFG_TICK_EN > 0u)
if (p_tcb->TaskState == OS_TASK_STATE_PEND_TIMEOUT) {
OS_TickListRemove(p_tcb); /* Remove from tick list /
}
#endif
OS_RdyListInsert(p_tcb); / Insert the task in the ready list */
p_tcb->TaskState = OS_TASK_STATE_RDY;
break;
case OS_TASK_STATE_PEND_SUSPENDED:
case OS_TASK_STATE_PEND_TIMEOUT_SUSPENDED:
#if (OS_CFG_TICK_EN > 0u)
if (p_tcb->TaskState == OS_TASK_STATE_PEND_TIMEOUT) {
OS_TickListRemove(p_tcb);` / Remove from tick list /
}
#endif
p_tcb->TaskState = OS_TASK_STATE_SUSPENDED;
break;
case OS_TASK_STATE_RDY:
case OS_TASK_STATE_DLY:
case OS_TASK_STATE_DLY_SUSPENDED:
case OS_TASK_STATE_SUSPENDED:
default:
/* Default case. */
break;
}
OS_PendListRemove(p_tcb);
}
#endif
Create functions should not alter kernel or user-space structures if the object was already created.
We don't currently deliver any template code for users to use dynamic tick.
A proper template must be developed and reviewed before we can include it.
Line 48 in 2fa9aeb
quick question here, why cpu_core.h is included while there is no such file or directory in the entire project?
is this a problem?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.