EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

keil uVision RVMDK error

Started by MAYURESH M August 27, 2010
Hi all
I am trying to write a code to display an integer value on a LCD using LPC2148. I am using Keil uVision RVMDK. I have successfully written codes to display characters and strings on the LCD. For integers, i want to convert them into string and then display it on LCD.

For this purpose i am using itoa function. But keil is giving me a linking error. What could be the problem? Please help. I am giving the code and the error below.

Code:
#include
#include "lcd.h"
#include
#include

int main(void)
{
char str[14]; // character array
int i = 10;
itoa(i,str); // convert int to string
init_lcd(); // initialise lcd
while(1)
{

lcd_putstring(0,str); //display string on lcd

}

}

Error:
linking...
.\Obj\Lcd.axf: Error: L6218E: Undefined symbol itoa (referred from buzz.o).
.\Obj\Lcd.axf: Not enough information to list image symbols.
.\Obj\Lcd.axf: Finished: 1 information, 0 warning and 1 error messages.
Target not created

regards
mayuresh

An Engineer's Guide to the LPC2100 Series

Google is amazing. Try using snprintf().

...Laurie:{)
+61 416 114419
On 27/08/2010, at 3:50 PM, "MAYURESH M" wrote:

> Hi all
> I am trying to write a code to display an integer value on a LCD using LPC2148. I am using Keil uVision RVMDK. I have successfully written codes to display characters and strings on the LCD. For integers, i want to convert them into string and then display it on LCD.
>
> For this purpose i am using itoa function. But keil is giving me a linking error. What could be the problem? Please help. I am giving the code and the error below.
>
> Code:
> #include
> #include "lcd.h"
> #include
> #include int main(void)
> {
> char str[14]; // character array
> int i = 10;
> itoa(i,str); // convert int to string
> init_lcd(); // initialise lcd
> while(1)
> {
>
> lcd_putstring(0,str); //display string on lcd
> }
>
> }
>
> Error:
> linking...
> .\Obj\Lcd.axf: Error: L6218E: Undefined symbol itoa (referred from buzz.o).
> .\Obj\Lcd.axf: Not enough information to list image symbols.
> .\Obj\Lcd.axf: Finished: 1 information, 0 warning and 1 error messages.
> Target not created
>
> regards
> mayuresh
Am 27.08.2010 08:03, schrieb Laurie Gellatly:
> Google is amazing. Try using snprintf().

But snprintf() is far to heavy for the job he wants to do.

I wonder if itoa() is part of the stdlib or not. If the compiler does not
complain, it is likely a linker setup problem.
--
42Bastian
+
| http://www.sciopta.com
| Fastest direct message passing kernel.
| IEC61508 certified.
+
Google pointed to a post saying there was no itoa provided by keil. I've written my own so maybe I was forced to in Keil.
I also didn't see any comment about being restricted by heavy code. Maybe he just needs a quick fix?

...Laurie:{)

On 27/08/2010, at 4:09 PM, 42Bastian wrote:

> Am 27.08.2010 08:03, schrieb Laurie Gellatly:
> > Google is amazing. Try using snprintf().
>
> But snprintf() is far to heavy for the job he wants to do.
>
> I wonder if itoa() is part of the stdlib or not. If the compiler does not
> complain, it is likely a linker setup problem.
>
> --
> 42Bastian
> +
> | http://www.sciopta.com
> | Fastest direct message passing kernel.
> | IEC61508 certified.
> +
>
I think so too. Can you suggest a simple work around for it? What i am actually doing is, i am calculating temperature using an external sensor. The result is stored in an int variable. I want to display it on the LCD and for that i want to convert it into string so that i can use the lcd_putstring() function. The value will be updated every second.

-mayuresh

--- In l..., 42Bastian wrote:
>
> Am 27.08.2010 08:03, schrieb Laurie Gellatly:
> > Google is amazing. Try using snprintf().
>
> But snprintf() is far to heavy for the job he wants to do.
>
> I wonder if itoa() is part of the stdlib or not. If the compiler does not
> complain, it is likely a linker setup problem.
> --
> 42Bastian
> +
> | http://www.sciopta.com
> | Fastest direct message passing kernel.
> | IEC61508 certified.
> +
>

--- In l..., "MAYURESH M" wrote:
>
> I think so too. Can you suggest a simple work around for it?

