Topic : Printf very slow in ST 105 (master clock 16Mhz & CPU 4Mhz) - repost

Forum : ST7/STM8

Original Post
Post Information Post
July 9, 2012 - 4:21pm
Guest

Support Forum - the last post was truncated for some reason - this is a repost

In the code we are calling printf and have updated putchar to take each character and transfer it to an array. We have placed a port hi low transition in putchar to see how fast printf calls this code - the execution time

A simple test was run
printf("testing 123");

Printf is calling putchar at a rate of 150us per character. Executing the above printf line requires over 2ms. This has nothing to do with the data transmit from the serial port - this is just a function of printf

printing a string of 10 characters to an array should not require 2ms

Any suggestions or thoughts as to why this is slow

(Also)
The ST7/STM8 manual says printf is smart enough to know what library to compile in based on what is being printed. Ex: If I print "HI" a simple library is compiled in. Do I understand the manual correctly or do I need to do anything to ensure I am not calling a printf library that supports floating points which is not required.

Replies
Post Information Post
+1
0
-1
July 10, 2012 - 10:13am
Raisonance Support Team

Hi,

Your understanding of the manual is correct.

We did not manage to reproduce your problem. To help you more we will need more information...

What is the version of your software? (Ride and RKit-STM8)

What is the complete name of your target CPU?

Can you send us (support@raisonance.com) an example project showing the problem?
Precompiled if possible.

Best Regards,

Vincent