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

Control of Object-Hex Converter from source

hi,
Is it possible to change output .hex filename at preprocessor time, something like:

#define _BOARD_REV_ 1
...

#if (_BOARD_REV_ == 1)
HEX_FILENAME("board_1.hex")
#else
HEX_FILENAME("board_old.hex")
#endif

Which directive should I use for such purposes or is there another way to control OH51 "on the fly"?

Thank you,
Oleg

Parents Reply Children
  • "problems like this ... is exactly the reason I go with .bat files."

    In this case, the "problem" has nothing to do with the IDE.

    There is just simply no way in any environment - make, BAT files, IDE, whatever - that you can ever control the generated HEX file name from the 'C' source code.

    The final HEX file name is just totally beyond the control of the Compiler.

  • There is just simply no way in any environment - make, BAT files, IDE, whatever - that you can ever control the generated HEX file name from the 'C' source code
    oops

    Erik

    However there also is no way in uVision to change filenames and such based on one variable which my batch files do seamlessly.

    Erik

  • "However there also is no way in uVision to change filenames and such based on one variable"

    Depends if you count the 'Targets' facility?

    It's not brilliant (as I've also noted here before), but it might get this job done.

  • Hi all,
    I read all the discussions regarding this issue but still it doesn't help me.
    In my case I have a basic/main code and because this code needs to be programmed in two different targets, I add some "ifndef" commands, where when I compile the code for target X I define X and when I compile the code for target Y I define Y.
    Until now when I define X or Y I also go to target's options and change output file name to X or Y. I want to do it automatically when I define X or Y.
    I don't think two targets is the answer here. BAT files I don't know. Can you give me example please?

    Thanks a lot,
    Roberto

  • "I want to do it automatically when I define X or Y. I don't think two targets is the answer here."

    From what you say there, you are looking at it backwards:

    When you select Target X, that automatcially defines X for you, and uses the output name X.
    Isn't that exactly what you want?