cancel
Showing results for 
Search instead for 
Did you mean: 

GNU sprinf

klavdijo
Associate II
Posted on August 24, 2007 at 14:09

GNU sprinf

9 REPLIES 9
klavdijo
Associate II
Posted on August 24, 2007 at 04:11

HELP !

I am working with HITOP5 and GNU compiler. I have a problem with sprintf function if I use parameters. Without parameters sprintf function is normaly linked and is working properly.

I put the attachment file with code and builder messages if i build sprintf first without parameters in function and then with parameter. In first test the code is builded and working in second test the builder respond with error message.

Please someone help me I am in the hurry.

Thanks !

________________

Attachments :

New_Text_file.txt : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtF2&d=%2Fa%2F0X0000000aKg%2FPnksgABMC.S1UGYzMejOfwnrbA2N8GZkm_EHI_kRWXw&asPdf=false
ben2
Associate II
Posted on August 24, 2007 at 06:11

it looks like you are not using the interworking libraries. I don't use hitop but do use gnu, so it will probably be different for you, but on my system the interworking libraries are in a sub directory of the main lib files. Also for sprintf you need to include the gcc library. e.g -lgcc on command line, you will probably find this in a different directory for the main lib files, something like /lib/gcc/arm-elf/''version number''/ but again it may be different for hitop.

Ben

klavdijo
Associate II
Posted on August 24, 2007 at 08:24

Hi!

Thanks for respons but anything I do with project settings I don't get any positive respons.

Do have whoever some suggestion for me.

Thanks

ben2
Associate II
Posted on August 24, 2007 at 08:56

Sorry can't help you there as I don't use hitop.

Depending on your project complexity you could always revert to using make & makefiles from the command line.

Do hitex have a forum, you may have better luck there.

sjo
Associate II
Posted on August 24, 2007 at 11:01

Hi,

You need to make sure you are linking with the correct libs, for printf you will need libgcc and libc, in that order.

a smaller version of printf is available called iprintf (integer only), but to be honest the standard newlib sprintf is a bit large - use one of the freely available printf's from the net.

could you show us your linker script?

One point i will make, some gcc based toolchains (including hitex) still pass parameters directly to ld. If you use gcc to link then the libs and the correct paths are all done for you.

Cheers

Spen

klavdijo
Associate II
Posted on August 24, 2007 at 12:31

Hello!

I'm sending you a ln but i think this is not in this file so i'm attaching second file which is Hitop project file HiTop and some were in that file is linking options too.

Hope you will find something.

By

________________

Attachments :

Test_OBU2.htp : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtAS&d=%2Fa%2F0X0000000aJs%2FSpcv2XF2JJolV5Kc2yuROyoMbKRjx1K6oe3paiZKtE8&asPdf=false

Test_OBU2.ld : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtF7&d=%2Fa%2F0X0000000aKh%2FTu3udzghJdmgS6mpuAZjPJxVSYmyLanUN95nZIQK5Wc&asPdf=false
klavdijo
Associate II
Posted on August 24, 2007 at 13:02

Hello!

I'm sending you a ln but i think this is not in this file so i'm attaching second file which is Hitop project file HiTop and some were in that file is linking options too.

Hope you will find something.

By

klavdijo
Associate II
Posted on August 24, 2007 at 13:24

Hello SJO!

I tryed again and succideed but as you said the code is very big and is not working well. If you have any tested and small code sprintf I will be very pleased if you send me.

Thanks!

sjo
Associate II
Posted on August 24, 2007 at 14:09

Your linker script is Test_OBU2.ld

Firstly you have the path for two gcc installations in your linker script:

SEARCH_DIR( ''C:\Program Files\Hitex\GnuToolPackageArm\arm-elf\lib\interwork'' )

SEARCH_DIR( ''C:\Program Files\Hitex\GnuToolPackageArm\lib\gcc-lib\arm-elf\3.3.2\interwork'' )

and

SEARCH_DIR( ''C:\GNU\arm-hitex-elf\lib\interwork'' )

SEARCH_DIR( ''C:\GNU\lib\gcc\arm-hitex-elf\4.0.3\interwork'' )

you need to remove the one you are not using, probably the older version 3.3.2.

With Hitex you need to select the correct libs for your build.

As you are not building with interworking enabled you need to link with the correct clibs etc. So the interwork part of the paths above are not required.

So the top of your linker script should be:

SEARCH_DIR( ''C:\GNU\arm-hitex-elf\lib'' )

SEARCH_DIR( ''C:\GNU\lib\gcc\arm-hitex-elf\4.0.3'' )

/*******************************************

Define Files

*******************************************/

GROUP ( objects\startup.o

objects\main.o

objects\interrupt.o

objects\OBU2_externals.o )

INPUT(-lgcc)

INPUT(-lc)

I have also added the gcc lib and clib to be added to the linker objects.

Regards

Spen