EmbeddedRelated.com
Forums

Okay, now crossworks question

Started by Micah March 31, 2006
Same error with or without the Crossworks io header file.

*grumble*

I'll just write my own printf routine..
-Micah

Microbit wrote:

>If you take over that function, you shouldn't
include the crossworks io header file,
>just use the prototype in your common.h file IIRC.
>It's been a while I've done this.
>I'd have to dig up old code to check.
>
>-- Kris
>
>-----Original Message-----
>From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Micah
>Sent: Saturday, 1 April 2006 10:15 AM
>To: msp430@msp4...
>Subject: Re: [msp430] Okay, now crossworks question
>
>
>Yep, in main.c and common.c.
>
>
>-Micah
>
>Microbit wrote:
>
>  
>
>>Have you included the crossworks IO header file :
>>
>>#include <__cross_studio_io.h>
>>
>>???
>>
>>-- Kris
>>
>>
>>-----Original Message-----
>>From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Micah
>>Sent: Saturday, 1 April 2006 10:10 AM
>>To: msp430@msp4...
>>Subject: Re: [msp430] Okay, now crossworks question
>>
>>
>>Still not working.
>>
>>Okay, so I added this function to common.c:
>>
>>int __putchar (int spi_data)
>>{
>>   if (spi_data == '\n')
>>   spi_data = 0x0a;
>> WRITE_TX_BUF2 (spi_data & 0xff);
>> WAIT_SPI_FREE2;
>>
>>return (spi_data);
>>}
>>
>>And this to common.h:
>>
>>int __putchar (int);
>>
>>and included <stdio.h> in common.c and main.c. And I still get the

>>duplicate __putchar error.
>>
>>What's up?
>>
>>-Micah
>>
>>
>>Microbit wrote:
>>
>> 
>>
>>    
>>
>>>Hello Micah,
>>>
>>>Simply use the __putchar() function with the same prototype as in
the library, and
>>>your own __putchar() code will be linked in, instead of the Library
code.
>>>
>>>You _must_ use the same prototype to have your own function linked
in ie.
>>>
>>>int __putchar (int);
>>>
>>>If you're using SPI, just return the parameter you were called
with :
>>>
>>>int __putchar (int spi_data)
>>>{
>>>	//.... do your SPI stuff
>>>return (spi_data);
>>>}
>>>
>>>If there's an error you can elect to return EOF or IOW (-1)
>>>
>>>
>>>B rgds
>>>Kris
>>>
>>>
>>>-----Original Message-----
>>>From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Micah
>>>Sent: Saturday, 1 April 2006 9:25 AM
>>>To: msp430@msp4...
>>>Subject: [msp430] Okay, now crossworks question
>>>
>>>Thanks everyone for the feedback on the terminal programs.
>>>
>>>New problem with crossworks. I'm trying to redefine __putchar()
to send 
>>>out the SPI port, instead of to the virtual terminal. So according
to 
>>>the instructions, I should just be able to redirect the linker to
use my 
>>>function instead of the __putchar() function, right? I did this:
>>>
>>>-D___putchar=_my_putchar
>>>
>>>in the additional linker options. This should utilize my_putchar() 
>>>instead of the standard one, right? However, when I compile, I get a

>>>duplicate __printchar error now.
>>>
>>>Any ideas? Is there a better way to do this?
>>>
>>>-Micah
>>>
>>>
>>>.
>>>
>>>
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>.
>>>
>>>
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>>
>>.
>>
>>
>>Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>.
>>
>>
>>Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>> 
>>
>>    
>>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>  
>


Beginning Microcontrollers with the MSP430

I'll have to look it up, maybe you're not supposed to declare the
prototype in common.h

-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Micah
Sent: Saturday, 1 April 2006 10:25 AM
To: msp430@msp4...
Subject: Re: [msp430] Okay, now crossworks question


Same error with or without the Crossworks io header file.

*grumble*

I'll just write my own printf routine..
-Micah

Microbit wrote:

