View previous topic :: View next topic |
Author |
Message |
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
Any way to change output HEX file name? |
Posted: Thu Aug 21, 2014 2:45 pm |
|
|
I have a common source code file that I use for two different products. I use #if/#endif to make whatever changes are needed due to hardware differences, but the base firmware functions the same on both.
There seems to be no way to get foo.c to compile to anything other than foo.hex. I'd like to end up with either foo-big.hex or foo-small.hex, depending on a #define. I don't see a way to do it, am I missing something? |
|
|
stinky
Joined: 05 Mar 2012 Posts: 99 Location: Central Illinois
|
|
Posted: Thu Aug 21, 2014 3:38 pm |
|
|
For lack of a better term I use a "wrapper" file. It's name could be foo_small.c and another one that is foo_big.c.
Each of these files includes the same set of code but might have slightly different compile options through the use of #define BLAH
When I build the file, the hex file output matches the wrapper files name. |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Thu Aug 21, 2014 10:47 pm |
|
|
Awesome idea -- thanks. That will work. |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Fri Aug 22, 2014 1:35 am |
|
|
stinky wrote: | For lack of a better term I use a "wrapper" file. It's name could be foo_small.c and another one that is foo_big.c. |
I use wrappers too. But I'm forced by company policy to use non-intuitive part numbers for hex filenames, and far prefer to use descriptive text names for my wrappers and other files. So I use #export that allows you to specify the hex filename within the code:
e.g. in wrapper.c:
Code: |
#ifdef SMALL
#export (HEX, FILE = "Z34521.hex")
#else
#export (HEX, FILE = "Z76543.hex")
#endif
|
I also now use a new feature in V5.26 (may have been in 5.25 as well, but not before and definitely not in any V4.nnn) of placing the output files, including the hex in a separate directory. This helps in organising for source version control and the like. |
|
|
|