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.

AM6442: Use .macro from assembly files in C files ?

Part Number: AM6442

Hi team, 

Can you declare macros in assembly files and use them the C files ?

If yes, how ? 

I tried on my end and it didn't seem to be possible or at least require a specific syntax / process to import it

Regards

Geoffrey

  • Hello Geoffrey,

    I am not familiar to this requirement and as of now I have defined macros in .asm files and used them in the same .asm file.

    I need to check at my side and let you know.

    Regards,

    S.Anil.

  • Hello Geoffrey,

    Can you please try the below method ?

    Define macros in one.h file and, in my example, I have defined a macro value in Test.h file which should be included in both c and .asm files.

    For including. h file in asm you can try the method below and for generic c you can include as the normal way.

    %{
    #include "Test.h"
    %}

    I hope this method can work work for you. So, first your c file compiles based on the macro and similarly your .asm file also does the same thing.

    Regards,

    Anil.

  • Hi Anil, 

    Thanks for your feedback. 

    Unfortunately my assembly file doesn't like this syntax. I get the following errors : 

    "../assm_add.asm", ERROR! at line 43: [E0200] Bad term in expression
    %{

    "../assm_add.asm", ERROR! at line 43: [E0000] Unexpected trailing token(s)
    %{

    "../assm_add.asm", ERROR! at line 43: [E0003] Invalid instruction
    %{

    "../assm_add.asm", ERROR! at line 44: [E0003] Invalid instruction
    #include "test.h"

    "../assm_add.asm", ERROR! at line 45: [E0200] Bad term in expression
    %}

    "../assm_add.asm", ERROR! at line 45: [E0000] Unexpected trailing token(s)
    %}

    "../assm_add.asm", ERROR! at line 45: [E0003] Invalid instruction
    %}

    "../assm_add.asm", ERROR! at EOF: [E0300] The following symbols are undefined:
    include

  • Hello Geoffrey,

    May I know where you are creating this .asm file ?

    Is it under the MCU+SDK example ?

    Are you doing similar as below ?

    Regards,

    Anil.