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
  • C51 FATAL-ERROR -
    ACTION: ALLOCATION MEMORY
    ERROR : MEMORY SPACE EXHAUSTED
    C51 TERMINATED

    I know the error because of memory, but don't know where?


    This means that you have crashed the compiler itself - it has run out of PC memory and is unable to continue processing your source files.
    This has nothing to do with memory in your 8051 target!

    The Fata Errors are described here:
    http://www.keil.com/support/man/docs/c51/c51_er_fatalerror.htm

    Remember, you are going to have to read the manuals in detail to complete this task. If you are not prepared to do that, you should give up now!

    What is this VC code that you are trying to port to C51? Are you sure that it is suitable for an 8051...?

Reply
  • C51 FATAL-ERROR -
    ACTION: ALLOCATION MEMORY
    ERROR : MEMORY SPACE EXHAUSTED
    C51 TERMINATED

    I know the error because of memory, but don't know where?


    This means that you have crashed the compiler itself - it has run out of PC memory and is unable to continue processing your source files.
    This has nothing to do with memory in your 8051 target!

    The Fata Errors are described here:
    http://www.keil.com/support/man/docs/c51/c51_er_fatalerror.htm

    Remember, you are going to have to read the manuals in detail to complete this task. If you are not prepared to do that, you should give up now!

    What is this VC code that you are trying to port to C51? Are you sure that it is suitable for an 8051...?

Children
  • Hi,

    Tks all for you helpful advices. As Neil advised, I tried to read the C51 manual as much as I can.

    Let me tell you my situation. My boss needs me to convert a POS program which before run on Verifone terminal into Ingenico terminal. I'm using Ingenico development (Ingedev 2.31) now. I'm new and somehow lost.

    Back to my problem, syntax errors were solved. The program trys to use some C51 keywords as variables. However, the memory error still happens. I tried to limit the global symbols (#define) and external symbols (extern), each less than 256. Besides, there is one module which has 121 functions. I'm afraid it may exceed the limited segments. Do you guys think so? And what else needs to be considered?

    Please advice.

    Tks, Quang.

  • How big is this program?
    Will it fit into 64K? Do you plan to use code pages. Try to compile one C module at a time. It may help you to narrow down the problem.

  • " I tried to read the C51 manual as much as I can."

    And you will need to keep doing it!
    Initially, you read it just to find out what's there; as you get you to it, you will know where to look for reference on specific issues.
    Remember the 'Search' function!

    "My boss needs me to convert a POS program..."

    Always explain abbreviations the first time you use them - do not just assume that everyone will automatically know what you</> mean by "POS" in this context.

    I guess you're talking about a Point-Of-Sale terminal (cash register; cash till)?

    What is its functionality?
    Is it just a simple till, with numeric keypad input, numeric display, simple receipt printer, and cash drawer - or is it an all-singing, all-dancing, windows-based wonder system with barcode scanning, netwrork links, graphical display, online stock query & update, fully itemised receipts, online credit card handling, etc, etc, etc,...?

    The former should be fine on an 8051; the latter was probably written in MSVC because it needs to be - it may well b beyond the scope of an 8051.

    "I'm using Ingenico development (Ingedev 2.31)"

    What's that?
    Again, don't just assume - provide a link so we can see what you're talking about.
    Should you be talking to them about support issues?

    "I'm new..."

    New to what: New to MSVC? New to POS systems? New to the 8051? New to Ingenico? New to 'C' programming? New to any sort of programming?

    "there is one module which has 121 functions"

    Ouch!!
    That is bad news in any development environment!
    This does not bode well - it tends to suggest that the MSVC code you're dealing with is monster bloatware and is not going to fit onto an 8051.

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

  • "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.