Problem with printf under Zilog ZDS II

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
My next project uses a Zilog Z8F08 so I'm familiarizing myself with a
Z8F08200100KIT evaluation kit.  The kit includes the ZDS II development
system, consisting of:

    Z8 Encore! F08X IDE (03071001 )
    ZiLOG Z8 Encore! Macro Assembler Version 1.03
    Z8 Encore! ANSI C Compiler Version 1.11
    Z8 Encore! Linker/Locator Version 4.09
    IEEE-695 Object Librarian Version 3.03

I find that the ledblink demo program outputs printfs that don't include
conversion characters without problem but hangs in an infinite loop when
conversion characters are used.  For example, this works just fine:

    printf("Led Lights Green\n");

This, taken from the printf help entry, hangs:

    int i10%;
    printf("This is %d",i);

Stepping through the printf, I find that the infinite loop occurs in the
function:

    int _u_print(char _PTR_ dest,char _PTR_ fmt,va_list argp)

I lack the time and desire to debug this library function and find it
difficult to beleive that it is just plain faulty.  It seems far more
likely that I have overlooked something.  Has anyone else experienced
this?

--
========================================================================
          Michael Kesti            |  "And like, one and one don't make
We've slightly trimmed the long signature. Click to see the full one.
Re: Problem with printf under Zilog ZDS II
wrote in comp.arch.embedded:

Quoted text here. Click to load it

Have you included the header <stdio.h> to make sure that there is a
proper prototype in scope?  This can be a serious issue.  In C it
causes undefined behavior to call a variadic function (one with
variable number of arguments like printf) without a prototype in
scope.

The reason is that many processors can and do pass arguments in a more
efficient way to fixed arguments functions, but must use a less
efficient method for handling variable argument lists.

This is not just language lawyer stuff, within the past week or so
someone posted to comp.dsp that they were having a problem with
sprintf() that went away when they included <stdio.h>.

--
Jack Klein
Home: http://JK-Technology.Com
We've slightly trimmed the long signature. Click to see the full one.
Re: Problem with printf under Zilog ZDS II

Quoted text here. Click to load it

Yes, stdio.h is #included in the source file.  I meant to mention that
in the base note and apologise for not having done so.

<snip>

--
========================================================================
          Michael Kesti            |  "And like, one and one don't make
We've slightly trimmed the long signature. Click to see the full one.
Re: Problem with printf under Zilog ZDS II

Quoted text here. Click to load it


Could it be the lack of new line, '\n', at the end of the second string?  
Just a wild guess.

   Vadim

Re: Problem with printf under Zilog ZDS II
printf works for me using ZDS-II for eZ8. I tested this in the simulator both
with a trailing newline in the format string and without.


Re: Problem with printf under Zilog ZDS II
Hi Michael,  try posting your question to the Z8 Encore Group on Yahoo.  
http://groups.yahoo.com/group/z8encore . These people will help you out.  

Bradley




Quoted text here. Click to load it

Re: Problem with printf under Zilog ZDS II
You need to go to www.zilog.com and register your eval kit. Then you can
download the updated ZDS-II.

These are the current versions:

Z8 Encore! Family IDE (04011301)
ZiLOG Z8 Encore! Macro Assembler Version 1.06 (04010702)
Z8 Encore! ANSI C Compiler Version 2.00 (04010702)
ZiLOG IEEE 695 Linker/Locator Version 6.0 (04010702)
ZiLOG IEEE 695 Object Librarian Version 4.0 (04010702)


Re: Problem with printf under Zilog ZDS II

Quoted text here. Click to load it

Thanks, Gary.  That did the trick.  I wonder how many more times I will
have to learn this lesson?  ;-)  Still, I'm amazed that such a bug should
exist in the seemingly mature version 4.5.1 of the package.

BTW, the version of the package I downloaded was 4.6.1 and included these:

    Z8 Encore! F08X IDE (03100701 )
    Z8 Encore! ANSI C Compiler Version 1.14
    ZiLOG Z8 Encore! Macro Assembler Version 1.04
    Z8 Encore! Linker/Locator Version 4.55
    IEEE-695 Object Librarian Version 3.03

What is the package version of the programs you reported?  Where did you
find it?

--
========================================================================
          Michael Kesti            |  "And like, one and one don't make
We've slightly trimmed the long signature. Click to see the full one.
Re: Problem with printf under Zilog ZDS II
Ah, that's right. I'll have to look for it again. I got email from ZIlog
Support talking about the new 4.7.0. I took the link and all I could find was
4.6.1. I'll have to figure out how I found 4.7.0. I wonder about the people at
Zilog.

4.7.0 is supposed to be a unified version. They had separate versions for
different eZ8's. 4.7.0 is supposed to work on all of them.


Re: Problem with printf under Zilog ZDS II
Quoted text here. Click to load it
Bradley, Michael, and other Zilog users,
      I'm sure there are valid reasons for not using this newsgroup for
Encore or Acclaim questions, but from my point of view it is a bad idea.
  The problems are that you loose the benefit of insight from others in
this news group that have related experience, you can't do a Google
search on web based news groups, and people that do search the news
group get the impression that no one is using the processor because
there is no mention of it.  The last reason is really a bigger problem
for Zilog than the user, but it it trickles down eventually.
      So, please do use this news group.

Sincerely,
Dennis Zimmerman
--
If sending a reply you will need to remove "7UP".


Re: Problem with printf under Zilog ZDS II
Quoted text here. Click to load it


Hi Dennis,

I will agree with your statement in principal, it is always a good
idea to try and get help in the news groups. But ... there is a very
active and good Z8 Encore user group that is available. Michael and
other potential Zilog users should know about this resource. This
group in particular is up on the latest developments both good and bad
pertaining to the Z8 Encore. There is a file section where source code
has been posted and links to other Z8 Encore resourses. Zilog also
supports this group actively which is a plus.

Have a nice day.

Bradley

Re: Problem with printf under Zilog ZDS II

Quoted text here. Click to load it

I looked into it, Bradley, but couldn't bring myself to sign up for still
more spam by registering with Yahoo.  Yeah, I know, they claim to keep
your info private and all, but I just don't trust anybody in that regard
anymore.

And here's a big THANKS to all of those who responded to this thread!

--
========================================================================
          Michael Kesti            |  "And like, one and one don't make
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline