This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ecos]hanger in printf


On Fri, 27 Feb 2009 12:19:25 +0100, Andrew Lunn <andrew@lunn.ch> wrote:

On Fri, Feb 27, 2009 at 11:58:05AM +0100, Robert Brusa wrote:
Hi
Following a recent update (Jan 09) of ecos from V2.0 to the "unstable"
version and migration to the new gnutools arm-eabi of codesourcery, I run
into a hanger of a printf statement:


void IsInitMode(void)
{
static bool first = true;
static unsigned long int t1, t0 = 0; // time in units of 10 ms
t1 = cyg_current_time();
if ( ( t1 - t0 > 600 * SEC2TICS ) || first) { // msg repeats every minute
first = false;
printf("\nstatus is INIT - manual help required");

Not likely to be your problem, but i would put a trailing \n. printf is buffered, so it won't get
flushed until the buffer is full or \n output. I don't think diag_printf is buffered.


printf() needs a lot of stack space, more than diag_printf. Maybe your
stack is too small?

Andrew

Hi Andrew


replaceing all printf with diag_printf helps. My app. then works, but unfortunately
a) diag_printf does not handle floating point numbers and
b) is low level polling. So printf would be more adequate.


Stack: In a task with the statements

			diag_printf(" hei-\n");
			printf("\nheiz:%5.1f %2d\n",te, dcycle);
			diag_printf(" -z\n");

I increased the stack by 500 bytes. Same behaviour - just hei- comes out and nothing else and the app. crashes somewhere in printf.

I think you are right - its indeed a deeply rooted problem of printf. But is it a problem of ecos or the (library of the) toolchain I am using? What do you think?

Robert

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]