ImageCraft needs an sprintf

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

Moderator: richard@imagecraft.com

ImageCraft needs an sprintf

Postby mcgilvra » Thu Jul 09, 2009 2:11 pm

The subject says it. Anyone have any info on if/when this might be available? Thanks.
McGilvra Engineering - Electronic Design & Development Services
Ph: 517-783-2623 Fax: 517-783-0676 mcgilvra@mcgilvra.com
3155 Robinson Road Jackson, Michigan 49203 www.mcgilvra.com
mcgilvra
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 12
Joined: Mon Jan 12, 2004 9:21 am
Website: http://www.mcgilvra.com
Location: Jackson, Michigan

Re: ImageCraft needs an sprintf

Postby nan358 » Thu Jul 09, 2009 3:21 pm

You might be interested in seeing this: Note: In case you're going to use them, you'll also need to code your own va_* macros.

--
Nobu
nan358
The Big Cheese
The Big Cheese
 
Posts: 728
Joined: Mon Jul 02, 2007 8:12 am

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Thu Jul 09, 2009 9:41 pm

mcgilvra wrote:The subject says it. Anyone have any info on if/when this might be available? Thanks.


Yes, we have printf, for eons now. What we need is a generic source for a putchar that works with the UART. I am talking to Cypress about it.
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby jomalogil » Fri Jul 10, 2009 12:27 am

Hi,
I think it's better to have a "sprintf" because send a array to UART,IIC, LCD, etc or whatever you want it's easy.
When I used Keil for 8051, there was "printf" but it was more useful "sprintf" due its versatility
Gil
Saludos-Best regards
jomalogil
Cheese Wheel
Cheese Wheel
 
Posts: 140
Joined: Thu Nov 24, 2005 6:36 am
Location: Madrid - Spain

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Fri Jul 10, 2009 12:39 am

jomalogil wrote:Hi,
I think it's better to have a "sprintf" because send a array to UART,IIC, LCD, etc or whatever you want it's easy.
When I used Keil for 8051, there was "printf" but it was more useful "sprintf" due its versatility


Sorry I wasn't clear. sprintf/printf/vprintf/vsprintf are all the same. Our implementation (and most other full printf) use a low level print function that parses the % and do formatting. Whether it goes to an array (sprintf) or uses an output write function, or LCD, can be supported easily. No need to sprinf->send string to wherever clunkiness.
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby mcgilvra » Fri Jul 10, 2009 5:06 am

Richard,
Ok, let's be clear. Does Imagecraft have a function ready to go that puts a formatted string in a target string? If it is not sprintf specifically, how, exactly, do you do it? Thanks.
McGilvra Engineering - Electronic Design & Development Services

Ph: 517-783-2623 Fax: 517-783-0676 mcgilvra@mcgilvra.com

3155 Robinson Road Jackson, Michigan 49203 www.mcgilvra.com
mcgilvra
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 12
Joined: Mon Jan 12, 2004 9:21 am
Website: http://www.mcgilvra.com
Location: Jackson, Michigan

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Fri Jul 10, 2009 11:26 pm

mcgilvra wrote:Richard,
Ok, let's be clear. Does Imagecraft have a function ready to go that puts a formatted string in a target string? If it is not sprintf specifically, how, exactly, do you do it? Thanks.


Yes, we have it. It's called sprintf. As I said, the full family sprint/printf are exactly the same and working quite well. For various reasons, it was not put in the original ICC compiler with Cypress Micro. One concern was the lack of SRAM. We are talking to Cypress right now to add the support. PSoC Designer needs some radio buttons to support different versions of printf:

- basic int, no modifier, smallest resource consumption
- long, + modifier, more resource
- float, full support.

Keep in mind that we have 5-6 compilers and most of the compiler and library code are common source. It was more a logistic and business issues that some of these features were not in the M8C compiler earlier, some of which were beyond our control. Hopefully things will move more smoothly now. Sometimes it drove me nuts that users badmouthing us for various deficiencies and some of them are either just not correct and some are beyond our control. Of course we can improve on lots of stuff and we are working on them too.
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby gogi » Sun Jul 12, 2009 1:19 pm

Hi,
I hope "sprintf“ (or any other printf) inside ICC is will came up soon.

