This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0L1306: 如何在CCS上编译支持将printf重定向到串口的代码?

Part Number: MSPM0L1306

我在基于MSPM0L1306芯片上开发UART代码,想使用重载fputc来最终支持将printf函数重定向到UART输出。目前做了如下尝试:

1、如附件所示,编辑了C代码,在基于Keil构建的MSPM0L1306工程,目前测试是可以实现将printf函数重定向到UART输出的。

2、但在用CCS12.5下,使用同样的C代码,编译下载运行,所有的printf是不起作用的。

想咨询如何修改CCS工程配置或者修改C代码,达到支持printf函数重定向到UART上?

uart_loopback.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
* Copyright (c) 2023, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX