This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How will I pass command line arguments to cross compiler code?

Hi people,

I have an interesting problem here. I need to generate a number (a 4-digit Integer) and give it as a command line argument to my exe file generated by the cross compiler.

The problem is, EXE file would be executed by the chip & not by the PC, hence giving any command line argument would need a connection between the chip & one of the ports on the PC.

Is there a way/mechanism by which I can give a command line argument during compile-time and not during the run-time?

Is there any functionality provided by the tool on these lines?

Regards,
Jinen.

Parents
  • "its like giving a unique identity to each and every unit manufactured"

    So how many units are we talking about - under 10? dozens? hundreds? thousands...?

    Is the "unique identity" fixed for the entire product's lifetime, or do units need to be able to have new identities?

Reply
  • "its like giving a unique identity to each and every unit manufactured"

    So how many units are we talking about - under 10? dozens? hundreds? thousands...?

    Is the "unique identity" fixed for the entire product's lifetime, or do units need to be able to have new identities?

Children
  • Well, unique identity remains constant throughout the lifecycle of the product.

    What i need to manufacture is in 1000's approx 25k a month.

    I am not really stuck on A,B or C... I am just trying to visualize different options.

    Thanks again for replying.

  • the simplesolution would be to add a DS2411

    Erik

  • "the simple solution would be to add a DS2411"

    Yes - that's the "silicon serial number" of my option 3:
    http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3711

    However, this may or may not meet the OP's specific requirements for the type of number that he needs...?

    We await comments...

  • "What i need to manufacture is in 1000's approx 25k a month."

    So re-building the code for each individual unit to give a unique image for every single one (Option A) is clearly impractical!!

    Therefore you need to look at options like B or C...

  • B C or D

    Most programer have a serial number generator. They can put a unique number in the the flash.

    Or you can edit the hex file. It is not that hard to do.

  • "Most programer have a serial number generator ... Or you can edit the hex file."

    Both of those come under 'C' (see '2' in my original list)

    I'm sure that any programming facility suited to volumes of 25k/month should have no problem doing this for you!

  • People,

    Is there a windows based tool for editing a hex file? SRecord is certainly good. But I think I need to look at windows based solution aswell.

    Can you provide some more inputs on DS2411?
    Is there a way, that I can program my EEPROM by normal C-compiler? Again is it possible to program a particular address without affecting rest of the code?

    Thanks alot people for your valuable inputs.

    Regards,
    Jinen.

  • "Is there a windows based tool for editing a hex file?"

    One Windows-based programmable binary (and HEX) file editor is:

    http://www.sweetscape.com/010editor/

    Another toolchain vendor has some free software to deal with serial numbers in HEX files:

    http://www.htsoft.com/forum/all/showflat.php/Cat/0/Number/12986
    http://www.htsoft.com/forum/all/showflat.php/Cat/0/Number/14440

    "Can you provide some more inputs on DS2411?"

    After having following the link to the Dallas/Maxim site and downloading and reviewing the datasheet and application notes, what more input could you possibly need?

    "Is there a way, that I can program my EEPROM by normal C-compiler?"

    Yes.

    "Again is it possible to program a particular address without affecting rest of the code?"

    Yes.

  • "Is there a windows based tool for editing a hex file? SRecord is certainly good. But I think I need to look at windows based solution aswell."

    Why?
    If you're doing 25k/month, you need a command-line utility that can be called from a script; you do not want a manual GUI!!

    "Can you provide some more inputs on DS2411?"

    The link I gave is to Maxim's product page - that gives you the Datasheet, relevant App Notes, and ordering information.
    What more could you want???

    "Is there a way, that I can program my EEPROM by normal C-compiler?"

    What do you mean by that?
    The C compiler will not program anything!
    The C compiler just translates your source code into object code.

    Of course you can write 'C' source code to program an EEPROM! You would then need to use a 'C' compiler to convert your source code into something executable to actually do the programming

    "Again is it possible to program a particular address without affecting rest of the code?"

    Again, what do you mean by that?

  • People,

    I am trying to use a windows based hex-editor. Is there a smart way for identifying where in the hex file I would need to make changes?


    Another question, Is it possible to write scripts, which would automatically goto a particular line & particular column in a hex file and make the required changes?

    Regards,
    Jinen

  • "Again is it possible to program a particular address without affecting rest of the code?

    Again, what do you mean by that? "

    Let me reframe my question. I have a particular code burnt into a chip. Now, without performing a complete erase of the chip, is it possible to program only a few addresses (maybe burning some data or altogether a new code, without affecting the current code)?

    I think, Dan has to say YES (provided DAN got it correctly in the 1st instance). If you have a different opinion or answer, then please reply for the same

  • "I am trying to use a windows based hex-editor. Is there a smart way for identifying where in the hex file I would need to make changes?"

    Why??
    That's a totally impracticaly way of handling 25000 per month!!!

  • "I am trying to use a windows based hex-editor. Is there a smart way for identifying where in the hex file I would need to make changes?"

    It sounds like you are still intent on not using something like the DS2411 or EEPROM. In that case, one would normally use a fixed ROM address and not worry about trying to "find" where the linker placed a const code object (and thus located it in a HEX file). Then you can simply add a HEX record to the hex file or generate "overlay" hex files as described in one of the links I provided previously.

    http://www.htsoft.com/forum/all/showflat.php/Cat/0/Number/14440

    By the way, the program described therein is provided in source form, so you can modify it to do your "random" thing rather than generate sequential serial numbers.

    "Another question, Is it possible to write scripts, which would automatically goto a particular line & particular column in a hex file and make the required changes?"

    Yes, 010 Editor (URL provided previously) has the means to read in a HEX file, programmatically modify it, and write it back out. One could do similar things with Awk, Perl, etc. scripts and of course C (even using the source code mentioned above as a starting point).

  • "Now, without performing a complete erase of the chip, is it possible to program only a few addresses ..."

    Yes, as long as those "few addresses" are in an erased state, they can be programmed separately from the existing code.