Thread: Configuration tool

  1. #1
    Registered User
    Join Date
    Sep 2014
    Posts
    6

    Configuration tool

    Hello,

    I want to make a configuration tool that edits certain parameters in my C. file. My problem is that I don't have a clue on how to start making this. Does anyone know a certain program or something like a tutorial on this to help me get started? Any help would be much appreciated.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Are you thinking of a configuration file rather than a configuration tool?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Sep 2014
    Posts
    6
    A (graphical) Tool that makes it easy for a user to change certain values.
    Some kind of form that lets the user choose between certain values and when the user is done the values get changed in the c. file

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Nickvt
    A (graphical) Tool that makes it easy for a user to change certain values.
    Some kind of form that lets the user choose between certain values and when the user is done the values get changed in the c. file
    Well, the values in the source file are fixed at compile time. However, you can certainly have variables that initially have those values, but the values are then replaced at run time when the user makes a choice from a form.

    As for how to get started: what is your program? What is your skill level in C?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Sep 2014
    Posts
    6
    My skill in C is very basic, just started learning it. I have a c programming running on a microcontroller. The tool/configurator should be used to change certain parameters for the microcontroller so it can be programmed for more specific uses. The only problem is that I dont know how to build a configuration tool and what kind of programs to use building it (don't suspect it can be done in C?).

  6. #6
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,114
    Quote Originally Posted by Nickvt View Post
    My skill in C is very basic, just started learning it. I have a c programming running on a microcontroller. The tool/configurator should be used to change certain parameters for the microcontroller so it can be programmed for more specific uses. The only problem is that I dont know how to build a configuration tool and what kind of programs to use building it (don't suspect it can be done in C?).
    We would need to know more information:

    What is the Operating System running on the microcontroller?
    Is there a command prompt similar to bash in Linux, or some sort of GUI?
    What C compiler is available for this device?
    How would this C Program be executed on this microcontroller?
    What does this device control?
    What options on the device do you want to control?
    Are there existing utilities available from the manufacturer or some other source to perform the actions you want to do?
    What documentation do you have for this device?

    Sorry for all the questions, but we cannot help you without more information.

  7. #7
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    If possible, I suggest putting all the parameters you wish to configure in a single header file.

    Then write a program that creates that header file.

    Later, you can update the program to read that header file for the default settings.

    Edit1: You might wish to use a better text processing language than C to do the above. Perl, Python, Ruby, or even C++ would be better than C. But, it can be done in C.

    Tim S.
    Last edited by stahta01; 09-15-2014 at 08:13 AM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  8. #8
    Registered User
    Join Date
    Sep 2014
    Posts
    6
    I already made a seperate .h file with all the configurable data, my problem is how do i get an user interface on the PC that edits (just) these values on the microcontroller, can I compile a small .hex file for just the configuration and send this over or are there alternative methods to do this ? (Eventually this has to be done over CAN but that is something to worry about later on.) If anyone has some more information on creating and editing configurations on microcontrollers that would be very welcome as it is quite hard to find any on the internet.
    Thanks for the help so far,
    Nick

  9. #9
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Configuration data in a header file must be fixed at compile time.

    If you're talking about making changes to the configuration settings (i.e. changes to the header file) before compilation, then you can write a program that will generate a customized header file based on your requirements. Then this header file is used when you compile the program.

    This approach will require a program (it sounds like you want a GUI, although it can be done with a console program) that prompts for the required information, processes it, and writes the appropriate data to a new file.

    If you instead want to change parameters of the microcontroller "on the fly" (i.e. after the program has been compiled and is already running on the device), then things get a little more tricky. The program on the device must be capable of receiving commands/data (through say a serial port) and changing parameters based on the received commands/data. This functionality would have to be written in to the microcontroller code ahead of time.

    For instance, if you want to be able to make the microcontroller switch from reading ADC0 to ADC1, then you would need a program to send the appropriate command to the device, and the program on the device would have to be capable of receiving the command and executing the appropriate code to make this switch.

    So which are you looking to do? Customize configuration data before the microcontroller code is compiled, or after it is already running on the device?

    [edit] What is the part number of the device you're using?
    Last edited by Matticus; 09-19-2014 at 08:08 AM.

  10. #10
    Registered User
    Join Date
    Sep 2014
    Posts
    6
    I would prefer to make the changes on the fly, instead of recompiling the entire code.

    The device i am using is a infineon xc888 and i also have a xmc886 evaluation kit, i am using these controllers because of the multiple CAN nodes.

    If you have some kind of example code of a tutorial or something to make it able to configurate the controller it would be much appreciated as i am having a hard time finding information on the internet.

  11. #11
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    I doubt you'll find example code, or even a tutorial, that covers such a specific application.

    You need to be familiar with both C programming and the hardware in order to do something like I described. If you're familiar with neither, then I'd suggest first spending some time learning C, and then spend some time learning about the device.

    In addition to the device data sheet, you should also see if you can find any application notes for that device. These will go into greater detail of the specific functions of the device. The UART would probably be a good place to start looking into.

    What exactly do you want to be able to configure on the device?

  12. #12
    Registered User
    Join Date
    Sep 2014
    Posts
    6
    I want to configure certain parameters controlling the CAN gateway functionallity. I made a seperate C. and H. file with al the define's. My last problem is that i want to send only these 2 files to the microcontroller when i change something in the programming. Is this possible ? I guess i have to give the files a specific adress so it doesn't overwrite the main application programming? It doesn't have to be programmed on the fly anymore, i just want to compile the configuration files and flash these to the device.

  13. #13
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Does the compiler you're using for the embedded processor have the ability to create and use shared object files?

    Also please post a small sample of your .c and .h files.

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DCOM configuration
    By George2 in forum Tech Board
    Replies: 0
    Last Post: 02-14-2008, 06:58 AM
  2. Vim configuration woes
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 04-02-2007, 06:33 PM
  3. Configuration file
    By nbo10 in forum C# Programming
    Replies: 2
    Last Post: 05-18-2004, 09:07 PM
  4. Configuration File
    By gvector1 in forum C# Programming
    Replies: 0
    Last Post: 07-24-2003, 11:26 AM
  5. looking for files configuration
    By frigga in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-21-2002, 08:55 AM