1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Problem with printf under Zilog ZDS II

Discussion in 'Embedded' started by Michael R. Kesti, Feb 23, 2004.

  1. 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 i=10;
    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 R. Kesti, Feb 23, 2004
    #1
    1. Advertisements

  2. Michael R. Kesti

    Jack Klein Guest

    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
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c++-faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Feb 23, 2004
    #2
    1. Advertisements

  3. 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 R. Kesti, Feb 23, 2004
    #3
  4. Could it be the lack of new line, '\n', at the end of the second string?
    Just a wild guess.

    Vadim
     
    Vadim Borshchev, Feb 23, 2004
    #4
  5. Michael R. Kesti

    Gary Kato Guest

    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.
     
    Gary Kato, Feb 23, 2004
    #5
  6. Michael R. Kesti

    Bradley Guest

    Bradley, Feb 23, 2004
    #6
  7. Michael R. Kesti

    Gary Kato Guest

    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)
     
    Gary Kato, Feb 23, 2004
    #7
  8. 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 R. Kesti, Feb 23, 2004
    #8
  9. Michael R. Kesti

    Gary Kato Guest

    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.
     
    Gary Kato, Feb 23, 2004
    #9
  10. Michael R. Kesti

    D. Zimmerman Guest

    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
     
    D. Zimmerman, Feb 23, 2004
    #10
  11. Michael R. Kesti

    Bradley Guest


    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
     
    Bradley, Feb 24, 2004
    #11
  12. 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 R. Kesti, Feb 25, 2004
    #12
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.