Software Platform Builder Tutorial - Create the Software Platform
Frozen Content
Tutorial - Getting Started with the Software Platform Builder
First Steps
Create the Software Platform
Write the Application Code
Build and Download
Simplify the Application Code
To start, we need to add a special document to the embedded project which is used to define the Software Platform. We do this by creating software stacks.
- Right-click on the embedded project and select Add New to Project » SwPlatform File.
The documentSoftwarePlatform1.SwPlatform
is added to the embedded project.
- To save the new document, click the Workspace button and select Save All.
The Save [...] As dialog appears.
Choose a sensible name for your file such asPS2_Echo_SP.SwPlatform
.
Now we need to build our platform to take care of the lower level processes for the peripherals on the hardware design. Keep in mind that although the Terminal Instrument is not a physical device on the NanoBoard, it is still a peripheral that is part of the design for which we need software to access it. The easiest way to add the necessary software is to synchronize the document with the hardware design.
- Click the Import From FPGA Project button.
In the Device Stacks section you will see two wrappers. A wrapper provides software to access the peripheral device at the lowest level. The PS2 Controller wrapper contains base addresses and flags used to access the lines of the PS/2 port.
Next to the PS2 Controller wrapper is the TERMINAL wrapper. Again, at this lowest level, it simply defines base addresses and flags used to access the Terminal instrument.
Your document should appear as shown below.
The Software Services section below displays Interrupt Management, Software Platform Configuration and Software Timing Services. These are system services and are always present in the Software Platform.
You can consider the two software wrappers as the lowest level of a stack. Let's extend the two stacks to higher abstraction levels.
Click on the PS2 Controller wrapper to highlight it.
- Select the PS/2 Controller wrapper and click the Grow Stack Up... button, in the Actions region of the document.
The Grow Stack dialog opens.
The dialog shows all possibilities for adding new functionality to the PS/2 Controller stack, which is currently just a wrapper. Because we want to plug a keyboard into the PS/2 connector (not a mouse), we need the first stack. It contains two drivers (a PS/2 Driver and a PS/2 Keyboard driver) and a Keyboard I/O Context on top. Contexts are blue colored and provide an API at the highest abstraction level: hardware independent functionality for your application.
The PS/2 and PS/2 Keyboard drivers provide functionality to open and intialize a keyboard, and translate the raw data from the PS/2 port to keyboard scancodes. The Keyboard I/O Context provides a standard C interface with input and output functions.
- Select the Keyboard I/O Context.
- Click OK to confirm.
The Keyboard I/O Context should now be added to your software platform, along with the items which were below it in the Grow Stack dialog - the PS/2 Driver and the PS/2 Keyboard Driver. Apart from the modules you just added to the stacks, a service has been included in the platform: the Generic Device I/O service. (Verify this in the Software Services section.) This software service provides basic device I/O functionality that enables you to access intrinsically non-standard I/O devices in a standard way. It is not exclusively associated with any specific peripheral.
Now extend the stack of the Terminal peripheral in a similar way.
- Select the Virtual Terminal Instrument wrapper and click the Grow Stack Up button.
Again, the Grow Stack dialog appears.
The dialog now shows one driver (colored yellow) and two context modules (both colored green). We only need the Serial Device I/O Context.
- Select the Serial Device I/O Context and click OK to confirm.
Like for the Keyboard I/O Context module, also for this module the Generic Device I/O service is added. Since it was already on the document, no extra changes are made.
The Software Platform document is now ready and should appear as shown below.
- Save your work with Workspace » Save All.
Getting Help and Information
You can get detailed information on using stack items and services from the Software Platform Builder document itself:
To get help specifically about the API of a service:
- Select a service in the Software Services Section and click the API Reference button or press F1.
To get help specifically about the API of a stack item:
- Right-click on a stack item in the Device Stacks section and select API Reference or select the stack item and press F1.
To inspect the public header file(s) of a stack item:
- Right-click on a component in the Device Stacks section and select Header Files » name.h