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?
*** ERROR 141 IN LINE 112 OF INC\GLOBAL1.H: syntax error near '0' *** ERROR 141 IN LINE 10 OF INC\TYSTRUCT.H: syntax error near '[' *** ERROR 141 IN LINE 10 OF INC\TYSTRUCT.H: syntax error near ']' *** ERROR 141 IN LINE 21 OF INC\TYSTRUCT.H: syntax error near '}' *** ERROR 141 IN LINE 262 OF INC\TYSTRUCT.H: syntax error near ';' *** ERROR 141 IN LINE 273 OF INC\TYSTRUCT.H: syntax error near '}' *** ERROR 141 IN LINE 174 OF INC\HIGH_API.H: syntax error near ',' I tried to look at the source code at the error line but see nothing wrong. C51 FATAL-ERROR - ACTION: ALLOCATION MEMORY ERROR : MEMORY SPACE EXHAUSTED C51 TERMINATED I know the error because of memory, but don't know where? Tks a lot.
Wild guess: some set of recusive #defines that overflow limits of the Keil preprocessor? Are those all the errors that you get? Do you have all the necessary typedefs for the headers already ported? Can you generate the output from the preprocessor and post the results of that? Posting the relevant lines of source might help.
I'm going to take a wild guess here, Houdini predicts that there is a structure containing an array of whatever and the "SIZE OF.." define got out of hand.
"I tried to look at the source code at the error line but see nothing wrong." The error's in a header file - so it's most likely to be a missing or incorrect definition (eg, typedef or #define) some where before where the first error is reported. Are you sure that you have all the command-line defines correct? Try Andy's Handy Hint for Debugging Preprocessor Problems - Examine the preprocessor output: http://www.8052.com/forum/read.phtml?id=29152 Note that the preprocessor listing is a valid 'C' source file. Try compiling it - then you will get error messages that relate directly to the source as the compiler sees it - without any preprocessor obfuscation...
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...?
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
"Try Andy's Handy Hint for Debugging Preprocessor Problems - Examine the preprocessor output" Here is the Keil Manual page regarding the preprocessor listing: http://www.keil.com/support/man/docs/c51/c51_cm_ifile.htm