uC-CPU CPU Specific Source Code

µC/CPU consists of files that encapsulate common CPU-specific functionality and CPU and compiler-specific data types. See Porting uC-OS-III.

\Micrium
    \Software
        \uC-CPU
            \cpu_core.c
            \cpu_core.h
            \cpu_def.h
            \Cfg\Template
                \cpu_cfg.h
            \<architecture>
                \<compiler>
                    \cpu.h
                    \cpu_a.asm
                    \cpu_c.c

\Micrium

Contains all software components and projects provided by Micriµm.

\Software

This sub-directory contains all software components and projects.

\uC-CPU

This is the main µC/CPU directory.

cpu_core.c contains C code that is common to all CPU architectures. Specifically, this file contains functions to measure the interrupt disable time of the CPU_CRITICAL_ENTER() and CPU_CRITICAL_EXIT() macros, a function that emulates a count leading zeros instruction in case the CPU does not provide such an instruction, and a few other functions.

cpu_core.h contains function prototypes for the functions provided in cpu_core.c and allocation of the variables used by the module to measure interrupt disable time.

cpu_def.h contains miscellaneous #define constants used by the µC/CPU module.

\Cfg\Template

This directory contains a configuration template file (cpu_cfg.h) that must be copied to the application directory to configure the µC/CPU module based on application requirements.

cpu_cfg.h determines whether to enable measurement of the interrupt disable time, whether the CPU implements a count leading zeros instruction in assembly language, or whether it will be emulated in C, and more.

\<architecture>

The name of the CPU architecture that µC/CPU was ported to. The “<” and “>” are not part of the actual name.

\<compiler>

The name of the compiler or compiler manufacturer used to build code for the µC/CPU port. The “<” and “>” are not part of the actual name.

The files in this directory contain the µC/CPU port, see Porting uC-OS-III for details on the contents of these files.

cpu.h contains type definitions to make µC/OS-III and other modules independent of the CPU and compiler word sizes. Specifically, one will find the declaration of the CPU_INT16U, CPU_INT32U, CPU_FP32 and many other data types. This file also specifies whether the CPU is a big or little endian machine, defines the CPU_STK data type used by µC/OS-III, defines the macros CPU_CRITICAL_ENTER() and CPU_CRITICAL_EXIT(), and contains function prototypes for functions specific to the CPU architecture, and more.

cpu_a.asm contains the assembly language functions to implement code to disable and enable CPU interrupts, count leading zeros (if the CPU supports that instruction), and other CPU specific functions that can only be written in assembly language. This file may also contain code to enable caches, setup MPUs and MMU, and more. The functions provided in this file are accessible from C.

cpu_c.c contains C code of functions that are based on a specific CPU architecture but written in C for portability. As a general rule, if a function can be written in C then it should be, unless there is significant performance benefits available by writing it in assembly language.

Related pages