Which is recommended utility vs nanolibc for M0+

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Which is recommended utility vs nanolibc for M0+

跳至解决方案
4,284 次查看
Kratz
Contributor IV

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 项奖励
回复
1 解答
4,078 次查看
ErichStyger
Specialist I

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

在原帖中查看解决方案

5 回复数
4,078 次查看
Kratz
Contributor IV

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 项奖励
回复
4,078 次查看
BlackNight
NXP Employee
NXP Employee

Hi Kevin,

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

Erich

0 项奖励
回复
4,078 次查看
Kratz
Contributor IV

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 项奖励
回复
4,078 次查看
ErichStyger
Specialist I

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 项奖励
回复
4,079 次查看
ErichStyger
Specialist I

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