|
|
View previous topic :: View next topic |
Author |
Message |
allenhuffman
Joined: 17 Jun 2019 Posts: 612 Location: Des Moines, Iowa, USA
|
CCSC.exe/CCSCOMPILE.exe passing in #defines as quoted string |
Posted: Thu Jan 30, 2025 4:57 pm |
|
|
When command line compiling, the manual says you can use
...to set a global define. We use this and it works, for lables, numbers and even single quoted characters:
Code: | #BOARD=CONTROL #DEBUG=1 PARTITION='A' |
But I had wanted to pass in something like this...
Code: | #if !defined(VERSION_METADATA)
#define VERSION_METADATA "-Bootloader"
#endif |
But trying to do
Code: | #VERSION_METADATA="-OtherThing" |
...does not work. It is passed in without quotes around it and just creates a compile error.
The manual also lists an alternative:
...but that does the same thing. Actually, it's a bit different. It I try to pass in "-Bootloader" using #, it effectively ends up like:
Code: | #define VERSION_METADATA -Bootloader |
...with no quotes around it. Using the +GVERSION_METADATA="-Bootloader" will end up in UPPERCASE like:
Code: | #define VERSION_METADATA -BOOTLOADER |
I have no idea why.
The usual escapes like \"String\" do not work.
Support said double quotes should work, but they do not.
Anyone figured out how to do this? _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 612 Location: Des Moines, Iowa, USA
|
|
Posted: Thu Jan 30, 2025 4:58 pm |
|
|
Also, order on the compile line seems to matter. You can have them before the BUILD=, but when I put one after it I got weird compiler errors. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19636
|
|
Posted: Fri Jan 31, 2025 3:07 am |
|
|
OK. I think this is probably Windows. I know on an older compiler I was using,
what you had to do, was escape the required inverted commas.
So possibly something like:
#xxx="^"yyy^""
The inverted commas have a special meaning to the Windows shell, so you
have to put extra ones inside the ones telling the shell to take the
contents as an argument, and then escape these with a caret, to tell tke
shell not to remove them.
Haven't tried it, but suspect this is what might be needed. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|