AnsweredAssumed Answered

printf() using ITM

Question asked by prachipanse on Feb 27, 2017

Hi,

I need to make use of printf() statements for debugging. Since the code involves multiple interrupts, I want to use retargetting to UART instead of using semihosting (as recommended at What is Semihosting?). I am using Redlib nohost library. I am using the LPCOpen Chip library only and not the board library. I have added the retarget_itm.c file available at- How to use ITM Printf.

 

I have some queries regarding the same. 

1. Can ITM be used both with and without semihosting? If yes, then how does it happen? (since it requires that the redlib semihost or redlib or newlib nohost library be used.)

2. How is printf() mapped to the __sys_write() function defined in the retarget_itm.c? 

3. The __sys_write() function in retarget_itm.c is not being called when I use printf statements. However, the program gets compiled. Please let me know what might be the issue.

 

Regards,

Prachi

Outcomes