Coder Social home page Coder Social logo

weston-embedded / uc-os2 Goto Github PK

View Code? Open in Web Editor NEW
513.0 34.0 191.0 835 KB

µC/OS-II is a preemptive, highly portable, and scalable real-time kernels. Designed for ease of use on a huge number of CPU architectures.

License: Apache License 2.0

C 67.14% Assembly 32.42% AngelScript 0.44%
rtos real-time os os-ii micrium kernel ucos-ii ucosii certification safety

uc-os2's People

Contributors

forg0ne avatar jamagasr avatar renlipingpping avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uc-os2's Issues

the problem of the OS_CORE.C file

in the os_core.c, the line 1919, usage = 100 - (INT8S)(OSIdleCtrRun / OSIdleCtrMax);
OSCPUUsage = 100 *(1- OSIdleCtr / OSIdleCtrMax) Isn't that the formula you provided?

OSMemCreateAssumes 32bit pointers

In the call to OSMemCreate(), if arg checking is enabled, the pointer to the start of the partition is cast to an integer in order to verify its aligned to store pointers.

When I compile this on a 64bit system I get compiler warnings about the cast to a smaller type. uC-CPU defines an OS_ADDR type, which would be ideal to use here, but uC-OS2 isn't required to use it. My workaround so far has been to add a similar typedef in os_cpu.h (along with the others like INT32U currently used in the cast).

To reproduce; compile os_mem.c on Ubuntu 18.04 (64bit) using gcc 7.5.0.

if (((INT32U)addr & (sizeof(void *) - 1u)) != 0u){ /* Must be pointer size aligned */

Port Required for ARMv8

Can any one Knows, how to port to Cortex-M23 Controller. OS-2 Port is missing for the Same.

unable to generate OSTickISR using qemu-system-ppc -M bamboo -cpu 440epb

I am using Ports/PPC440 and qemu-system-ppc to learn more about uC-OS2. Tasks are running but I don't get OSTickISR to happen. I see in file os_cpu_a.S there is:

.org _vectorbase + 0x0700
DEC_ISR: OSTickISR

and

   lis     4,  _vectorbase@h                           /* Initialize the IVPR register                */
    ori   4, 4,  _vectorbase@l
    mtivpr  4
    mtivor0 4

    addi     4, 4, IVOR1_VAL
    mtivor1 4

    addi     4, 4, SIXTEEN_BYTES
    mtivor2 4
...
...
   addi     4, 4, SIXTEEN_BYTES
    mtivor10 4

Above initializes IVPR and IVOR10

I may then also need to enable interrupts though it seems this is done in the stack frame of new uC-OS2 tasks in os_cpu_c.c

    /* Interrupts will be enabled when the task is started           */
    msr    |= 0x00028000;

Do I would need to load an initial value in the decrement register (possibly w/ auto-reloading)? How does one do this? Is there code example (either for PPC440 or related) that I can use to see how to enable OSTickISR? The uC-OS2 book says on page 389:

Because we didnt enable interrupts nor did we start the clock tick, OSTimeDly(1) will never return to
TestTask() !

But I can't figure out how to get OSTickISR to happen. Any hints and pointers welcome. Thanks.

I run my compiled binary with:

qemu-system-ppc -M bamboo -cpu 440epb -nographic -kernel test.elf -s

and my Linkmap is:

ENTRY(_Reset)
SECTIONS
{
. = 0x10000;
startup : { startup.o(.text)}
.data : {*(.data)}
.bss : {*(.bss)}
. = . + 0x500;
sp_top = .;
}

'OS_FLAG_CONSUME' implementation cause race condition

#define FLAG_UNLOCKED ((OS_FLAGS)0x0001)

OS_FLAG_GRP *flag_group;

void WorkWithSharedResource()
{
    INT8U err;

    // 1: Start of critical section
    OSFlagPend(flag_group, FLAG_UNLOCKED, (OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME), 0, &err);

    // 2: start long-running operation, wait semaphore (signaled in interrupt)
    OSSemPend(...)

    // 3: end of critical section
    OSFlagPost(flag_group, FLAG_UNLOCKED, OS_FLAG_SET, &err)
}

// high priority task
void TaskA(void *p_arg)
{
   while (true)
   {
       WorkWithSharedResource();
   }
}

// low priority task
void TaskB(void *p_arg)
{
   while (true)
   {
       WorkWithSharedResource();
   }
}

Conditions:
flag_grp->flags contains FLAG_UNLOCKED (i.e. bit is set)

Steps:

  1. 1A - high priority task acquire flag (because flag is set)
  2. 2A - high priority task start pend on semaphore
  3. context switch to TaskB
  4. 1B - low priority task start pend (flag is not set, TaskA consumed it in step 1)
  5. semaphore signaled by interrupt, TaskA become ready, context switch to TaskA
  6. 3A - high priority task set flag (in that step TaskB become ready through pgrp->OSFlagWaitList traversal)
  7. 1A - TaskA continues execution, it's priority is higher than TaskB. So 'FLAG_UNLOCKED' will be acquired again.
  8. 2A - TaskA pend on semaphore
  9. context switch to TaskB
  10. OSFlagPend continues execution in believing that flag group contains 'FLAG_UNLOCKED' flag (because of OSTCBCur->OSTCBFlagsRdy), but it's not.
    So, TaskA and TaskB in critical section, race condition...

license.txt doesn't contain the license text

Hi,

license.txt seems to be just some kind of license header, where you claim, that the source code is under Apache-2.0, but not the license itself. The Apache-2.0 license requires in 4(a):
"You must give any other recipients of the Work or Derivative Works a copy of this License; and" ...

But there is no copy of the license.

I would suggest to concatenate the text from https://www.apache.org/licenses/LICENSE-2.0.txt at the bottom of "license.txt" (just a link is not sufficient!) to comply to the license.

This should be necessary for all "uC-..." repositories.

This would help all the users of the source code at license scanning and to become license compliant.

Thank you.

Regards, Thorsten

Assessment of the difficulty in porting CPU architecture for the uC-OS2 project.

Hello everyone! I am working on implementing a tool to assess the complexity of CPU architecture porting. It primarily focuses on RISC-V architecture porting. As part of my dataset, I have collected the rt-thread project. By using scanning tools, I have determined that the porting complexity is high due to a significant amount of code related to the CPU architecture. It would require a professional team to handle this task. Is this assessment accurate? I look forward to your help and response.

Assessment of the difficulty in porting CPU architecture for the uC-OS2 project.

Hello everyone! I am working on implementing a tool to assess the complexity of CPU architecture porting. It primarily focuses on RISC-V architecture porting. As part of my dataset, I have collected the uC-OS2 project. By using scanning tools, I have determined that the porting complexity is high due to a significant amount of code related to the CPU architecture. It would require a professional team to handle this task. Is this assessment accurate? I look forward to your help and response.

file "cpu.h" is missing...

I am interested in ports/PowerPC/* ports. All of these (and in fact many other ports) all refer to a file "cpu.h" that I can't find anywhere in the repo. I tried to search this situation on google but can't find any solution.

Where would one find this file? I am using GNU gcc toolchain for ppc 32 bits big endian to do my compiling - no file cpu.h in that toolchain either.

Critical section issue in OSTimeTick

In the OSTimeTick function, is there some problem with where the critical section function is used?:

OS_ENTER_CRITICAL();

I think the critical section should be placed above this line:
ptcb = OSTCBList; /* Point at first TCB in TCB list */

Otherwise, when the current task obtains the OSTCBList, it may be interrupted before entering the critical section, and then the OSTCBList is changed. At this time, the OSTCBList used later will be wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.