Re: gcc question
On 2005-02-25 11:34, Kathy Quinlan [EMAIL PROTECTED] wrote: Daniel O'Connor wrote: On Thu, 24 Feb 2005 17:57, Kathy Quinlan wrote: ATM it is written in codevisionAVR which is where the function is called, so I guess for now I will just break the AVR support;) Ahh.. So.. are you talking about getting the coding running _in FreeBSD_ or compiled on FreeBSD and running on an AVR? I am talking about getting the same code running under FreeBSD AND the AVR with minimal changes. The easiest way is to hide the differences of the two platforms under a properly designed abstraction layer. IIRC, it was putchar() that was giving you trouble. Don't call it as putchar(), then. Write a wrapper function, which gets properly defined either for either system. The header that defines the wrapped functions' API can be common, i.e.: #ifndef __WRAPPER_H #define __WRAPPER_H #ifdef __cplusplus extern C { #endif int sendbyte(int val); #ifdef __cplusplus } #endif #endif /* __WRAPPER_H */ The implementation of the sendbyte() function may be in either a common file sprinkled with #ifdef's for othe various platforms, or in separate files that are conditionally added to the build depending on the current platform. I hope this helps, Giorgos ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: gcc question
Daniel O'Connor wrote: On Thu, 24 Feb 2005 17:57, Kathy Quinlan wrote: ATM it is written in codevisionAVR which is where the function is called, so I guess for now I will just break the AVR support;) Ahh.. So.. are you talking about getting the coding running _in FreeBSD_ or compiled on FreeBSD and running on an AVR? I am talking about getting the same code running under FreeBSD AND the AVR with minimal changes. Regards, Kat. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
gcc question
Hi all, 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 ?? Thanks for the help Regards, Kat. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: gcc question
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 pgprhbKsRY9o5.pgp Description: PGP signature
Re: gcc question
Daniel O'Connor wrote: 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. ATM it is written in codevisionAVR which is where the function is called, so I guess for now I will just break the AVR support;) I am planning on moving wholey over to GCC and FreeBSD, once my final customer has agreed to Eagle for the EDA side, this PC will be Free of M$ crap and I will be wholy FreeBSD :) Regards, Kat. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]