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


Ignore:
Timestamp:
Sep 17, 2013, 12:01:44 AM (6 years ago)
Author:
Shubhamsomani
Comment:

/* Possible Goal Extensions beyond the Main Objective */

Legend:

Unmodified
Added
Removed
Modified
  • Projects/GSoC/ApplicationConfigurationGUI

    v34 v35  
    4646
    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 GUI.py file which handles with creating the GUI. The Controller is the Controller.py file.
     48
     49
     50= Flow of Control of the GUI (useful while editing code) =
     51
     52
     53When you open the executable the Controller.py file is opened. 
     54After which the __init__ function is called in the Controller.py. 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 text_parser.py 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 GUI.py 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 Generator.py. The Generator.py 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.
     68
     69= Using generated header with Applications =
     70
     71
     72For using the header there are basically 3 major steps-
     73
     74Step 1) Get the Application-
     75
     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 (http://git.rtems.org/examples-v2/)
     78You can do this easily by - git clone git://git.rtems.org/examples-v2.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-
     82
     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-https://docs.google.com/file/d/0B41ApxXt-m4jckZqN29PMXVXUms/edit
     85
     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 (http://git.rtems.org/rtems/tree/doc/user/conf.t) . It should be present in rtems/doc/user/conf.t.
     87
     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-
     91
     921) Click on the device driver tab and set CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER,
     93CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER.
     94
     952) Click on Classic API configuration and set CONFIGURE_MAXIMUM_TASKS  4
     96
     973) Click on the classic API initialization tasks table and set
     98CONFIGURE_RTEMS_INIT_TASKS_TABLE
     99CONFIGURE_INIT_TASK_STACK_SIZE    (2 * RTEMS_MINIMUM_STACK_SIZE)
     100
     1014) Click on the basic system information tab and set
     102CONFIGURE_EXTRA_TASK_STACKS       (4 * RTEMS_MINIMUM_STACK_SIZE)
     103
     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.
     105
     106Now that you have the header, remove the configuration information from init.c and instead replace it with
     107 # include "header.h"
     108
     109If you do a git diff then it contents should be like this (for ticker's init.c) - http://pastebin.com/d646i1uy
     110
     111If you wish you can also save this configuration and use it later for future applications.
     112
     113Reached Here? Sweet!
     114
     115Step 3) Compile the Application with the generated header-
     116
     117These 2 sections would be of great help for learning how to compile and run the application-
     118-> http://www.rtems.org/wiki/index.php/Example_Application_Compiling
     119-> http://www.rtems.org/wiki/index.php/Quick_Start
     120
     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 -
     123
     1241) export RTEMS_MAKEFILE_PATH=prefix/sparc-rtems4.11/sis/
     125
     1262) export PATH=/opt/rtems-4.11/bin:$PATH
     127
     1283) ../rtems/configure --target=sparc-rtems4.11 --enable-rtemsbsp=sis \
     129  --enable-tests=samples --disable-posix
     130
     1314)  make
     132
     1335) find the ticker executable-
     134sparc-rtems4.11-gdb `find . -name ticker.exe`
     135
     1365)
     137
     138(gdb) target sim
     139 Connected to the simulator.
     140(gdb) load
     141(gdb) run
     142
     143
     144And voila! your application runs with ease! :)
     145
     146= TUI Directory Structure =
     147
     148config_parser.py -> .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/text_parser.py -> file to parse conf.t and provide input to the TUI.
     152=  Flow of Control of TUI (useful while editing code) =
     153
     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 config_parser.py and text_parser.py are called.
     158They read the parameters and after reading these parameters, Ncurses based TUI  is dynamically generated.
     159
    48160==  Possible Goal Extensions beyond the Main Objective  ==
    49161