It will probably take you less time to write the source code than it took to post your messages. If you haven't yet got a copy of K & R 'The C Programming Language', order one now and spend some time studying it. In the meantime:

http://en.wikipedia.org/wiki/Itoa

Regards,
Chris Burrows
CFB Software
Astrobe: ARM Oberon-07 Development System
http://www.astrobe.com

On 27/08/2010 07:50, MAYURESH M wrote:
> What i am actually doing is, i am calculating temperature using an
> external sensor. The result is stored in an int variable.

You just want integer temperature converted to a string? That should be
trivial to do manually without snprintf or itoa!

Hint 1: Get the least significant decimal digit with "number % 10".
Hint 2: Remove the least significant digit with "number /= 10".
Hint 3: Make a digit into a character with "digit + '0'".
Hint 4: You probably only need 3 digits and a sign...
Hint 5: Strings are arrays of char ending in a 0.

Sounds like a good interview question to ascertain knowledge of basic C
programming.

Pete

--
Pete Vidler
Senior Systems Developer,
TTE Systems Ltd

Work: http://www.tte-systems.com
Home: http://petevidler.com
I'll try what you suggested. I got the same suggestion from 2 more people. Thanks a lot mate.

--- In l..., Pete Vidler wrote:
>
> On 27/08/2010 07:50, MAYURESH M wrote:
> > What i am actually doing is, i am calculating temperature using an
> > external sensor. The result is stored in an int variable.
>
> You just want integer temperature converted to a string? That should be
> trivial to do manually without snprintf or itoa!
>
> Hint 1: Get the least significant decimal digit with "number % 10".
> Hint 2: Remove the least significant digit with "number /= 10".
> Hint 3: Make a digit into a character with "digit + '0'".
> Hint 4: You probably only need 3 digits and a sign...
> Hint 5: Strings are arrays of char ending in a 0.
>
> Sounds like a good interview question to ascertain knowledge of basic C
> programming.
>
> Pete
>
> --
> Pete Vidler
> Senior Systems Developer,
> TTE Systems Ltd
>
> Work: http://www.tte-systems.com
> Home: http://petevidler.com
>

>I think so too. Can you suggest a simple
Actually it's very simple.
Divide the int value with 10, take the remainder and add 0x30 to it. Store
the value in a string. Do this for 5 times (Int value max 65xxx) Print the
string.
Done!!
Warm Regards,
Mukund Deshmukh,
Beta Computronics Pvt Ltd,
10/1, IT Park, Parsodi,
Nagpur -440022, INDIA.

Meet us at -
K2010, Booth No. 12C40, 27th Oct - 3rd Nov 2010, Dseldorf, Germany.

Warm Regards,
Mukund Deshmukh,
Beta Computronics Pvt Ltd,
10/1, IT Park, Parsodi,
Nagpur -440022, INDIA.

Meet us at -
K2010, Booth No. 12C40, 27th Oct - 3rd Nov 2010, Dseldorf, Germany.

I performed an itoa search in Keil Help - there were no entries. atoi
does exit as such but atoll- but returns a long. I wrote a "converted
int to string" myself.

Google is no help on this.

BD

Am 27.08.2010 10:04, schrieb MAYURESH M:
> I'll try what you suggested. I got the same suggestion from 2 more people. Thanks a lot mate.
>
> --- In l..., Pete Vidler wrote:
>>
>> On 27/08/2010 07:50, MAYURESH M wrote:
>>> What i am actually doing is, i am calculating temperature using an
>>> external sensor. The result is stored in an int variable.
>>
>> You just want integer temperature converted to a string? That should be
>> trivial to do manually without snprintf or itoa!
>>
>> Hint 1: Get the least significant decimal digit with "number % 10".
>> Hint 2: Remove the least significant digit with "number /= 10".
>> Hint 3: Make a digit into a character with "digit + '0'".
>> Hint 4: You probably only need 3 digits and a sign...
>> Hint 5: Strings are arrays of char ending in a 0.
>>
>> Sounds like a good interview question to ascertain knowledge of basic C
>> programming.
>>
>> Pete
>>
>> --
>> Pete Vidler
>> Senior Systems Developer,
>> TTE Systems Ltd
>>
>> Work: http://www.tte-systems.com
>> Home: http://petevidler.com
>


The 2024 Embedded Online Conference