•data_area: This is a typeless pointer to the different category-depend-
ent data structures that hold type-specific information for the assigned drivers. It is a typeless pointer, since no common structure can be used to store the diversity of parameters for all the drivers.
The array of these structures has no predefined length and therefore requires a special end marker to prevent RoBIOS from running past the last valid entry. This final entry is denoted as:
{END_OF_HDT,UNKNOWN_SEMANTICS,"END",(void *)0}
Apart from this marker, two other entries are mandatory for all HDTs:
•WAIT: This entry points to a list of waitstate values for the different
chip-access times on the controller platform, which are directly derived from the chosen CPU frequency.
•INFO: This entry points to a structure of numerous basic settings, like
the CPU frequency to be used, download and serial port settings, network ID, robot name, etc.
Program B.2 is an example of the shortest valid HDT.
Program B.2: Shortest valid HDT file
1 |
#include "robios.h" |
2 |
int |
magic = 123456789; |
3 |
extern HDT_entry_type HDT[]; |
4 |
HDT_entry_type *hdtbase = &HDT[0]; |
5 |
/* Info: EyeBot summary */ |
6 |
7 |
info_type roboinfo = {0, VEHICLE, SER115200, RTSCTS, |
8SERIAL1, 0, 0, AUTOBRIGHTNESS, BATTERY_ON, 35, 1.0,
9"Eye-M5",1};
10/* waitstates for: ROM, RAM, LCD, IO, UART */
11waitstate_type waitstates = {0,3,1,2,1,2};
12
13HDT_entry_type HDT[] =
14{ {WAIT,WAIT,"WAIT",(void *)&waitstates},
15{INFO,INFO,"INFO",(void *)&roboinfo},
16{END_OF_HDT,UNKNOWN_SEMANTICS,"END",(void *)0}
17};
The descriptions of all the different HDT data structures can be found in Appendix C. Together with the array of component structures, the used data structures build up the complete source code for an HDT binary. To obtain a downloadable binary image the HDT source code has to be compiled with the special HDT batch commands provided with the RoBIOS distribution. For example:
gcchdt myhdt.c -o myhdt.hex
The HDT code is compiled like a normal program except for a different linker file that tells the linker not to include any start-up code or main() func-