printf() cannot be retargeted on S32K344 EVB

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

printf() cannot be retargeted on S32K344 EVB

跳至解决方案
2,743 次查看
jacst
Contributor II

Hi,I used the MCAL demo that comes with the S32K344 EVB and configured the UART module. The EVB can send messages normally. I added printf(), but the program does not seem to be retargeted. I need help, thank you very much.

0 项奖励
回复
1 解答
2,713 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello @jacst,

Sorry for late reply. Looks like there are three problems in your project:

1. The NEW_LIB library is linked to the old compiler (gcc_b1620, not gcc_9.2). I have to change the path as below:

namnguyenviet_0-1634635565067.pngnamnguyenviet_0-1634635565067.png

2. In retarget.c, write function only has 1 underscore instead of 2 (_write instead of __write).

3. You need to implement Uart_SyncSend function in _write function instead of async, otherwise you will need to wait until the transmission is completed. 

I have attached the fixed project, after fix these things I can see printf function is retargeted.

Best Regards,

Nam

 

在原帖中查看解决方案

0 项奖励
回复
2 回复数
2,714 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello @jacst,

Sorry for late reply. Looks like there are three problems in your project:

1. The NEW_LIB library is linked to the old compiler (gcc_b1620, not gcc_9.2). I have to change the path as below:

namnguyenviet_0-1634635565067.pngnamnguyenviet_0-1634635565067.png

2. In retarget.c, write function only has 1 underscore instead of 2 (_write instead of __write).

3. You need to implement Uart_SyncSend function in _write function instead of async, otherwise you will need to wait until the transmission is completed. 

I have attached the fixed project, after fix these things I can see printf function is retargeted.

Best Regards,

Nam

 

0 项奖励
回复
2,706 次查看
jacst
Contributor II

@namnguyenviet Thank you so much for solving our problem.

标记 (1)
0 项奖励
回复