Compilation
Both the code and comment fragments of an H file are used when processing it. Ginmake reads data definitions in the file in order to understand the physical layout of the ECU’s memory.
Comments can be used to describe objects that reside in the ECU’s memory at these locations. Additionally, specific comments can be used to describe other aspects of the ECU such as the endian-ness or Enumerations. For more information, see the “Data Definitions” section.
Build Process
For an example of the Simulink build process, see Simulink Build Process.
Multiple Header Files/Grouped Header Files (GRH)
Most firmware requires more than one H file in order to build it. Ginmake therefore needs to handle multiple headers.
This can be accomplished by passing multiple file names at the command line.
It is also possible to pass grouped header files to Ginmake.
A grouped header file is a text file listing the names of the h files (or other grh files) that should be included in the build. This file should be named with a .grh extension (Grouped H file).
Note that the h files are processed in the order of their selection or listing. Erroneous results occur if sections within the code should follow one another but the files are listed incorrectly.
Note also that the pre-processor also maintains its symbol table between included files.
Other features
Ginmake can execute several other operations through command line arguments:
- GIN Minification, a.k.a. customer GIN creation. Used to strip down an existing GIN to produce a ‘minified’ customer gin that includes only desired options, parameters, tables, and maps. See GIN Minification (Customer GIN creation) for more details.
- Simulink support through command line options, see for more details.
- Verification between a GIN’s memory addresses and its corresponding linker map file. See Verification of Memory Addresses for more details.
The Pre-processor
Ginmake implements a pre-processor. This allows the definition of symbols from within source code (with #define or EQU).
The pre-processor handles conditionals in the source code, providing that they are not within comments.
As of version 1.22, function-like macros are also supported.
Pre-processor directives that are understood by Ginmake:
- #if
- #else
- #elif
- #endif
- #ifdef If the following symbol was #defined
- #ifndef If the following symbol was not #defined
- #ifb If blank – i.e. No token following #ifb
- #iflab Checks if a symbol was defined with EQU
- #ifidn If both arguments are identical
1#pragma, #include and #line are ignored at present, and will be stripped from the code before passing onto the compiler.Ginmake defines “_ GINMAKE _” (note the double underscores). This allows you to tailor your source code for your Ginmake build.
When generating A2L, ginmake shall also define GINMAKE_A2L.
It now also defines GINVER_MAJ, GINVER_MIN.
e.g. compiling a 3.23 version GIN file, is equivalent to having:
You can define additional symbols on the command line using ‘-d’ options (see command line arguments section).
For debugging purposes, you can output the pre-processed source to a file using the ‘-z’ option. Additionally, you can dump the pre-processor symbol table using the ‘-t’ switch.
The pre-processor maintains its state between the input files it processes. It is therefore important to ensure that files are included in the correct order to ensure the correct flow of symbol definitions.
Function-like macros may be defined as follows:
1#define MYMACRO(x, y) (x * y)Note that there is no space after the macro name and the opening bracket. If a space is inserted, then the define will simply define a symbol with all of the following text as its value.
Line continuation characters are also supported. This is a backslash ‘' and must be the last character on the line. This is useful if you have a long macro definition and wish to write it on several lines:
1#ifdef __GINMAKE__
2#define LINEAR_INTERP(x, width, x0, x1) (x0 + (x \* (x1 - x0)) / (width – 1))
3#define BILINEAR_INTERP(x, y, width, height, y0x0, y0x1, y1x0, y1x1) \
4 LINEAR_INTERP(y, height, \
5 LINEAR_INTERP(x, width, y0x0, y0x1), \
6 LINEAR_INTERP(x, width, y1x0, y1x1))
7#endifName Lookup
Names are all looked up case-insensitively.
For example, defining a map called “Fuel” could be referenced with the name “fUeL”.