[uClinux-dev] about makefile, newbie question

Francesc Borrell Ros se04729 at salleURL.edu
Wed Apr 10 08:38:32 EDT 2002


	Thanks for your quick answer Davidm,

	adding exit(0) to my code solved the error I use to have. But the
main trouble I'm having now is the serial channel. I have to deal with a
protocol at 19200. This protocol emulates token ring and I need to pass a
token at such speed. Reading the serial as a buffer is a bad election
because I should answer, passing the token, when I receive the last
character of the token. If I read from the serial buffer I always get more
than a token, so I'm never passing the token in the right way. I thought
that my code was to slow, but i'm only waiting for cahracters available on
the UART.

	I know this problem should be trivial to molst of you but I'm a
bit confused. Should I go inside the kernel to solve that? Do you see any
other valid solution?

	I post here the way i'm configuring the UART (may be the mistake
is here)

	int	Si_Init (unsigned char com, unsigned int nbauds, unsigned
char word, unsigned char par) {

	struct termios newtio;

	ScanParams(nbauds,word,par); // i got the bauds,word length and
					//parity
	MODEMDEVICE=valide_port_number (port_number -1); //tty/s1

	fd=open(MODEMDEVICE,O_RDWR | O_NDELAY | O_NOCTTY);

	if (fd<0) {perror(MODEMDEVICE); return fd;}

	tcgetattr(fd,&oldtio);
	tcgetattr(fd,&newtio);

	if (lset_baud_rate(fd,bauds,&newtio)) return fd; //setting the
						//baudrate
	lset_partiy(fd,pariti, &newtio);//setting the parity

	newtio.c_cc[VTIME] =0;
	newtio.c_cc[VMIN]=0;

	tcflush(fd,TCIOFLUSH);
	tcsetattr(fd,TCSANOW,&newtio);

	return (1);
}


	Then I follow the "select" technique to wait for incoming
characters in the serial device, the same you use in tip.

	I know that's a bit long but thank you all for reading it and for
answering if you have the clue.

	Thanks David :)



On Wed, 10 Apr 2002, David McCullough wrote:

> Date: Wed, 10 Apr 2002 20:17:35 +1000
> From: David McCullough <davidm at snapgear.com>
> Reply-To: uclinux-dev at uclinux.org
> To: uclinux-dev at uclinux.org
> Subject: Re: [uClinux-dev] about makefile, newbie question
>
>
> Jivin Francesc Borrell Ros lays it down ...
> >
> >
> > 	Hi all,
> >
> > 	I'm very new in linux and uClinux. I am trying to make a user
> > application based on serial channel working at 19200 bps, and I find the
> > code is going to slow for my needs. I'm using a MCF5272C3 dev board.
> >
> > 	In order to avoid going into kernel source, I feel a little
> > confused in all that code although I'm reading Alessandro Rubini's book, I
> > suspect that the executables I'm generating are too big for a embedded
> > system, because for a simple "hello world" program I'm getting an
> > executable of more than 18k. Perhaps that is slowing my system's
>
> Depending on how you wrote your hello world this size may be fine.
> If it runs and prints hello world then I think it is fine.
>
> > performance on listening and answering to the seria channel. The other
>
> The size of the executable will not affect your performance on the serial
> line.  The method you use to talk to the serial port will have a large
> affect.  You may be best to outline how you are talking to the serial port,
> or,  if your code isn't too large post it and get feedback.
>
> > thing that makes the executable suspicious is that when the hello world
> > finishes I get a message like PID x, failed 256 (or anothe number).
>
> This happens if you do not exit with a status of 0.  Add and "exit(0)"
> to the end of your main and it will get rid of that error.
>
> > 	So the question is if someone could let me have a look to a simple
> > makefile, because I think that perhaps I'm linking to erroneous libraries
> > or something like that. May be without knowing it I'm linking to normal
> > linux libraries instead of the used for uClinux.
>
> Not a chance, the program wouldn't work if you were not getting the correct
> libraries.
>
> Cheers,
> Davidm
>
> --
> David McCullough:    Ph: +61 7 3435 2815  http://www.SnapGear.com
> davidm at snapgear.com  Fx: +61 7 3891 3630  825 Stanley St., W'gabba QLD 4102, Oz
> This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/
>

This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/



More information about the uClinux-dev mailing list