ImageCraft needs an sprintf

Discussion and support of the compiler from ImageCraft for the M8C.

Moderator: richard@imagecraft.com

Re: ImageCraft needs an sprintf

Postby jheenanm » Sun Nov 01, 2009 6:40 pm

From 'Revision Notes for ImageCraft ICCV7 for M8C 7.pdf' in SP6

Due to the code size requirement, the printf/scanf functions are supplied in three forms:

1. basic with no long / floating point, or modifier,
2. support for long and modifiers, and
3. support for floating point.

More code and data/stack space are needed for the fuller featured versions.
Please refer to the PSoC Designer documentation for the user interface to access these different libraries.

I cannot find any relevant further documentation or any relevant user interface in PD5.0 SP6.

John Heenan
jheenanm
Cheese Wheel
Cheese Wheel
 
Posts: 99
Joined: Tue Jun 24, 2008 5:13 pm

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Sun Nov 01, 2009 6:58 pm

jheenanm wrote:From 'Revision Notes for ImageCraft ICCV7 for M8C 7.pdf' in SP6

Due to the code size requirement, the printf/scanf functions are supplied in three forms:

1. basic with no long / floating point, or modifier,
2. support for long and modifiers, and
3. support for floating point.

More code and data/stack space are needed for the fuller featured versions.
Please refer to the PSoC Designer documentation for the user interface to access these different libraries.

I cannot find any relevant further documentation or any relevant user interface in PD5.0 SP6.

John Heenan


There should be a short release note. See attached. I apologize for only a brief release note for this release. We will release the full documentation set (and more) soon.

// richard
Attachments
Revision Notes for ImageCraft ICCV7 for M8C 7.pdf
(82.99 KiB) Downloaded 302 times
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby Dusan » Mon Nov 02, 2009 6:17 am

Richard thank you for your help and quick reply!

I puted csprintf instead of sprintf and now code compiles correctly.

But, I encountered another issue.

I would be very grateful if you take look at the following problem:

I used csprintf function in the following manner : "csprintf(niz,"%02d",procenat);". So, the format used is "%02d". I wanted to achieve printing "procenat" variable on two places with leading zeros.
But, what I get is "02d" printed instead. It looks like function didn't recognize tags used in format.

Did I do something wrong?

Thanks again for your time and help!
Regards,
Dusan.
Dusan Glavonjic
Dusan
Cheese Cube
Cheese Cube
 
Posts: 27
Joined: Sat Aug 11, 2007 4:42 pm
ICQ: 139
Location: Serbia

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Tue Nov 03, 2009 1:04 am

You need to enable the "float printf" option...
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby matty » Tue Nov 03, 2009 2:44 am

richard@imagecraft.com wrote:You need to enable the "float printf" option...


Hi,
I can't display on LCD using float data.

How to enable the "float printf" option?
Code: Select all
#include   <m8c.h>
#include   <stdio.h>
#include   <string.h>
#include   "PSoCAPI.h"

int putchar(char c)
{
   char str[] = " ";
   strncpy( str , &c , 1 );
   LCD_1_PrString( str );
   return c;
}
void pos(char x,char y){
   LCD_1_Position(x,y);
}
void main(void)
{
   FLASH char *string;

   int count = 1234;
   string = "hello,world";
   LCD_1_Start();
   
   pos(0,0);
    cprintf(string);
   cprintf(" PSoC");
   pos(1,0);
   cprintf("%o",count);
   cprintf(":");
   cprintf("%d",count);
   cprintf(":");
   cprintf("%f",(float)(count/3));
       

}
matty
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 14
Joined: Sat Jul 26, 2008 2:24 pm
Website: http://itcorp24.blogspot.com/

Re: ImageCraft needs an sprintf

Postby Dusan » Tue Nov 03, 2009 5:36 am

Richard, can you give us a little instruction how to enable ''float'' printf?

In "Revision Notes for ImageCraft " document I found following:
"Due to the code size requirement, the printf/scanf functions are supplied in three
forms:
1. basic with no long / floating point, or modifier,
2. support for long and modifiers, and
3. support for floating point."

I checked several other documents included with PSoC Designer, but I can't find any instruction how to enable type 2 or 3.
A little guidance would be nice..

