printf re-entrant?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

printf re-entrant?

861件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wortel on Wed Feb 09 01:15:22 MST 2011
Since I will be using FreeRtOS and want to make use of these functions, I need to know if printf / sprintf are re-entrant. Else I will have to make an gatekeeper or something alike.
0 件の賞賛
返信
2 返答(返信)

847件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by SOTA on Mon May 16 15:30:01 MST 2011
This something i've just tried with the LPC1343 - under freertos, redlibw/semihosting, and integer only printf - seems to work fine for the first 3 lines output, and the causes a hardfault while in the middle of printing out a differnt string ... EDIT : source found: DOH! forgot to allocate extra stack space for printf() !
So it works fine :)
0 件の賞賛
返信

847件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Wed Feb 09 07:31:36 MST 2011
From a quick scan of the code, everything looks like it should work ok. But whether this is a sensible thing to do is a different matter. Semihosting in a interrupt driven environment is not likely to work too well, as the CPU will get stopped each time a string is output. More info at:

http://support.code-red-tech.com/CodeRedWiki/UsingPrintf

Regards,
CodeRedSupport
0 件の賞賛
返信