>If you take over that function, you shouldn't
include the crossworks io header file,
>just use the prototype in your common.h file IIRC.
>It's been a while I've done this.
>I'd have to dig up old code to check.
>
>-- Kris
>
>-----Original Message-----
>From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Micah
>Sent: Saturday, 1 April 2006 10:15 AM
>To: msp430@msp4...
>Subject: Re: [msp430] Okay, now crossworks question
>
>
>Yep, in main.c and common.c.
>
>
>-Micah
>
>Microbit wrote:
>
>  
>
>>Have you included the crossworks IO header file :
>>
>>#include <__cross_studio_io.h>
>>
>>???
>>
>>-- Kris
>>
>>
>>-----Original Message-----
>>From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Micah
>>Sent: Saturday, 1 April 2006 10:10 AM
>>To: msp430@msp4...
>>Subject: Re: [msp430] Okay, now crossworks question
>>
>>
>>Still not working.
>>
>>Okay, so I added this function to common.c:
>>
>>int __putchar (int spi_data)
>>{
>>   if (spi_data == '\n')
>>   spi_data = 0x0a;
>> WRITE_TX_BUF2 (spi_data & 0xff);
>> WAIT_SPI_FREE2;
>>
>>return (spi_data);
>>}
>>
>>And this to common.h:
>>
>>int __putchar (int);
>>
>>and included <stdio.h> in common.c and main.c. And I still get the

>>duplicate __putchar error.
>>
>>What's up?
>>
>>-Micah
>>
>>
>>Microbit wrote:
>>
>> 
>>
>>    
>>
>>>Hello Micah,
>>>
>>>Simply use the __putchar() function with the same prototype as in
the library, and
>>>your own __putchar() code will be linked in, instead of the Library
code.
>>>
>>>You _must_ use the same prototype to have your own function linked
in ie.
>>>
>>>int __putchar (int);
>>>
>>>If you're using SPI, just return the parameter you were called
with :
>>>
>>>int __putchar (int spi_data)
>>>{
>>>	//.... do your SPI stuff
>>>return (spi_data);
>>>}
>>>
>>>If there's an error you can elect to return EOF or IOW (-1)
>>>
>>>
>>>B rgds
>>>Kris
>>>
>>>
>>>-----Original Message-----
>>>From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Micah
>>>Sent: Saturday, 1 April 2006 9:25 AM
>>>To: msp430@msp4...
>>>Subject: [msp430] Okay, now crossworks question
>>>
>>>Thanks everyone for the feedback on the terminal programs.
>>>
>>>New problem with crossworks. I'm trying to redefine __putchar()
to send 
>>>out the SPI port, instead of to the virtual terminal. So according
to 
>>>the instructions, I should just be able to redirect the linker to
use my 
>>>function instead of the __putchar() function, right? I did this:
>>>
>>>-D___putchar=_my_putchar
>>>
>>>in the additional linker options. This should utilize my_putchar() 
>>>instead of the standard one, right? However, when I compile, I get a

>>>duplicate __printchar error now.
>>>
>>>Any ideas? Is there a better way to do this?
>>>
>>>-Micah
>>>
>>>
>>>.
>>>
>>>
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>.
>>>
>>>
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>>
>>.
>>
>>
>>Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>.
>>
>>
>>Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>> 
>>
>>    
>>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>  
>



.

 
Yahoo! Groups Links



 




Micah,

Yes.  Just define __putchar in your source code.

int __putchar(int ch)
{ 
  // do something...
}

The linker defines are something different...

-- Paul.

> -----Original Message-----
> From: Micah [mailto:micah@mica...] 
> Sent: 31 March 2006 23:25
> To: msp430@msp4...
> Subject: [msp430] Okay, now crossworks question
> 
> Thanks everyone for the feedback on the terminal programs.
> 
> New problem with crossworks. I'm trying to redefine 
> __putchar() to send out the SPI port, instead of to the 
> virtual terminal. So according to the instructions, I should 
> just be able to redirect the linker to use my function 
> instead of the __putchar() function, right? I did this:
> 
> -D___putchar=_my_putchar
> 
> in the additional linker options. This should utilize 
> my_putchar() instead of the standard one, right? However, 
> when I compile, I get a duplicate __printchar error now.
> 
> Any ideas? Is there a better way to do this?
> 
> -Micah
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 

