RE: Macraigor GNU C for MPC500
"David Eicher" <[email protected]>
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers |
|---|---|
| Message-ID | <[email protected]> |
Hi Dan, Thanks for this. I've downloaded newlib, and talked to one of the managers of it. He said I just need to replace a couple of low level routines in libgloss to redirect printf( ) and others to SCI, so I'll get it figured out. I do have to build newlib on my GNU toolset. So will work on that next. I'll keep you posted. In the meantime I'll ask around to see if someone has already done it for cygwin. Thanks, Dave _____ From: [email protected] [mailto:[email protected]] On Behalf Of Dan Fowell Sent: Wednesday, July 20, 2005 5:58 AM To: [email protected] Subject: RE: [MPC500] Macraigor GNU C for MPC500 I'm not sure how easy it would be to configure newlib's printf for output with QSCI, but I'm sure it's possible. I would start off just using newlib's sprintf and then use a separate function to send the string. The following ones work for me: void SendStr (int port, char *chptr) { while(*chptr) //terminate string if is NULL 0 { SendChr(port,*chptr); ++chptr; } } void SendChr(int port, char ch) { switch (port) { case 0: while ((QSMCM_A.SC1SR.R & 0x0100) == 0); QSMCM_A.SC1DR.R = (short) ch; break; case 1: while ((QSMCM_A.SC2SR.R & 0x0100) == 0); QSMCM_A.SC2DR.R = (short) ch; break; case 2: while ((QSMCM_B.SC1SR.R & 0x0100) == 0); QSMCM_B.SC1DR.R = (short) ch; break; case 3: while ((QSMCM_B.SC2SR.R & 0x0100) == 0); QSMCM_B.SC2DR.R = (short) ch; break; } } You still need to configure the ports for baud, parity, etc... before the above functions will work. Example for the first port: QSMCM_A.SCC1R0.B.SC1BR = BaudVal; // Set Baud QSMCM_A.SCC1R1.R = 0x000C; // Transmit & Receive Enabled, no parity, no interrupts Another option would be to write your own printf. I have a homemade sprintf that sort of works and could be cleaned up and converted to a printf function, but it's a pain to reinvent the wheel. I also found some interesting newlib printf information at: http://www.embedded.com/story/OEG20011220S0058 Dan -----Original Message----- From: [email protected] [mailto:[email protected]]On Behalf Of David Eicher Sent: Wednesday, July 20, 2005 6:12 AM To: [email protected] Subject: RE: [MPC500] Macraigor GNU C for MPC500 Thanks Dan, I tried each of the emulations listed below, they all produced the error "unsupported emulation" by the GNU linker. I also contacted Macraigor and asked which library I'm suppose to use with their version of GNU C. There response was "we don't provide libraries with our distribution of the toolset because the libraries need to be built specifically for the hardware platform you are on." So.., what you are saying here rings trure, it appears I do need to build a libc.a. Does this newlib give you the capability to configure printf( ) to output to the QSCI of the MPC555/565? Thanks, Dave _____ From: [email protected] [mailto:[email protected]] On Behalf Of Dan Fowell Sent: Monday, July 18, 2005 7:41 AM To: [email protected] Subject: RE: [MPC500] Macraigor GNU C for MPC500 Can't remember the exact differences of the below listed switches. I do remember that I had to build the needed libraries. I choose "Newlib". Check out the home page for newlib: http://sourceware.org/newlib/ You can find instructions on building the newlib libraries for the powerpc by doing google searches, but hopefully someone just has the pre-built libraries for easy download. Otherwise you have to use your powerpc-gcc compiler to build them (not that much fun if you've never done it before). Hope that helps, Dan -----Original Message----- From: [email protected] [mailto:[email protected]]On Behalf Of David Eicher Sent: Monday, July 18, 2005 7:06 AM To: [email protected] Subject: RE: [MPC500] Macraigor GNU C for MPC500 I did discover that in the GNU online docs it mentions several options and gives standard library names for each: -msim standard libs are libsim.a and libc.a -mmvme - libmvme.a and libc.a -mads - libads.a and libc.a -myellowknife - libyk.a and libc.a Does anyone know the difference between these, or a place where that difference might be documented? I did find that libc.a supports the use of sprintf( ) , but not printf. That will do just fine if I can't find printf. This makes sense for an embedded environment, sprintf builds a string, then I just need to transmit the string using my SCI send routines. That cures the problem of figuring out how to configure stdout/stdin to use SCI. Regards, Dave _____ From: [email protected] [mailto:[email protected]] On Behalf Of David Eicher Sent: Sunday, July 17, 2005 9:02 AM To: [email protected] Subject: [MPC500] Macraigor GNU C for MPC500 Hello, I using the subject development tools, and can't seem to find the libraries I'm suppose to use for stdio (printf, etc.). Does anyone know what directory Macraigor puts them in? Dan showed me how to point ld.exe to the libraries, if I can just figure out where they are. Thanks, Dave _____ From: [email protected] [mailto:[email protected]] On Behalf Of Dan Fowell Sent: Thursday, July 14, 2005 7:34 AM To: [email protected] Subject: RE: [MPC500] Using libraries with GNU C for MPC555 I don't use stdio or printf, but I do link in a library called libc.a (which has sprintf, atoi, and many others). My link command looks as follows: powerpc-elf-ld.exe -g -t --verbose -Trom.lnk -o main.elf startup.o serial.o main.o hdw.o -L../lib -lc It's been a few years, but I think the -L tells it to link in the libraries, I specify the location of the library "../lib" and then I specify which library "-lc" which tells it to link in the c library (there is a libm.a and a libg.a as well). So from where I compile, my libc.a file is back a directory and then in a "lib" folder I created. Hope that helps. Dan -----Original Message----- From: [email protected] [mailto:[email protected]]On Behalf Of David Eicher Sent: Thursday, July 14, 2005 8:08 AM To: [email protected] Subject: [MPC500] Using libraries with GNU C for MPC555 Hello, Does anyone have any experience with the linker in the subject environment? I am having trouble getting ld to find the libraries GNU C is suppose to be using for Stdio. I can't figure out how to set the path so the linker will find the library, and I haven't been able to figure out what the name of the library is that I need to resolve a reference to printf( ). Thanks for any insight you might be able to offer. Dave ----------------------------------------------------------- To learn more about Freescale Microcontrollers, please visit http://www.freescale.com/mcu _____ YAHOO! GROUPS LINKS * Visit your group "MPC500 <http://groups.yahoo.com/group/MPC500> " on the web. * To unsubscribe from this group, send an email to: [email protected] <mailto:[email protected]?subject=Unsubscribe> * Your use of Yahoo! Groups is subject to the Yahoo! <http://docs.yahoo.com/info/terms/> Terms of Service. _____ [Non-text portions of this message have been removed] ----------------------------------------------------------- To learn more about Freescale Microcontrollers, please visit http://www.freescale.com/mcu Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/MPC500/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/