Hi roelof,
   Thanks for your help!
   I run what you modify code in my pc,It can be compiled successfully!
   However I have some questions to this code.
   1.What you use library files(p89lpc938.h) seems not the standard 51 library files.Does that mean I can subsitute this library for standard 51 library?
   2.You have no statements about P1_0/P1_7,Does that mean,the codes which have been compiled with SDCC don't need the statements of sfr or sbit?

   3.I've tried another simple code(newpp.c) as what you told me,but the sdcc give me such a error:newpp.c:error 20:Undefined identifier 'PSW_1'
      the code as follow:
      #include <AT89X51.H>
       sfr f_wren=0xf1;
       sfr f_pp=0xf2;
       sfr f_wr_adrH=0xf3;
       sfr f_wr_adrM=0xf4;
       sfr f_wr_adrL=0xf5;
       sfr f_wr_dataH=0xf6;
       sfr f_wr_dataM1=0xf7;
       sfr f_wr_dataM2=0xf8;
       sfr f_wr_dataL=0xf9;
       sfr f_rw=0xfa;
       sfr f_work=0xfb;



      I use PSW.1 instead of PSW_1,the SDCC give me a syntax error: token -> '.1';column 11
      So,what should be done on this code?

      4.I'm interesting in the SDCC compile internal,but manual is not very detailed to the introduction of the internal
         so,could u give me some material,such as SDCC compile flow,Whether the SDCC have intermediate language,what is the difference between SDCC with GCC

2011/3/22 roelof 't Hooft <roelofh@itholland.nl>
On Tue, 2011-03-22 at 10:02 +0800, duck donal wrote:
> Hi All,
> I'm a newbie for sdcc.
> A few days ago, I was in use of SDCC, ran into a problem.

> So,what is the solutions?To modify the program?How to do it?
> Or modify the sdcc?

Hi Donald,

Here is your example code back, I modified it a bit to
have it succesfully compile with sdcc.
As opposed to arm-elf-gcc sdcc does not need or use the
return at the end of a program, embedded programs usually
never return and stay in a while(1) loop forever :-)

#include <p89lpc938.h>

void main(void)
       unsigned char j;
       unsigned int i;

               P1_7 = 1;
               while(P1_7 == 0)
                       for(i = 1; i <= 500; i++)
                               P1_0 = !P1_0;
                               for(j = 0; j <= 50; j++)
                       for(i = 1; i <= 250; i++)
                               P1_0 = !P1_0;
                               for(j = 0; j <= 100; j++)

roelofh@baywatch:~/tangtao$ sdcc tang.c
roelofh@baywatch:~/tangtao$ ll
total 196
-rw-r--r-- 1 roelofh domainusers 13302 2011-03-22 10:48 tang.asm
-rw-r--r-- 1 roelofh domainusers   333 2011-03-22 10:48 tang.c
-rw-r--r-- 1 roelofh domainusers   620 2011-03-22 10:48 tang.ihx
-rw-r--r-- 1 roelofh domainusers   215 2011-03-22 10:48 tang.lnk
-rw-r--r-- 1 roelofh domainusers 35446 2011-03-22 10:48 tang.lst
-rw-r--r-- 1 roelofh domainusers 34876 2011-03-22 10:48 tang.map
-rw-r--r-- 1 roelofh domainusers  1129 2011-03-22 10:48 tang.mem
-rw-r--r-- 1 roelofh domainusers  6201 2011-03-22 10:48 tang.rel
-rw-r--r-- 1 roelofh domainusers 35446 2011-03-22 10:48 tang.rst
-rw-r--r-- 1 roelofh domainusers 47706 2011-03-22 10:48 tang.sym
roelofh@baywatch:~/tangtao$ sdcc -v
SDCC : mcs51 3.0.1 #6066 (23 Nov 2010) (Linux)

You will find the header files in /usr/local/share/sdcc/include/mcs51/
Please have a look at them and include the one you need for your
processor. I have included a random one for example.


Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
Sdcc-user mailing list