EmbeddedRelated.com
Forums

Problem in sdcc

Started by mimran June 24, 2006
Hi All,
 I have a little problem, hope you can help me in this regard.

I have this simple program. this is sending the continuous data using
UART0 of the EZ USB FX2.

#define ALLOCATE_EXTERN
#include <fx2.h>
#include <fx2regs.h>

void init_fx2(void);
void init_uart(void);



void init_uart(void){

        SCON0 = 0x52;                // 8 bit UART mode
        TMOD = 0x21;                // Timer 0 and Timer 1 are initialized
to mode 1 n 2 resp
        TH1 = 0xEC;                // Reload value for 9600 baud rate at
48MHz clock
		T1M = 1;
		SMOD1 = 1;
        
        TR1 = 1;                // Start the Timer 1
}

void main(void)
{	
	char a = 0x41;                // Character A
	init_uart();
   	while(1){
        while(TI){
                TI = 0;
                SBUF0 = a;
        
        }
   }
	
}


 When i compile this program using Keil software on windows environment
and upload the .hex file onto the EZ USB FX2 board using fxload, its
working fine. But the problem is that when i use the same program and
compile using sdcc, it gives me the error message like missing ; in line
bla bla....
but if omit the include<fx2.h> then program compiles and makes the .ihx
file but when i upload this file, it does not work at all.

I hope to help me in this regard

Best Regards
Muhammad Imran


mimran wrote:
> Hi All, > I have a little problem, hope you can help me in this regard. > > I have this simple program. this is sending the continuous data using > UART0 of the EZ USB FX2. >
[...]
> > When i compile this program using Keil software on windows environment > and upload the .hex file onto the EZ USB FX2 board using fxload, its > working fine. But the problem is that when i use the same program and > compile using sdcc, it gives me the error message like missing ; in line > bla bla.... > but if omit the include<fx2.h> then program compiles and makes the .ihx > file but when i upload this file, it does not work at all. > > I hope to help me in this regard >
The non-C semantics are different between Keil and SDCC. These might include bit variable qualifiers, memory type qualifiers, etc, all very un-C and compiler specfic.
The header files between SDCC and Keil are different.

The terms "port" from one compiler to another  or "port" from one micro 
controller to another  should be inserted here.

Also the compilers may use non-standard C commands to talk to the hardware 
directly etc...


Suggest you carefully look up bothKiel and SDCC user manuals and compare the 
differences.

There was an article on www.8052.com  forum that mentioned a few 
differences.

JG

"Bryan Hackney" <nobody@home.here> wrote in message 
news:vPmng.33957$vU.7519@tornado.texas.rr.com...
> mimran wrote: >> Hi All, >> I have a little problem, hope you can help me in this regard. >> >> I have this simple program. this is sending the continuous data using >> UART0 of the EZ USB FX2. >> > [...] >> >> When i compile this program using Keil software on windows environment >> and upload the .hex file onto the EZ USB FX2 board using fxload, its >> working fine. But the problem is that when i use the same program and >> compile using sdcc, it gives me the error message like missing ; in line >> bla bla.... >> but if omit the include<fx2.h> then program compiles and makes the .ihx >> file but when i upload this file, it does not work at all. >> >> I hope to help me in this regard >> > > The non-C semantics are different between Keil and SDCC. > These might include bit variable qualifiers, memory > type qualifiers, etc, all very un-C and compiler > specfic. >