■ SCREENSHOT 1. Right-clicking on the project in the
Project Manager window will reveal a drop-down menu
that points you to Manage Libraries > Header Files which
will get you to this point.
libraries via the Vinculum-II IDE editor.
Screenshot 3 reveals the VOS Kernel Services header
files while Screenshot 4 scrolls down to the Runtime
headers. As you have most likely already concluded, there
are library files that are associated with the header files and
they can be seen in Screenshot 5. If a library is included in
an application, its associated header file must also be
included in the application.
APPLICATION SOURCE CODE
VOS Kernel Services, device drivers, and API calls are
major parts of the Vinculum-II application code big picture.
However, we can’t write an application by simply including
libraries and headers into our Vinculum-II application
source code. So, let’s practice what we preach and begin
by coding up an initial Vinculum-II application header file.
INSIDE THE APPLICATION HEADER
The application programmer guide application note
states that the first thing we should include in our
application header file is the size of the stack memory that
the application thread will require:
#define SIZEOF_FIRMWARE_TASK_MEMORY 0x1000
16 October 2010
The stack memory size of 0x1000 is overkill by design.
After successfully compiling, loading, and running the
application we’re about to discuss and build with the 0x1000
value, I was able to get the application to run reliably with a
stack size of only 0x0400. Thus, the stack memory size
value is dependent on the complexity of your application.
■ SCREENSHOT 2. You get here the same way you get
to the window in Screenshot 1 by choosing Library Files
instead of Header Files from the drop-down menu.
The next recommended programming action is to fix a
number of devices that the application will use:
#define NUMBER_OF_DEVICES 5
#define VOS_DEV_USB_HOST1 0
#define VOS_DEV_BOMS 1
#define VOS_DEV_USB_HOST2 2
#define VOS_DEV_UART 3
#define VOS_DEV_GPIO 4
Each device we list must have a unique device identifier
which is used later by the Device Manager. If you’re having
problems with the pair of HOST definitions, recall that the
Vinculum-II IC has a pair of USB portals. These portals can
be identified in Schematic 1 as USB1 and USB2. The last
entry in our application header file is a forward declaration
to the user-generated application thread which is really no
more than a C function. A forward declaration is coded for
each thread in the application. In our case, we only have one:
With the application-specific header file code
completed, we can move on into the application’s source
code file which we will call DesignCycle-App.c. Naturally,
the application header file we just coded is named
DesignCycle-App.h. Our first order of business is standard C
fare. We will offer sacrifices unto the #include gods:
You will recognize the aforecoded #include statement
arguments as members of the resident Kernel header files
(see Screenshot 3). The VOS Kernel Services header file
vos.h is a must-have as it supports the Kernel library which
is the core power behind our application. Our application
#include list acts as a guide for the device driver files we