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;

        while(1)
        {
                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.

roelof



------------------------------------------------------------------------------
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
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to