⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 c的源码
💻 TXT
字号:
/*
***********************************************************************************
*                                    uC/OS-II
*                             The Real-Time Kernel
*                 ADSP-21065L SHARC Specific Code version 1.1
*
*                              INSTALLATION NOTES
*
*
* By   : Bertrand Hurst, Francois Veuve, Cedric Bornand (dspos@engineer.com)
*        CETT (eivd)
*        Rte de Cheseaux 1
*        1400 Yverdon
*        Switzerland
***********************************************************************************
*/

This file contains:

0) Changes from previous version
1) "ADSP-21065L SHARC Specific Code" package content description
2) Short explanations about the provided files
3) Used ressources, software restrictions
4) How to compile and run
5) Common timings and memory usage
6) License agreement
7) Warranty disclaimer

***********************************************************************************

0) Changes from previous version

Welcome to the uC/OS-II SHARC port version 1.1! This package contains
the following improvements:
- A bug fix, when creating a task: the parameter is now correctly passed;
- An improvement in size, using functions rather than macro to push and
  pop registers in assembly;
- A speed improvement when switching tasks, due to a more efficient
  assembly code to push and pop registers;
- Includes.h and os_cfg.h files for the given example are now included;
- Some explanations in this documents are improved, mostly about
  compiling and running the example

***********************************************************************************

1) "ADSP-21065L SHARC Specific Code" package content description

This package contains all the files needed to make uC/OS-II running
on an ADSP-21065L SHARC DSP from Analog Devices.

Other SHARC processors (21060, 21061 and 21062) have not been tested
yet. You'll have to modify some lines about registers names and so on,
more details are provided in section 2 below.

There should be 7 files in this package:

readme.txt      This file
os_cpu.h        Type definition file
os_cpu_c.c      C functions for the SHARC port
os_cpu_a.asm    Assembly functions for the SHARC port
example.c       A small example program, that toggles two FLAG lines
os_cfg.h        uC/OS-II config file for the given example
includes.h      Main include file for VDSP IDE

***********************************************************************************

2) Short explanations about the provided files

2.1) File os_cpu.h

There is not much to tell about that file. It contains the definition
of all the types used in the other files, to ensure that the C source
code of uC/OS-II may be compiled. Just note that all registers and the
memory are 32-bits wide in the SHARC DSPs, so 8- and 16-bits types are
mapped in 32-bits.

2.2) File os_cpu_c.c

This file just contains the OSTaskStkInit function. Please have a look
to the section 3 below, it gives some important information about stack
usage. Stack initialization has been modified in order to correctly
pass the new task's parameters pointer.

The empty hook functions described in that file are called accordingly
to uC/OS-II standard, and may be used for any purpose that you'll find
suitable.

2.3) File os_cpu_a.asm

First, note the "#include <def21065l.h>" instruction at the beginning
of the file. You'll have to change this if you want to make uC/OS-II
running on another type of SHARC (-60, -61 or -62).

Then, there is a declaration for a variable named 'temp', that is
used to save a register when switching stacks and working with
the hardware stack of the DSP. This variable replaces the use of
the PX register made in version 1.0.

After some .global and .extern statements, there is a small function
called _TickVect. It contains 4 instructions, that are placed in the
interrupt vector table location of the low priority timer interrupt.
After this, there are five functions. The first one, _TimerInit, is a new
function that is not described in the uC/OS-II standard. It is used to
initialize the OS timer; see the section 2.4 below to have an example of
how to call that function. _TimerInit is the only function that has to
be modified in order to run the OS on other SHARC DSPs (-60, -61 or -62).
Note that the running frequency of 60 MHz is used to calculate the tick
period. Note the few first instructions that place the _TickVect function
at the right place in the interrupt vector table. The addresses of the
low priority timer vector instructions also have to be changed for other
SHARCs. The next function is _OSStartHighRdy; just note that some
circular buffers registers are zeroed, to avoid some strange behavior
when using many stacks (the C compiler initializes those circular buffers
to avoid memory crashes, but such a case should never occur in a normal
program execution). Then, we have _OSCtxSw. The seven first instructions
are needed to correct the return address stored in the stack, because the
C compiler does not save the same PC when servicing an interrupt or when
calling a function (and that particular function is called and ends with
a RTI). The _OSIntCtxSw function is quite the same, but begins with
some instructions needed to remove unused return addresses from the
stack. Finally, _OSTickISR is called each time the timer generates an
interrupt.

