Which is recommended utility vs nanolibc for M0+

cancel
Showing results for 
Search instead for 
Did you mean: 

Which is recommended utility vs nanolibc for M0+

Jump to solution
294 Views
Contributor III

I am planning to add assertions to my debugging tool capabilities.  Erich Styger has a couple of very helpful posts explaing how to get around the code bloat of stdio.h.  There are two different recommendation to reduce the memory overhead given in the posts I read. The first is for "utility" and the second is to add "-nanolibc" into the KDS linker.

Since I am using KDS, Which would be better to use?

If -nanolib.c were used, what command would be used, puts() or printf()?

0 Kudos
1 Solution
88 Views
Senior Contributor II

Hi Kevin,

I would use this:

pastedImage_1.png

Nano has a smaller footprint than newlib, and nosys uses empty stdio stubs.

puts() is preferred over printf(), but I would avoid them both. Instead just use your own output routines (e.g. to serial). If you want to use open argument lists in printf() style, then have a look at XFormat, a Lightweight printf() and sprintf() Alternative | MCU on Eclipse .

I hope this helps,

Erich

View solution in original post

5 Replies
88 Views
Contributor III

Erich, 

I found a thread you were on:   Best method to load existing and samples project to KDS  where you said, "Hi Siva, Correct. Processor Expert is available up to the Kinetis SDK V1.3. It is not supported any more in the SDK V2.0."  Without Processor Expert, how is it that components like XFormat and Utility are added in KDS?  I think I am confused.  We don't think we are using SDK.  How could I securely share my project with you? Would you join our cloudshare as a user?

0 Kudos
88 Views
NXP Employee
NXP Employee

Hi Kevin,

I have my email address listed on About | MCU on Eclipse 

Erich

0 Kudos
88 Views
Contributor III

The screen shot was followed as instructed. The puts(); statement prints with -specs=rdimon.specs (Happy semihosting :smileyhappy:, indeed!!!), but it did not print using the -specs=nosys.specs as recommended.  I think your intention was for me to use -specs=nosys.specs and use XFormat or my own code because of the M0+ processor limitations.    

The system has already been fully programmed with the SDK.  I would like to use XFormat as you suggested and cut down the code size.  The code has been downloaded from sourceforge and imported the PEud to Kinetis Design Studio 3.2.0.  

When adding XFormat into the project, the XFormat errors out.  I think I am having the same problem as in the link where SDK causes a problem.  Link here: How to solve Selected component/template is not registered in the interface (SDK) Error 

I don't know how I would take a finished project and recreate it having the P&E components installed and everything connected.    Is there a way I can build a new project to import what has been completed so SDK can be off, or can XFormat be made to work in my present project?

PS: I love your Switzerland mountain pictures from one of your blogs.

0 Kudos
88 Views
Senior Contributor II

Hi Kevin,

Are you using a Processor Expert project, without or with the SDK, or a native SDK project? Maybe you can share your project and I have a look. I have to say that I have mostly moved to SDK 2.x by now, and have not used the SDK 1.x for a long time, so I might have missed something. In any case you could use the XFormat sources without Processor Expert too if this is the goal.

>>PS: I love your Switzerland mountain pictures from one of your blogs.

:-)

Erich

0 Kudos
89 Views
Senior Contributor II

Hi Kevin,

I would use this:

pastedImage_1.png

Nano has a smaller footprint than newlib, and nosys uses empty stdio stubs.

puts() is preferred over printf(), but I would avoid them both. Instead just use your own output routines (e.g. to serial). If you want to use open argument lists in printf() style, then have a look at XFormat, a Lightweight printf() and sprintf() Alternative | MCU on Eclipse .

I hope this helps,

Erich

View solution in original post