Hello I have the following problem:
- IDE: Eclipse Version: 2018-12 (4.10.0) with the Keil C51 plugin (for Language Mapping)
- Compiler (external): Wickenhäuser uc51
Problem here: Eclipse Bad Character Sequence
Keil Language mapping is using this syntax:
xdata unsigned char Port = 0x1;
Wickenhäuser is slightly different:
xdata unsigned char Port @ 0x1;
So I came to this working solution:
#ifdef __CDT_PARSER__
xdata unsigned char Port = 0x1;
#else
//xdata unsigned char Port @ 0x1; //BAD Character Squence encountered: @
#define AT_ADDRESS(n) @##n //Using this Macro to get around this problem
xdata unsigned char Port_B AT_ADDRESS(0x1);
#endif
But this solution is not perfect, (doubles writing etc.) and should look like this:
#ifdef __CDT_PARSER__ //In Keil I have to define this too, to make use the Keil syntax
//#define AT_ADDRESS(n) // This works
#define AT_ADDRESS(n) =##n // Gives error
#else
#define AT_ADDRESS(n) @##n
#endif
xdata unsigned char Port_B AT_ADDRESS(0x1); // GIVES ERROR: Invalid use of macro pasting in macro AT_ADDRESS
Unfortunately Eclipse flags this: Invalid use of macro pasting in macro AT_ADDRESS