| 1 |
471 |
julius |
OpenRISC 1000 uc/OS-II port
|
| 2 |
|
|
===========================
|
| 3 |
|
|
|
| 4 |
|
|
Port of Micrium's uC/OS-II "real-time" kernel, version 2.91.
|
| 5 |
|
|
|
| 6 |
|
|
Current status of the port is that it can run several tasks and make use of
|
| 7 |
|
|
timer and UART output.
|
| 8 |
|
|
|
| 9 |
|
|
Project is configured so that adding own set of tasks to run is simple.
|
| 10 |
|
|
|
| 11 |
|
|
Setting up the project
|
| 12 |
|
|
======================
|
| 13 |
|
|
|
| 14 |
|
|
First, to set up the project to build, the uC/OS-II kernel source must be
|
| 15 |
|
|
downloaded from the Micrium site (registration required):
|
| 16 |
|
|
|
| 17 |
|
|
http://micrium.com/page/downloads/os-ii_evaluation_download
|
| 18 |
|
|
|
| 19 |
|
|
Once downloaded, extract the contents and copy all C source from the
|
| 20 |
|
|
Micrium/Software/uCOS-II/Source/ path to the ucos/ path in this project. Eg:
|
| 21 |
|
|
|
| 22 |
|
|
cp ~/Downloads/Micrium/Software/uCOS-II/Source/*.c ~/path/to/this/ucos
|
| 23 |
|
|
|
| 24 |
|
|
Tasks
|
| 25 |
|
|
=====
|
| 26 |
|
|
|
| 27 |
|
|
uC/OS-II is a task-oriented kernel, and this project has been set up to allow
|
| 28 |
|
|
easy creation of a simple set of tasks to run on the kernel port.
|
| 29 |
|
|
|
| 30 |
|
|
Each file in tasks/ contains a set of tasks to be run on the kernel. Each time
|
| 31 |
|
|
the entire project code is compiled into a new executable to run on the
|
| 32 |
|
|
simulator or the board, one of these files is chosen (via the TASKS environment
|
| 33 |
|
|
variable at compile time) as the set of tasks to run.
|
| 34 |
|
|
|
| 35 |
|
|
Building and running an example
|
| 36 |
|
|
===============================
|
| 37 |
|
|
|
| 38 |
|
|
1. Build the port (with example set of tasks) with:
|
| 39 |
|
|
|
| 40 |
|
|
make distclean all TASKS=1
|
| 41 |
|
|
|
| 42 |
|
|
2. Run the example application with:
|
| 43 |
|
|
|
| 44 |
|
|
or32-elf-sim -f sim.cfg ucos-tasks1.or32
|
| 45 |
|
|
|
| 46 |
|
|
The simulator should then open a new terminal window. Press enter and a simple
|
| 47 |
|
|
application showing multi-tasking and console output. Press 'q' and then enter
|
| 48 |
|
|
and wait for the simulation to exit gracefully.
|
| 49 |
|
|
|
| 50 |
|
|
Adding own tasks
|
| 51 |
|
|
================
|
| 52 |
|
|
|
| 53 |
|
|
1. Add new file to tasks/ directory, named tasksX.c, where X is an alphanumeric
|
| 54 |
|
|
string or just a number.
|
| 55 |
|
|
Note: When compiling X will be passed via the TASKS environment variable to
|
| 56 |
|
|
indicate that this tasks file, tasksX.c, is the source to be compiled and
|
| 57 |
|
|
included in the application. At least one example, tasks1.c is included
|
| 58 |
|
|
in this project, and is compiled with "make all TASKS=1".
|
| 59 |
|
|
|
| 60 |
|
|
2. Make sure the file contains at least the function TaskStartCreateTasks(void)
|
| 61 |
|
|
which will be called from the main task launcher, TaskStart() in
|
| 62 |
|
|
common/main.c and is the main entry point for all custom tasks.
|
| 63 |
|
|
See the file tasks/tasks1.c for an example of the contents of this function.
|
| 64 |
|
|
|
| 65 |
|
|
3. Once the tasksX.c is finished, compile with the following in the main
|
| 66 |
|
|
folder:
|
| 67 |
|
|
|
| 68 |
|
|
make all TASKS=X
|
| 69 |
|
|
|
| 70 |
|
|
4. Run the resulting executable in or1ksim:
|
| 71 |
|
|
|
| 72 |
|
|
or32-elf-sim -f sim.cfg ucos-tasksX.or32
|
| 73 |
|
|
|
| 74 |
|
|
Authors:
|
| 75 |
|
|
Tim Oliver, timtimoliver@yahoo.co.uk
|
| 76 |
|
|
http://www3.ntu.edu.sg/home5/p014082819/index.html
|
| 77 |
|
|
|
| 78 |
|
|
Julius Baxter, julius@opencores.org
|