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.

How to use far pointer in generic common for different platforms?

I want to make a generic code for far pointer in different platform.(TIMSP430 MCU -16bit , silicon lab MCU -32bit and renesasMCU -32bit ).

Since MSP430 is 16 bit it doesn't require far pointer.

 #if defined(__RL78K__) || defined (__SIM3L1XX__)
  #define DPTR __far
#else
  #define DPTR
#endif


 

uint32_t rdval;

 rdval = *(( uint32_t DPTR *)adrs );

I tried the above code which is building with IAR IDE- Renesas MCU (__RL78K__ defined ) but not with Precision32 IDE for Silab MCU.(__SIM3L1XX__ defined)

What is the change required for this to build in silabs and to make it generic common for all platform.

It is giving below build error in precision32 IDE in above rdval assignment line.

====================

make: *** [Drivers/priv/src/cli.o] Error 1 CSLIB    C/C++ Problem
invalid type argument of unary '*' (have 'uint32_t') cl.c  line 795 C/C++ Problem
expected ')' before '__far' cl.c  line 795 C/C++ Problem

====================