TOC PREV NEXT INDEX DOC LIST MASTER INDEX



The No-Kernel Program

With Rational Exec, you can build a program with minimal runtime and no kernel. An example is provided in Example - Programs That Live In ROM But Execute Out Of RAM..


Overview of No-Kernel Programs

The no-kernel progam provides:

The no-kernel does not support:

Excluding the items that the no-kernel does not support reduces the size of the code to an absolute minimum.


Warning: Use of any Ada tasking or Ada new operations results in a link-time error.

Executing any code that raises a predefined Ada exception (Constraint_Error, Numeric_Error, Program_Error, Storage_Error, Tasking_Error) crashes the program. These exceptions are triggered by machine exceptions and can be examined with the debugger.

Executing any code that raises user-defined exceptions results in a call to V_Nk_Conf.V_User_Exception.

For MIPS targets, floating point exceptions are not handled. If your MIPS target has a floating-point coprocessor and your code uses floating point operations, it must not produce any underflow, overflow, or NaN machine exceptions.


Configure a No-Kernel Program

To create a no-kernel program, first create a new view using the associated no-kernel model for the BSP. For example:

An example of a no-kernel program is in:

The Policy/Switch KERNEL_START contains the starting location of the no-kernel program.

The pragma.1.ada file must be in the same view as the no-kernel program and must have the contents:

Note: When executing the debugger with the no-kernel, expect the error message:


Example - Programs That Live In ROM But Execute Out Of RAM.

Sometimes it is desirable to have a program be placed in ROM (EPROM) but actually executed in RAM. One reason you might want to do this is performance. ROM typically has an access time in the 150ns range whereas RAM is in the 10-70ns range. Additionally, many boards are not able to cache ROM locations. Because of these factors, performance reductions of 5-10:1 are not uncommon.

In this section, we outline a method for having some ROM resident start-up code copy a program out of ROM into RAM and then start it up.

The basic idea is to use two separate programs. Program_1 (the one that does the copying) is linked to execute in ROM, while the other, Program_2 (the one that is copied), is linked to execute out of RAM. You start up Program_1 in ROM, it copies Program_2 from ROM to its proper location in RAM, flushes the data cache and invalidates the instruction cache (if present), then transfers control to the Program_2.

To write Program_1, use the nk_krn_conf.ss "no kernel" configuration view as a base. The following example is for the MIPS architecture, but a similar approach can be taken for other architectures by just changing the addresses and possibly removing the call to V_Cache.Push_D_Invalidate_I.

with this procedure in V_Nk_Main and call it from there.

This technique can easily be extended to copy more than one program. For example, the kernel and user programs could both be copied using a second set of definitions and two more lines of code to do the copy and flush the cache. Note, recall that the entry point for a kernel/user program combination is the kernel's entry point (typically KERNEL_START).

Program_2 is linked as if it were executing in RAM, that is, no changes are necessary to the user and kernel program's Link.des files. Once you have a VOX file, convert it to Motorola S-record format using Tools > Convert. With this file, you can download to your EPROM programmer, but this is where everything must be set up right for your program to be loaded in the correct location in EPROM. The idea is that you want the programmer to use the first address in the S-record file as "logical address 0" and to start loading at some specific offset in the EPROM that you've chosen. This may sound confusing, so here is an example:

Suppose that I want to reserve 8K of code for my RESET hardware init and Program_1 code. This means that I want Porgram_2's code to start at 16#2000# in the EPROM. This address is independent of where I want it to execute when it's in RAM. Suppose the address in RAM is 16#8003_0000#; this means that my S-record file will contain addresses starting at 16#8003_0000#. So I need a way to tell the programmer that 16#8003_0000# is really address 0 and that to start loading the code in the programmer's memory at address 16#2000#.

With the DATA I/O series of programmers, this is quite simple. When I instruct the programmer to download a file from a serial port, it prompts for three values: the beginning address (16#2000# in my case), the block size (not important here, I'll use 0), and the offset address (in my case 16#FFFF_FFFF#). For the DATA I/O, an offset address of 16#FFFF_FFFF# has a special meaning - it causes the first data byte received to be stored at the beginning address and subsequent data bytes received to be stored in subsequent locations. So what happens is exactly what I want, the data starting at 16#8003_0000# gets loaded starting at address 16#2000# in the EPROM.

Other EPROM programmers may have similar features. Refer to your programmer's manual for details.

If you want to start a user program as opposed to TDM, you will need to copy an image of the kernel to RAM. Both areas cache must be flushed, then transfer control to the entry point of the kernel, KERNEL_START.


Rational Software Corporation 
http://www.rational.com
support@rational.com
techpubs@rational.com
Copyright © 1993-2002, Rational Software Corporation. All rights reserved.
TOC PREV NEXT INDEX DOC LIST MASTER INDEX TECHNOTES APEX TIPS