Finally, there are two functions used to push and pop all the registers.
They replace the macros used in version 1.0. The last 8 instructions of
the pop_reg function are needed to extract the return address stored on
the stack, in order to perform a RTI (ReTurn from Interrupt) instruction
from a called function.

2.4) File example.c

This file is just provided to help compiling a first program. It just
toggles the FLAG 1 and 2 output at a different rate.

Just note in the TaskStart function that the TimerInit() function is
called to initialize the DSP timer.

2.5) File os_cfg.h

This file has been added to make the compilation of the above example
easier.

2.6) File includes.h

Again, this file is provided for an easy compilation of the example code.

***********************************************************************************

3) Used ressources, software restrictions

The only ressource used by the OS is the timer 0. In the -65L DSP, you
have two timers, so there is one left for your application. If you
want to use that code on another SHARC, there won't be any more timer
for your application.

There are some restrictions about the application software. As saving
all registers takes a LOT of time (more than 80 registers!), some
optimizations have been made: the stacks do not contain every
registers. Here is the list of the unsaved registers:

Registers           This means that...
---------           ------------------
B0-B15, L0-L15      No circular buffers may be used
I6, I7              Stack and frame ptr, used by the C compiler. Don't
                    use them for any other purpose!
M5, M13             Always 0 (needed by the C compiler, do not modify)
M6, M14             Always +1 (idem)
M7, M15             Always -1 (idem)
MRx, PX             Message and PX registers may be used by only 1 task
LOOP regs           There is a 6 locations hardware loop stack in the
                    SHARC. Be carefull when using loops in different
                    tasks: the stack behaves as if you have nested loops!

All these restrictions are also made by the C compiler, so, as long as
you don't code anything in assembly, you won't have to worry.

WARNING!!! Pay attention to the provided C runtime library!!! It contains
assembly functions that may use some of the above registers!!! So be
very carefull when using runtime library functions...

***********************************************************************************

4) How to compile and run

All tests have been made with VisualDSP v. 4.x. It is assumed that you have
installed the uC/OS-II floppy disk.

a) Create a new directory, and copy into it all files of the SHARC port and
   all the uC/OS-II source files (they are found in the 'source' subdirectory
   created when installing uC/OS-II floppy).
b) Create a new VDSP project in the same directory. In the project options,
   choose as target TYPE a 'DSP executable file' for an 'ADSP-21065L'
   PROCESSOR. In the COMPILE and the ASSEMBLE tabs, check the 'generate debug
   information' boxes. Other default options are all right.
c) Add the following files to your project (and not any other):
   - os_cpu_c.c......from this package;
   - os_cpu_a.asm....from this package;
   - example.c.......from this package;
   - ucos_ii.c.......from uC/OS-II source.
d) Check that the uC/OS-II C source files are properly included in ucos_ii.c
   regarding their path, modify it to reflect your installation (you can
   delete the path before each file name to use the local copy of them).
e) Build the entire project. You should receive neither warning nor errors.
f) Run the debugger. Place one breakpoint on each OSTimeDly() instruction
   in the for(;;) statements of the tasks. Run the program, it stops 5 times
   in task 1 for each stop in task 2.

***********************************************************************************

5)  Common timings and memory usage

The provided example code requires about 3000 instructions, and 2100 32 bits
data words. When modifying the os_cfg.h file to enable all uC/OS-II functions,
the total amount of memory required reaches 4600 instructions and 2600 data
words. The on-chip memory of the 65L can host 6k instructions and 8k data words

With a 60 MHz DSP, a task switch takes less than 5 microsecond (time measured
between the two breakpoints suggested in 4.f when both delays are expired).

***********************************************************************************

6) License agreement

THE TERMS AND CONDITIONS THAT APPLY TO  礐/OS-II ALSO APPLY TO THE 
ADSP-21065L SHARC Specific Code.

***********************************************************************************

7) Warranty disclaimer

YOU USE THIS SOFTWARE AT YOUR OWN RISK. THE AUTHORS WON'T
BE LIABLE FOR ANY SPECIAL OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT 
LIMITED TO LOSS OF PROFITS) WHILE USING OR MISUSING THIS SOFTWARE.

********************************* End of file *************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -