【Telink --TL322X 开发板】SDK 功能使用
本帖最后由 andeyqi 于 2026-6-9 20:06 编辑【简介】
在上一篇帖子中我们已经安装了开发依赖的IDE(Telink IoT Studio) 烧写调试工具BDT,将官方的SDK导入IDE 发现sdk中包含如下的demo工程。
!(//m.qjumbo.com/forum/data/attachment/forum/202606/06/152414eb0bfbfzm3i1sfjh.png)
官方的 SDK 中包含了很多的demo,选择一个demo 会调用如下的脚本来生成buidl 的config 文件。
!(//m.qjumbo.com/forum/data/attachment/forum/202606/09/180654s1fik6fcob1ks7gs.png)
```
#!/bin/bash
CONFIG_NAME=$1;SCRIPT_DIR=$(dirname "$0");TARGET_FILE=$SCRIPT_DIR/../../demo/vendor/common/common/build_config.h;if [ -f "$TARGET_FILE" ]; then CURRENT_CONFIG=$(grep -oP 'CURRENT_BUILD_\K\w+(?=\s*1//Compile option name)' "$TARGET_FILE" || echo ""); else CURRENT_CONFIG=""; fi;if [ "$CURRENT_CONFIG" != "$CONFIG_NAME" ]; then echo '/********************************************************************************************************
* @file build_config.h
*
* @brief This is the source file for Telink RISC-V MCU
*
* @authorDriver Group
* @date 2025
*
* @par Copyright (c) 2025, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*******************************************************************************************************/
/* Auto-generated by build script */
#ifndef BUILD_CONFIG_H
#define BUILD_CONFIG_H
#define CURRENT_BUILD_'$CONFIG_NAME' 1//Compile option name
#endif' > "$TARGET_FILE"; echo "Updated build_config.h with new config: $CONFIG_NAME"; else echo "build_config.h already contains current config: $CONFIG_NAME, no update needed"; fi
```
该脚本会将选择的demo的配置更新到build_config.h文件中。
本次试验先从gpio的demo 着手来熟悉点点taptap安卓,demo 工程编译成功后下通过BDT工具将bin文件下载到点点taptap安卓中。
!(//m.qjumbo.com/forum/data/attachment/forum/202606/09/180449ctg5aw399r9mtz09.png)
修改GPIO demo 代码并添加打印输出:
```
void main_loop(void)
{
#if (GPIO_DEMO_MODE == GPIO_DEMO_SQUARE_WAVE)
gpio_toggle(KEY3);
#endif
gpio_toggle(LED2);
delay_ms(500);
printf("led2 toggle\r\n");
}
```
默认的printf 输出映射到PTA0.上述代码运行输出如下
!(//m.qjumbo.com/forum/data/attachment/forum/202606/09/195615pmh6uwmn15n2x5bv.png)
硬件上集成了USB转串口的点点taptap安卓我们可以将printf 映射到此端口就不需要外接串口了。对用的USB 转串口的点点taptap安卓和PD6连接,我们将此端口对接到printf函数。
!(//m.qjumbo.com/forum/data/attachment/forum/202606/09/200131yberers33wuseser.png)
修改此处配置为PTD6
!(//m.qjumbo.com/forum/data/attachment/forum/202606/09/200255o57msh511omyzcci.png)
修改后就不需要外接串口使用板载的USB 串口来打印输出了。
!(//m.qjumbo.com/forum/data/attachment/forum/202606/09/200625q85p888oxvx5c7on.png)
页:
[1]