Aim: Compile the display source code for a static screen without any animation logic and execute it on Raspberry Pi.
2. A. On the Host
Note: You can skip steps 1-11 if you use the files from Lesson 2 under the folder CodeForPi.
Navigate to SCADE Examples in the install location using File Browser and make a copy of the FlightControlDisplay example.
Figure 2a: Snapshot of the changes to be made to the Structure tab in the SCADE Display model
Figure 2b: Snapshot of the Structure tab after LightContainer is deleted
Figure 2c: Snapshot of the Dictionary to delete JV_Alti_Alarm
Figure 2d: Snapshot of the Properties selection
Figure 2e: Selection of the screen resolution under the Specification tab
Figure 2f: Snapshot of the file structure of the files copied into the new code folder
scp -r code\ pi@<PI_IP_ADDRESS>:/home/pi/Desktop/OGLX/SDYOGLX67/examples/PiPFD
2. B. On the Raspberry Pi
Note: You can skip steps 1-3 if you use the updated specific.c and main.c from the src folder under Lesson 2 in CodeForPi.
Figure 2g: Snapshot of the src folder on the Raspberry Pi
#include “aol_static_sequences.h” - line 31
aol_static_sequences(); - line 156
static sgl_parameters lParameters; - line 45
ul_screen_width = getW(); - line 51
ul_screen_height = getH(); - line 52
pb_texture_buffer = SGL_NULL; - line 53
ul_texture_max_width = 0; - line 54
ul_texture_max_height = 0; - line 55
p_texture_attrib = SGL_NULL; - line 56
ul_number_of_textures = 0; - line 57
p_gradient_attrib = SGL_NULL; - line 58
ul_number_of_gradients = 0UL; - line 59
static SGLbyte glob_tub_texture_buffer
[4 * SGL_TEXTURE_MAX_WIDTH * SGL_TEXTURE_MAX_HEIGHT]; - line 67
sgl_texture_attrib *glob_texture_attrib
= malloc(sizeof(sgl_texture_attrib) * getTextureTableSize()); - line 68
static sgl_parameters lParameters; - line 69
ul_screen_width = getW(); - line 71
ul_screen_height = getH(); - line 72
pb_texture_buffer = glob_tub_texture_buffer; - line 73
ul_texture_max_width = SGL_TEXTURE_MAX_WIDTH; - line 74
ul_texture_max_height = SGL_TEXTURE_MAX_HEIGHT; - line 75
p_texture_attrib = glob_texture_attrib; - line 76
ul_number_of_textures = getTextureTableSize(); - line 77
sglInit(&glob_s_context, &lParameters); - line 61
The following image show how the code should look:
Figure 2h: Snapshot of the changes to be made in the main.c file
gcc -o out main.c specific.c ../code/*.c ../../../extras/utils/src/*.c
../../../lib/libOGLX.a -I../code/ -I../src/ -I../../../include/
-I../../../extras/opengl/ -I../../../extras/utils/include
-L/usr/lib -lX11 -lGL -lglut -lm
./out
Figure 2i: Executable generated using GCC without animation