This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

porting from VC6 to C51

Hi guys, have you ever tried to do that? Can give me some experience? I got some stupid error msgs which I can not find out why?

Parents Reply Children
  • "In spite of the OP choosing C51 as the toolset, the terminal he's working with seems to use an ARM processor."

    No wonder he's having problems, then!! :-0

  • OK, here's a tip:

    Whatever you're porting to (C51, ARM, whatever), be sure to keep the MSVC code updated with any changes you make.
    Work from a single code base, with conditional compilation for the bits that really do need to be compiler-specific.

    eg,

    #if defined( __C51__ )
    // Stuff specific to Keil C51
    
    typedef unsigned char U8;  //  8 bits, unsigned
    typedef unsigned int  U16; // 16 bits, unsigned
    typedef unsigned long U32; // 32 bits, unsigned
    
    typedef   signed char S8;  //  8 bits, signed
    typedef   signed int  S16; // 16 bits, signed
    typedef   signed long S32; // 32 bits, signed
    
    // Memory-space specifiers
    #define CODE     code
    #define DATA     data
    #define BDATA    bdata
    #define IDATA    idata
    #define PDATA    pdata
    #define XDATA    xdata
    
    #elif defined (_MSVC_)
    // Stuff specific to MSVC
    
    typedef unsigned char      U8;  //  8 bits
    typedef unsigned short int U16; // 16 bits
    typedef unsigned int       U32; // 32 bits
    
    typedef   signed char      S8;  //  8 bits
    typedef   signed short int S16; // 16 bits
    typedef   signed int       S32; // 32 bits
    
    #define CODE
    #define DATA
    #define BDATA
    #define IDATA
    #define PDATA
    #define XDATA
    
    #else
    // Neither C51 nor MSVC - stop now with an error!
    #error unsupported compiler
    #endif
    Note: _MSVC_ is just a guess - check your MSVC Manual to find an appropriate symbol.

    You should have something like the above in a header included by all your other files.