Until then where to find this code (and other necessary files)?
gogi
Cheese Wheel
Cheese Wheel
 
Posts: 63
Joined: Fri Jan 09, 2004 7:15 am
Location: Croatia

Re: ImageCraft needs an sprintf

Postby mcgilvra » Sat Jul 18, 2009 6:22 am

Richard,
Thanks for your response. You cleared up the issue of ICC's sprintf availability but then raised the question of if it currently available in the ICC M8C compiler. Is it? If it is and there are any caveats, please explain. Thanks again.
McGilvra Engineering - Electronic Design & Development Services

Ph: 517-783-2623 Fax: 517-783-0676 mcgilvra@mcgilvra.com

3155 Robinson Road Jackson, Michigan 49203 www.mcgilvra.com
mcgilvra
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 12
Joined: Mon Jan 12, 2004 9:21 am
Website: http://www.mcgilvra.com
Location: Jackson, Michigan

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Sat Jul 18, 2009 11:35 am

Sorry my answers weren't clear, so lets start over :-)

Some background:
- most of our library codes are common source, and we have a sprintf/printf/scanf etc. since the earliest days, pre-2000.
- for a variety of reasons, sprintf/printf/scanf were not part of the original ICCM8C compiler sold by Cypress Micro.

The current arrangement is that I work closely with Cypress to coordinate our releases of the M8C compiler with their PSoC Designer releases. This is a good thing as the last ICCM8C compiler that was released to the customers were back in 2005, so while the newest compilers are in the PD 5 SP 4.5 and later, it will take a while to clear up the backlog of bugs, enhancements, plus any new ones that crop up. One of these enhancements is to add sprintf/printf support for the next release, and my goal is to do that. So barring any unforseen problems, sprintf/printf will be in the next PSoC Designer SP release.

We will at some points start to make our releases, especially when we release the PRO version, and then sync up with the PSoC Designer when they make a release.

Hope this clarifies.

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

Re: ImageCraft needs an sprintf

Postby mcgilvra » Mon Jul 20, 2009 5:31 am

So the short answer to my original question is "no it is not available" and "uncertain when it will be". I should have been clearer and asked if an sprintf was available specifically for the PSoC platform but, after all, this is a PSoC forum.

Anyway, a work-around is needed. I specifically need to sprintf floating point numbers. Any suggestions? Thanks.
McGilvra Engineering - Electronic Design & Development Services

Ph: 517-783-2623 Fax: 517-783-0676 mcgilvra@mcgilvra.com

3155 Robinson Road Jackson, Michigan 49203 www.mcgilvra.com
mcgilvra
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 12
Joined: Mon Jan 12, 2004 9:21 am
Website: http://www.mcgilvra.com
Location: Jackson, Michigan

Re: ImageCraft needs an sprintf

Postby STDog » Mon Jul 20, 2009 6:31 am

Best suggestion I have is to look at the gcc code for sprintf and modify that (or some other library you have sources for)

If you have a fixed format, or maybe a subset of the full format options, it will make the code smaller and simpler.
It's going to be a pain either way, and not real fast.

I looked at the gcc *print* functions a few years ago, and its not for the faint of heart.
STDog
Cheese Wheel
Cheese Wheel
 
Posts: 168
Joined: Tue May 06, 2008 10:39 am
Location: BFE, Mississippi

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Mon Jul 20, 2009 12:02 pm

mcgilvra wrote:So the short answer to my original question is "no it is not available" and "uncertain when it will be". I should have been clearer and asked if an sprintf was available specifically for the PSoC platform but, after all, this is a PSoC forum.

Anyway, a work-around is needed. I specifically need to sprintf floating point numbers. Any suggestions? Thanks.


No, your summary is incorrect. It's not available NOW, and it will be available soon.

Sigh, and if you say you must need it "now," I would have given a different answer too. e.g. you can email me privately and I will get you a private test build.

I'm glad you have "newbie" under your avatar. I can hold my tongue better.
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby mcgilvra » Mon Jul 20, 2009 5:55 pm

