Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The table below shows the name of µC/CPU files and where they should be placed on the computer used to develop a µC/OS-III-based application. The file names in bold are files you will need to create or modify for your own port.

Panel


FileDirectory
cpu_bsp.c\Micrium\Software\uC-CPU\BSP\Template\cpu_bsp.c
cpu_def.h\Micrium\Software\uC-CPU\
cpu_cfg.h\Micrium\Software\uC-CPU\CFG\Template
cpu_core.c\Micrium\Software\uC-CPU\
cpu_core.h\Micrium\Software\uC-CPU\
cpu.h\Micrium\Software\uC-CPU\<processor>\<compiler>
cpu_c.c\Micrium\Software\uC-CPU\<processor>\<compiler>
cpu_a.asm\Micrium\Software\uC-CPU\<processor>\<compiler>



Panel
bgColor#f0f0f0

<processor> is the name of the processor that the cpu*.* files apply to.

<compiler> is the name of the toolchain (compiler, assembler, linker/locator) used. Each has its own directory because they may have different features that makes them different from one another.

cpu_bsp.c

This file contains skeleton functions for CPU_TS_TmrInit()CPU_TS_TmrRd() and other time stamp related functions. You can copy this file to your Board Support Package (BSP) directory, modify its content and add it to your build.

...

The table below shows the name of µC/CPU ‘template’ files you should use as a starting point should you decide to start a µC/CPU port from scratch. It’s highly recommended that you copy these files to folders that matches the layout shown in this table. You would then edit these files to build up your own µC/CPU port files. Again, refer to the µC/CPU User’s Manual (uC-CPU-Manual.pdf) found in \Micrium\Software\uC-CPU\Doc.

Panel
titleµC/CPU Template Files


File

Directory

cpu.h

\Micrium\Software\uC-CPU\Template

cpu_c.c

\Micrium\Software\uC-CPU\Template

cpu_a.asm

\Micrium\Software\uC-CPU\Template


cpu.h

Many CPUs have different word lengths and cpu.h declares a series of type definitions that ensure portability. Specifically, we don’t use the C data types intshortlongcharetc. at Micrium. Instead, clearer data types are defined. Consult your compiler documentation to determine whether the standard declarations described below need to be changed for the CPU/compiler you are using. You should note that the typedefs below are not all grouped together in cpu.h and also, cpu.h contains additional comments about these data types.

Code Block
titleµC/CPU Data Types
          typedef            void        CPU_VOID;
          typedef  unsigned  char        CPU_CHAR;              
          typedef  unsigned  char        CPU_BOOLEAN;           
          typedef  unsigned  char        CPU_INT08U;            
          typedef    signed  char        CPU_INT08S;            
          typedef  unsigned  short       CPU_INT16U;            
          typedef    signed  short       CPU_INT16S;            
          typedef  unsigned  int         CPU_INT32U;            
          typedef    signed  int         CPU_INT32S;            
          typedef  unsigned  long  long  CPU_INT64U;            
          typedef    signed  long  long  CPU_INT64S;            
          typedef            float       CPU_FP32;              
          typedef            double      CPU_FP64;              
          typedef  volatile  CPU_INT08U  CPU_REG08;             
          typedef  volatile  CPU_INT16U  CPU_REG16;             
          typedef  volatile  CPU_INT32U  CPU_REG32;             
          typedef  volatile  CPU_INT64U  CPU_REG64;             
          typedef            void      (*CPU_FNCT_VOID)(void);  
          typedef            void      (*CPU_FNCT_PTR )(void *);
          typedef  CPU_INT32U            CPU_ADDR;
          typedef  CPU_INT32U            CPU_DATA;
          typedef  CPU_DATA              CPU_ALIGN; 
          typedef  CPU_ADDR              CPU_SIZE_T;
          typedef  CPU_INT32U            CPU_STK;             (1)
          typedef  CPU_ADDR              CPU_STK_SIZE;
          typedef  CPU_INT16U            CPU_ERR;
          typedef  CPU_INT32U            CPU_SR;              (2)
          typedef  CPU_INT32U            CPU_TS;              (3)


Panel
bgColor#f0f0f0

(1) Especially important for µC/OS-III is the definition of the CPU_STK data type, which sets the width of a stack entry. Specifically, is the width of data pushed to and popped from the stack 8 bits, 16 bits, 32 bits or 64 bits?

(2) CPU_SR defines the data type for the processor’s status register (SR) that generally holds the interrupt disable status.

(3) The CPU_TS is a time stamp used to determine when an operation occurred, or to measure the execution time of code.


cpu.h also declares macros to disable and enable interrupts: CPU_CRITICAL_ENTER() and CPU_CRITICAL_EXIT(), respectively. The documentation in the template file explains how to declare these macros.

...

CPU_CRITICAL_METHOD_STATUS_LOCAL 

cpu.h also declares function prototypes for a number of functions found in either cpu_c.c or cpu_a.asm.

...