You've probably left the linker definition of the symbol in the
project,
so remove it!

-- Paul. 

> -----Original Message-----
> From: Micah [mailto:micah@mica...] 
> Sent: 01 April 2006 00:15
> To: msp430@msp4...
> Subject: Re: [msp430] Okay, now crossworks question
> 
> 
> Yep, in main.c and common.c.
> 
> 
> -Micah
> 
> Microbit wrote:
> 
> >Have you included the crossworks IO header file :
> >
> >#include <__cross_studio_io.h>
> >
> >???
> >
> >-- Kris
> >
> >
> >-----Original Message-----
> >From: msp430@msp4... [mailto:msp430@msp4...] 
> On Behalf 
> >Of Micah
> >Sent: Saturday, 1 April 2006 10:10 AM
> >To: msp430@msp4...
> >Subject: Re: [msp430] Okay, now crossworks question
> >
> >
> >Still not working.
> >
> >Okay, so I added this function to common.c:
> >
> >int __putchar (int spi_data)
> >{
> >    if (spi_data == '\n')
> >    spi_data = 0x0a;
> >  WRITE_TX_BUF2 (spi_data & 0xff);
> >  WAIT_SPI_FREE2;
> > 
> > return (spi_data);
> >}
> >
> >And this to common.h:
> >
> >int __putchar (int);
> >
> >and included <stdio.h> in common.c and main.c. And I still get
the 
> >duplicate __putchar error.
> >
> >What's up?
> >
> >-Micah
> >
> >
> >Microbit wrote:
> >
> >  
> >
> >>Hello Micah,
> >>
> >>Simply use the __putchar() function with the same prototype 
> as in the 
> >>library, and your own __putchar() code will be linked in, 
> instead of the Library code.
> >>
> >>You _must_ use the same prototype to have your own function 
> linked in ie.
> >>
> >>int __putchar (int);
> >>
> >>If you're using SPI, just return the parameter you were 
> called with :
> >>
> >>int __putchar (int spi_data)
> >>{
> >>	//.... do your SPI stuff
> >>return (spi_data);
> >>}
> >>
> >>If there's an error you can elect to return EOF or IOW (-1)
> >>
> >>
> >>B rgds
> >>Kris
> >>
> >>
> >>-----Original Message-----
> >>From: msp430@msp4... 
> [mailto:msp430@msp4...] On Behalf 
> >>Of Micah
> >>Sent: Saturday, 1 April 2006 9:25 AM
> >>To: msp430@msp4...
> >>Subject: [msp430] Okay, now crossworks question
> >>
> >>Thanks everyone for the feedback on the terminal programs.
> >>
> >>New problem with crossworks. I'm trying to redefine
__putchar() to 
> >>send out the SPI port, instead of to the virtual terminal. So 
> >>according to the instructions, I should just be able to 
> redirect the 
> >>linker to use my function instead of the __putchar() 
> function, right? I did this:
> >>
> >>-D___putchar=_my_putchar
> >>
> >>in the additional linker options. This should utilize my_putchar() 
> >>instead of the standard one, right? However, when I 
> compile, I get a 
> >>duplicate __printchar error now.
> >>
> >>Any ideas? Is there a better way to do this?
> >>
> >>-Micah
> >>
> >>
> >>.
> >>
> >>
> >>Yahoo! Groups Links
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>.
> >>
> >>
> >>Yahoo! Groups Links
> >>
> >>
> >>
> >>
> >>
> >>
> >> 
> >>
> >>    
> >>
> >
> >
> >
> >.
> >
> > 
> >Yahoo! Groups Links
> >
> >
> >
> > 
> >
> >
> >
> >
> >
> >.
> >
> > 
> >Yahoo! Groups Links
> >
> >
> >
> > 
> >
> >
> >  
> >
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
>