This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I need to merge two symbols in assembler included in Code Composer Studio v4 (version 4.2.1.0004).
They are inside macro: one is an argument of the macro, the second is static string.
e.g.
MY_MACRO .macro SYMBOL1
.asg SYMBOL1 "some_suffix" NEW_MERGED_SYMBOL
; ... some usage of new symbol
.endm
Is it possible with this tool?
Regards,
Piotr Romaniuk
ELESOFTROM
PS
Is there available any newer version of this free IDE?
I don't think thsi is possible in assembly.
If the symbols are symbols defined with the standard C preprocessor (#define etc.), then you can concat them, stringize them etc. with the same preprocessor using '##' and similar operators.
But AFAIK these are not available in assembly.
But you can mix both (if your toolchain invokes the preprocessor for assembly files): the assmbler will get the preprocessed output as its input file, and the preprocessor does not care for any assembly syntax. It just does text substitution.
I've done it myself when writing some MSP header files (yes, it was for C, but the preprocessor doesn't know nor care for the target language)
Yes, indeed I expected something like ## operator or automatic merge two neighbour strings.
Unfortunately, regular preprocesor is not in this place in CCS compilation chain (I would rather avoid changing it).
Anyway, thank you for inspiration :)
I read again, and again all examples of macros in CCS assembler document and found that symbols may be accessed like that:
:SYMBOL: - colons on the begining and at the end of symbol name,
so following code should concatenate symbols:
.asg "ABC", symbol1
.asg "123", symbol2
.asg ":symbol1::symbol2:", result
result ; will be substituted by ABC123
Regards,
Piotr Romaniuk
ELESOFTROM
Piotr Romaniuk said:
.asg "ABC", symbol1
.asg "123", symbol2
.asg ":symbol1::symbol2:", result
result ; will be substituted by ABC123
That's good to know. When reading the IAR assembly section about assembler-preprocessor directives, I didn't found something like that (and I didn't read anything about the CCS assembler at all), but then, the IAR seems to use the C preprocessor even on assembly files, while the CCS doesn't
**Attention** This is a public forum