Richard,
Sorry if I offended in any way, I just got a little frustrated. I actually have a lot of respect for you because you hang out in this forum and respond to concerns. I am a long time PSoC user and I love the ICC compiler. Cypress knows exactly how I feel about the whole Hi-Tech fiasco and how they treated you. I am quite satisfied that they came crawling back to ImageCraft. I'm sure they wouldn't characterize it that way but I do.

It is ironic. I was forced to use Hi-Tech because a customer kept adding requirements and I needed the 40% compression (still ended up 98% full). I got real used to the sprintf in Hi-Tech. Then MicroChip bought them and attempted extortion on us. We redesigned the hardware using several PSoCs mainly so I could go back to ImageCraft. But now we have sprintf's all over the place and thus my original post.

Please do send a test build with sprintf. I am copying this msg to you privately to facilitate sending, thanks.

Regards,
Al
McGilvra Engineering - Electronic Design & Development Services

Ph: 517-783-2623 Fax: 517-783-0676 mcgilvra@mcgilvra.com

3155 Robinson Road Jackson, Michigan 49203 www.mcgilvra.com
mcgilvra
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 12
Joined: Mon Jan 12, 2004 9:21 am
Website: http://www.mcgilvra.com
Location: Jackson, Michigan

Re: ImageCraft needs an sprintf

Postby jf1452 » Mon Aug 31, 2009 4:11 am

I have modified tinyprintf, and added a scanf. This works well and can be redirected such that scanf reads from USB and printf writes to LCD; whatever you want really. My only problem is that ImageCraft does not seem to support stdargs.h, whereas HiTech does, any additional help / guidance is welcome.
Attachments
PrintfTest.rar
(5.02 KiB) Downloaded 326 times
User avatar
jf1452
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 22
Joined: Sat Jul 12, 2008 10:32 am
Website: http://www.renishaw.com
WLM: jon.fuge@dsl.pipex.com
Location: Bristol

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Mon Aug 31, 2009 5:33 pm

jf1452 wrote:I have modified tinyprintf, and added a scanf. This works well and can be redirected such that scanf reads from USB and printf writes to LCD; whatever you want really. My only problem is that ImageCraft does not seem to support stdargs.h, whereas HiTech does, any additional help / guidance is welcome.


The next SP release (SP6) WILL definitely have stdarg and sprintf support. They are in Cypress testing right now. So just hang in there a little longer?
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby jf1452 » Tue Sep 01, 2009 4:01 am

That's great news; any rough estimates of timeframe??? Is there any beta program to try this out early?

Cheers

Jon
User avatar
jf1452
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 22
Joined: Sat Jul 12, 2008 10:32 am
Website: http://www.renishaw.com
WLM: jon.fuge@dsl.pipex.com
Location: Bristol

Re: ImageCraft needs an sprintf

Postby richard@imagecraft.com » Tue Sep 01, 2009 11:35 am

jf1452 wrote:That's great news; any rough estimates of timeframe??? Is there any beta program to try this out early?

Cheers

Jon


Cypress controls when SP6 is released. Email me privately richard at imagecraft.com and I may be able to send you a beta some times next week.
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm

Re: ImageCraft needs an sprintf

Postby Dusan » Sun Nov 01, 2009 2:28 pm

I have a following problem with sprintf function when using ImageCraft compiler within the latest PSoC Designer SP6 release.

The part of code which is problematic is:

#include "stdio.h"
...
char niz[15]={0};
char pr[10]={0};
int broj=1;
...
void main(void)
{
....
sprintf(niz,"%d/%s",broj,pr);
....
}
After compiling I get following error: "type error in argument 2 to `sprintf'; found `pointer to __flash char' expected `pointer to char"
I'm little confused, I can't see what is wrong here.

Does anyone have any idea?
That code compiles and works correctly with HI-Tech compiler.
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 » Sun Nov 01, 2009 5:01 pm

I don't know what makes it into the release note, but you need to write

csprintf() to denote that the format string is a flash string, and not a data SRAM string. It's a bit clunky but hard to avoid for a harvard architecture machine like the M8C,
richard@imagecraft.com
Cheese Wheel
Cheese Wheel
 
Posts: 167
Joined: Mon Apr 05, 2004 10:33 pm


Return to “%s” ImageCraft ICCv7 for M8C Compiler

Who is online

Users browsing this forum: No registered users and 1 guest