gcc question

Daniel O'Connor doconnor at gsoft.com.au
Thu Feb 24 05:03:03 GMT 2005


On Thu, 24 Feb 2005 15:00, Kathy Quinlan wrote:
> I have some code that I build for two targets, one an Atmel uC and the
> other FreeBSD.
>
> What is the best way to redefine getchar and putchar (in uC they use the
> serial port, in FreeBSD stdin stdout)
>
> Or would I be better #ifdef the commands and making getchar only used in
> uC and my serial port handler in FreeBSD ??

I didn't think getchar/putchar existed in the Atmel libc implementation..

I would suggest using a different function name and implement it differently 
for either platform.

Also you'll want to be careful about the fact that the Atmel has 2 separate 
address spaces (if it's an AVR anyway) which can cause problems because you 
have to read from the right one.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20050224/d9ed8fb4/attachment.bin


More information about the freebsd-hackers mailing list