Changes between Version 34 and Version 35 of Projects/GSoC/ApplicationConfigurationGUI

Sep 17, 2013, 12:01:44 AM (6 years ago)

/* Possible Goal Extensions beyond the Main Objective */


  • Projects/GSoC/ApplicationConfigurationGUI

    v34 v35  
    4747The Graphical User Interface is created on the MVC(Model View Controller) framework. In the GUI ,the Model is the conf.t file where definitions of the macros are present. The View is file which handles with creating the GUI. The Controller is the file.
     50= Flow of Control of the GUI (useful while editing code) =
     53When you open the executable the file is opened. 
     54After which the __init__ function is called in the It is responsible for opening the first dialog box. The first dialog box has a Open button in it.
     55On clicking the open button, the function OnOpen is called.
     56The OnOpen function is responsible for
     57a) Getting the path of conf.t 
     58b) Opening conf.t   
     59c) Reading conf.t and feeding it to the text parser (In this step, the return_parameters module in the file is called. It parses all the necessary information from conf.t)
     60d) After getting the Output from the text parser, feeding the output to the for UI creation.
     61In the GUI, the set_parameters function is called with the data fetched from the text parser. This function is a setter function and it sets the value of the global variable parameters and then calls the main function of the GUI.
     62The main function initialises the GUI and launches the Application. Before dynamically creating the GUI, it parses out exact default values to be put in the UI.
     63Now according to user input the following cases may arise-
     64a) The user presses Save button. In this case the OnSave function will be called. The OnSave function makes use of Python's config parser module and writes the pair (macro name, current value) into the configuration.ini file.
     65b) The user presses the Check button. In this case the OnCheck function will be called. The OnCheck function uses regular expressions to see whether the macro values are in format or not.
     66c) The user presses the Load button.The OnLoad function is called. In this case the values stored in the configuration.ini file are loaded into the GUI.
     67d) The user presses the Generate button. The OnGenerate function is called. In this case the create_header function will be called which is present in the The sees if the value is same as the older value or the user has changed it. In case the user has changed the value, then it gets written into the header file.
     69= Using generated header with Applications =
     72For using the header there are basically 3 major steps-
     74Step 1) Get the Application-
     76You need to have the application in which you want to use the header.
     77For example- to use an application from examples-v2 you would need to clone the examples v2 repository (
     78You can do this easily by - git clone git://
     79examples-v2 has a lot of sample applications. You can choose any one of them to use with the header.
     80For the purpose of this tutorial I will choose the ticker application.
     81Step 2)  Generate the header-
     83Now open the editor you are most comfortable with and open the init.c file of the particular application.
     84init.c is the file which contains configuration data of the application. Scroll down and you would see configuration information. For the ticker application the configuration information looks as follows-
     86Now since we wish to use the header generated by the GUI for storing our configuration information, we open the GUI. On opening the GUI you will be greeted by a welcome screen. On the welcome screen you would see a box saying open conf.t. Click on that box and go to the location of conf.t ( . It should be present in rtems/doc/user/conf.t.
     88Now you would be able to see the complete GUI with a lot of sections and configuration parameters.
     89Change the parameters according to your requirements.
     90For the ticker application as an example we would do the following changes-
     921) Click on the device driver tab and set CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER,
     952) Click on Classic API configuration and set CONFIGURE_MAXIMUM_TASKS  4
     973) Click on the classic API initialization tasks table and set
     1014) Click on the basic system information tab and set
     104now go to header tab above and click on generate. A header file with the name of header.h would have been generated now in the same directory as that of the GUI. Now copy this header file to the location of the init.c file of your application.
     106Now that you have the header, remove the configuration information from init.c and instead replace it with
     107 # include "header.h"
     109If you do a git diff then it contents should be like this (for ticker's init.c) -
     111If you wish you can also save this configuration and use it later for future applications.
     113Reached Here? Sweet!
     115Step 3) Compile the Application with the generated header-
     117These 2 sections would be of great help for learning how to compile and run the application-
     121Here I would take SPARC for the purpose of compiling.
     122Please go to the ticker sub directory do the following steps for compiling and running -
     1241) export RTEMS_MAKEFILE_PATH=prefix/sparc-rtems4.11/sis/
     1262) export PATH=/opt/rtems-4.11/bin:$PATH
     1283) ../rtems/configure --target=sparc-rtems4.11 --enable-rtemsbsp=sis \
     129  --enable-tests=samples --disable-posix
     1314)  make
     1335) find the ticker executable-
     134sparc-rtems4.11-gdb `find . -name ticker.exe`
     138(gdb) target sim
     139 Connected to the simulator.
     140(gdb) load
     141(gdb) run
     144And voila! your application runs with ease! :)
     146= TUI Directory Structure =
     147 -> .py file to read/write data from/to .ini file
     149input_provider.h -> header file to call existing .py files from cpp and provide input to TUI.
     150TUI.c -> cpp file used to make the TUI.
     151/text/ -> file to parse conf.t and provide input to the TUI.
     152=  Flow of Control of TUI (useful while editing code) =
     154When we open the TUI, the TUI.c file runs.
     155It then calls the return_parameter() function in input_provider.h
     156This file makes use of the Python/C API which is used for calling python inside cpp.
     157Here, the previously made parsing functions of and are called.
     158They read the parameters and after reading these parameters, Ncurses based TUI  is dynamically generated.
    48160==  Possible Goal Extensions beyond the Main Objective  ==