Porting UCOS II

Source: Internet
Author: User

Porting UCOS II

 

To run μC/OS-ⅱ properly, the processor must meet the following requirements:

1. The C compiler of the processor can generate reusable code.

2. enable or disable the interrupt in C.

3. The processor supports interruption and can generate scheduled interruption (usually between 10 to Hz ).

4. The processor supports a hardware stack that can hold a certain amount of data (may be several thousand bytes ).

5. The processor reads and stores the stack pointer and other CPU registers into the stack or memory.

Baidu click "reentrant code ". Reentry code is also called pure code. It is a code that allows multiple processes to access at the same time.

Ucos ii is a preemptible kernel. It is understandable to have such requirements. If this task calls this code, it is complete. When the next task calls it, it becomes incomplete. What should I do next? This reminds me of the first time a girl was writing.

According to the above requirements, in fact, in practice, there are very few microprocessor compatible with ucos ii. Therefore, you can use ucos ii with confidence, boldness, and arrogance.

 

In general, to port ucos ii to a chip, you only need to modify the following three files: OS _cpu.h, OS _cpu_c.c, OS _cpu_a.asm.

Specifically, porting mainly includes the following items:

(1). OS _cpu.h: Use # define to set some constant values, declare 10 data types, and use # define to declare three macros.

(2). OS _cpu_c.c: Write six simple functions in C language.

(3). OS _cpu_a.asm: Compile four assembly language functions.

At first glance, the workload and difficulty of porting ucos ii are very small. But it is not easy for a beginner. It requires familiarity with microprocessor, assembly, and ucos ii.

In the mc21's project, mc21's students carried forward the spirit of the doctrine and directly referred to the template provided by Zhou ligong.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.