Thanks.
Dusan.
Dusan Glavonjic
Dusan
Cheese Cube
Cheese Cube
 
Posts: 27
Joined: Sat Aug 11, 2007 4:42 pm
ICQ: 139
Location: Serbia

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Tue Nov 03, 2009 8:00 pm

Apology for the rough edges here. With multiple transitions going on (Cypress moving to PD5, and re-adopting ICC etc.), some seams are more obvious that others.

For now, please do the following:

- Invoke Project->"Open local.mk for ..."

- at the bottom of local.mk, add

CODECOMPRESSOR:=$(CODECOMPRESSOR) -lfpm8c

this will link in the libfpm8c.a, which contains the floating point capable printf with modifier support

Use
CODECOMPRESSOR:=$(CODECOMPRESSOR) -llpm8c

if you just want liblpm8c.a, the version of printf that is capable of supporting long data type.


****
Yes, obviously $(CODECOMPRESSOR) is not the most intuitive name for this purpose, but it does work in this case.

The next release will of course fix this properly.

// richard
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby matty » Tue Nov 03, 2009 11:43 pm

richard,

Thanks to you.
PSoC working very well.

-matty
matty
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 14
Joined: Sat Jul 26, 2008 2:24 pm
Website: http://itcorp24.blogspot.com/

Re: ImageCraft needs an sprintf

Postby Dusan » Wed Nov 04, 2009 5:21 am

Richard thanks for reply!

Unfortunately , I encountered error during compiling process when using "CODECOMPRESSOR:=$(CODECOMPRESSOR) -lfpm8c" (float printf) :

"Internal Error - no target at 0x805d.
Code Compressor optimizer not run."

When using "CODECOMPRESSOR:=$(CODECOMPRESSOR) -llpm8c" (long data types) program compiles without problems.

If you don't have idea what could be the problem, then I will try to avoid usage of csprintf as for now.
I don't want to keep you occupied with this problem.

Once again thank you for your efforts and time!
Regards,
Dusan.
Dusan Glavonjic
Dusan
Cheese Cube
Cheese Cube
 
Posts: 27
Joined: Sat Aug 11, 2007 4:42 pm
ICQ: 139
Location: Serbia

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Wed Nov 04, 2009 10:40 am

Dusan wrote:Richard thanks for reply!

Unfortunately , I encountered error during compiling process when using "CODECOMPRESSOR:=$(CODECOMPRESSOR) -lfpm8c" (float printf) :

"Internal Error - no target at 0x805d.
Code Compressor optimizer not run."

When using "CODECOMPRESSOR:=$(CODECOMPRESSOR) -llpm8c" (long data types) program compiles without problems.

If you don't have idea what could be the problem, then I will try to avoid usage of csprintf as for now.
I don't want to keep you occupied with this problem.

Once again thank you for your efforts and time!
Regards,
Dusan.


I won't have time to tackle it immediately, as we are working on the PRO compiler release, but please zip up your project file and email it to richard@imagecraft.com and I will make sure it's fixed.

Thanks

// richard
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby Dusan » Wed Nov 04, 2009 3:50 pm

I'm sending you a mail with my project attached.

Nothing is urgent, so take a look when you fill free..

Thanks again!

Regards,
Dusan.
Dusan Glavonjic
Dusan
Cheese Cube
Cheese Cube
 
Posts: 27
Joined: Sat Aug 11, 2007 4:42 pm
ICQ: 139
Location: Serbia

Re: ImageCraft needs an sprintf

Postby RAMaston » Fri Jun 11, 2010 12:24 pm

Richard,
Does this mean sprintf still cannot be used to format ram variables? I want to convert a float to string in RAM.
RAM
If you're not a psychiatrist, stay away from idiots... Stanislaw J. Lec
RAMaston
Cheese Wheel
Cheese Wheel
 
Posts: 106
Joined: Wed Aug 15, 2007 5:39 am
Website: http://www.CVGrp.com
Location: Columbus, OH


Return to “%s” ImageCraft ICCv7 for M8C Compiler

Who is online

Users browsing this forum: No registered users and 1 guest

cron