At the moment we are using C51 + a realtime CMX kernel. We are evaluating the ARM platform and are looking how this new platform reacts to parts our existing (little modified) programs in therms of code size and speed. We modified a little existing CMX program to transmit a string.
With our first atempt we already run into trouble.
Problem is unknown amount of stack for sprintf with vars without warning. Next example has 3 parts. 1st part runs fine. 2nd part seems to run fine (but at the moment it looks like it corrupts the stack) 3nd part crashes as soon as os_tsk_self(); is called from within SendBlockTimed(,,) crash result => os_error (with err_code=1) How can this happen (al vars are int)?
for (Counter = 0; Counter <250; Counter++) { NumChars = sprintf(ConsoleBuffer, "Console. 00000"); if (NumChars == 14) { OK_Count++; SendBlockTimed(ConsoleBuffer, strlen(ConsoleBuffer), CONSOLE_SEND_TIMEOUT); } else { Error_Count++; } } for (Counter = 0; Counter <250; Counter++) { NumChars = sprintf(ConsoleBuffer, "Console. %05u",Counter); if (NumChars == 14) { OK_Count++; } else { Error_Count++; } } for (Counter = 0; Counter <250; Counter++) { NumChars = sprintf(ConsoleBuffer, "Console. %05u",Counter); if (NumChars == 14) { OK_Count++; SendBlockTimed(ConsoleBuffer, strlen(ConsoleBuffer), CONSOLE_SEND_TIMEOUT); } else { Error_Count++; } }
.