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.

Compiler: Migrating from TMS320C3x DSP to ARM® Cortex™-A9

Tool/software: TI C/C++ Compiler

Dear All,

We are migrating from our old CPU TMS320C3x to latest ARM® Cortex™-A9 based CPU, while porting the code we see compilation issues due to incompatibility with 

arm-none-eabi-gcc (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.

I would like to bring one such scenario here, the below code snippet works with ti provided compiler


#include <stdio.h>

#define MYVAL51 51
#define GET_MY_VAL(val) MYVAL##val
#define GET_MY_VAL_HEX(val) 0x##val
void main(){
    printf("Hello\n");
    printf("Value = %d\n", GET_MY_VAL(51));
    printf("Value in hex = %x\n", GET_MY_VAL_HEX(GET_MY_VAL(51)));
}


but failing with below error when used with arm-none-eabi-gcc (GCC) 8.2.0, following is the error


pre_pro.c: In function 'main':

pre_pro.c:5:29: error: invalid suffix "xGET_MY_VAL" on integer constant
#define GET_MY_VAL_HEX(val) 0x##val
                                                      ^~
pre_pro.c:9:32: note: in expansion of macro 'GET_MY_VAL_HEX'
printf("Value in hex = %x\n", GET_MY_VAL_HEX(GET_MY_VAL(51)));


Please help to address the above issue. (I have a workaround though, that is modify MYVAL51 as 0x51) but I am looking from compiler options standpoint.

Thanks in advance!

Regards,

Vamshi G.

  • Unfortunately, this is not valid C code.  The C30 compiler should reject it too, but doesn't because of some bug.  I tried several C compilers, and did not find one that accepts this code.

    vamshi krishna gajjela said:
    I have a workaround though, that is modify MYVAL51 as 0x51

    I failed to find a better workaround, despite several attempts.

    Thanks and regards,

    -George