Skip to content

Commit aebdcac

Browse files
committed
first commit of tm4c123bsp, validate on MDK5
1 parent 3408c57 commit aebdcac

File tree

149 files changed

+153048
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+153048
-0
lines changed

bsp/tm4c123bsp/.config

Lines changed: 478 additions & 0 deletions
Large diffs are not rendered by default.

bsp/tm4c123bsp/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
mainmenu "RT-Thread Configuration"
2+
3+
config BSP_DIR
4+
string
5+
option env="BSP_ROOT"
6+
default "."
7+
8+
config RTT_DIR
9+
string
10+
option env="RTT_ROOT"
11+
default "../.."
12+
13+
config PKGS_DIR
14+
string
15+
option env="PKGS_ROOT"
16+
default "packages"
17+
18+
source "$RTT_DIR/Kconfig"
19+
source "$PKGS_DIR/Kconfig"
20+
source "board/Kconfig"
21+

bsp/tm4c123bsp/README.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# BSP README 模板
2+
3+
## 简介
4+
5+
本文档为ek-tm4c123gxl开发板的 BSP (板级支持包) 说明。
6+
7+
主要内容如下:
8+
9+
- 开发板资源介绍
10+
- BSP 快速上手
11+
- 进阶使用方法
12+
13+
通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
14+
15+
## 开发板介绍
16+
17+
【此处简单介绍一下开发板】
18+
19+
开发板外观如下图所示:
20+
21+
![](E:\00MyWorkSpace\tm4c123_rtos\tm4c123bsp\figures\board.jpg)
22+
23+
该开发板常用 **板载资源** 如下:
24+
25+
- MCU:TM4C123Gh6PM,主频 80MHz,256KB FLASH ,32KB RAM
26+
- 外部 RAM:型号,xMB
27+
- 外部 FLASH:型号,xMB
28+
- 常用外设
29+
- LED:1个三色,(红色,PF1),(蓝色,PF2),(绿色,PF3)
30+
- 按键:2个,SW1(PF4),SW2(兼具唤醒功能,PF0)
31+
- 常用接口:ICDI(具串口功能)、USB接口
32+
- 调试接口,ICDI
33+
34+
开发板更多详细信息请参考【TI】 [TM4C123G开发板介绍](https://www.ti.com/tool/EK-TM4C123GXL?DCMP=stellaris-launchpad&HQS=tm4c123g-launchpad)
35+
36+
## 外设支持
37+
38+
本 BSP 目前对外设的支持情况如下:
39+
40+
| **板载外设** | **支持情况** | **备注** |
41+
| :----------------- | :----------: | :------------------------------------- |
42+
| USB 转串口 | 支持 | |
43+
| SPI Flash | 暂不支持 | |
44+
| 以太网 | 暂不支持 | |
45+
| SD卡 | 暂不支持 | |
46+
| CAN | 暂不支持 | |
47+
| **片上外设** | **支持情况** | **备注** |
48+
| GPIO | 支持 | PF0, PF1... PF4---> PIN: 0, 1...4 |
49+
| UART | 支持 | UART0/1/2/3 |
50+
| SPI | 支持 | SPI0/1/2 |
51+
| I2C | 支持 | 软件 I2C |
52+
| SDIO | 暂不支持 | 即将支持 |
53+
| RTC | 暂不支持 | 即将支持 |
54+
| PWM | 支持 | PWM0/1/2/3/4/5/6/7 |
55+
| USB Device | 暂不支持 | 即将支持 |
56+
| USB Host | 暂不支持 | 即将支持 |
57+
| IWG | 暂不支持 | 即将支持 |
58+
| **扩展模块** | **支持情况** | **备注** |
59+
| xxx 模块 | 支持 | |
60+
61+
## 使用说明
62+
63+
使用说明分为如下两个章节:
64+
65+
- 快速上手
66+
67+
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
68+
69+
- 进阶使用
70+
71+
本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
72+
73+
74+
### 快速上手
75+
76+
本 BSP 为开发者提供 MDK4、MDK5 和 IAR 工程,并且支持 GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
77+
78+
#### 硬件连接
79+
80+
使用数据线连接开发板到 PC,打开电源开关。
81+
82+
#### 编译下载
83+
84+
双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
85+
86+
> 工程默认配置使用 ICDI 仿真器下载程序,在通过USB连接开发板的基础上,点击下载按钮即可下载程序到开发板
87+
88+
#### 运行结果
89+
90+
下载程序成功之后,系统会自动运行,【这里写开发板运行起来之后的现象,如:LED 闪烁等】。
91+
92+
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
93+
94+
```bash
95+
\ | /
96+
- RT - Thread Operating System
97+
/ | \ 3.1.1 build Nov 19 2018
98+
2006 - 2018 Copyright by rt-thread team
99+
msh >
100+
```
101+
### 进阶使用
102+
103+
此 BSP 默认只开启了 GPIO 和 串口0 的功能,如果需使用 SD 卡、Flash 等更多高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下:
104+
105+
1. 在 bsp 下打开 env 工具。
106+
107+
2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
108+
109+
3. 输入`pkgs --update`命令更新软件包。
110+
111+
4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。
112+
113+
本章节更多详细的介绍请结合 [STM32 系列 BSP 外设驱动使用教程](../docs/STM32系列BSP外设驱动使用教程.md)学习使用。
114+
115+
## 注意事项
116+
117+
- 本BSP配置片上外设在board/tm4c123gh6pz_config.c/h中进行配置。配置时钟在board.c文件中进行
118+
119+
## 联系人信息
120+
121+
维护人:
122+
123+
- [AHTYDHD](https://github.com/LYH-ux), 邮箱:<[email protected]>

bsp/tm4c123bsp/SConscript

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# for module compiling
2+
import os
3+
Import('RTT_ROOT')
4+
from building import *
5+
6+
cwd = GetCurrentDir()
7+
objs = []
8+
list = os.listdir(cwd)
9+
10+
for d in list:
11+
path = os.path.join(cwd, d)
12+
if os.path.isfile(os.path.join(path, 'SConscript')):
13+
objs = objs + SConscript(os.path.join(d, 'SConscript'))
14+
15+
Return('objs')

bsp/tm4c123bsp/SConstruct

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import os
2+
import sys
3+
import rtconfig
4+
5+
if os.getenv('RTT_ROOT'):
6+
RTT_ROOT = os.getenv('RTT_ROOT')
7+
else:
8+
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
9+
10+
# set RTT_ROOT
11+
#if not os.getenv("RTT_ROOT"):
12+
#RTT_ROOT="rt-thread"
13+
14+
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
15+
try:
16+
from building import *
17+
except:
18+
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
19+
print(RTT_ROOT)
20+
exit(-1)
21+
22+
TARGET = 'rt-thread.' + rtconfig.TARGET_EXT
23+
24+
DefaultEnvironment(tools=[])
25+
env = Environment(tools = ['mingw'],
26+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
27+
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
28+
AR = rtconfig.AR, ARFLAGS = '-rc',
29+
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
30+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
31+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
32+
33+
if rtconfig.PLATFORM == 'iar':
34+
env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
35+
env.Replace(ARFLAGS = [''])
36+
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rt-thread.map')
37+
38+
Export('RTT_ROOT')
39+
Export('rtconfig')
40+
41+
SDK_ROOT = os.path.abspath('./')
42+
43+
if os.path.exists(SDK_ROOT + '/libraries'):
44+
libraries_path_prefix = SDK_ROOT + '/libraries'
45+
else:
46+
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
47+
48+
SDK_LIB = libraries_path_prefix
49+
Export('SDK_LIB')
50+
51+
# prepare building environment
52+
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
53+
54+
tm4c123_library = 'TivaWare_C_series'
55+
rtconfig.BSP_LIBRARY_TYPE = tm4c123_library
56+
57+
# include libraries
58+
objs.extend(SConscript(os.path.join(libraries_path_prefix, tm4c123_library, 'SConscript')))
59+
60+
# include drivers
61+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'Drivers', 'SConscript')))
62+
63+
# make a building
64+
DoBuilding(TARGET, objs)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Import('RTT_ROOT')
2+
Import('rtconfig')
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
src = Glob('*.c')
7+
CPPPATH = [cwd, str(Dir('#'))]
8+
9+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
10+
11+
Return('group')

bsp/tm4c123bsp/applications/main.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2018-11-06 SummerGift first version
9+
*/
10+
11+
#include <rtthread.h>
12+
#include <rtdevice.h>
13+
14+
int main(void)
15+
{
16+
int count = 1;
17+
/* set LED0 pin mode to output */
18+
rt_pin_mode(2, PIN_MODE_OUTPUT);
19+
20+
while (count++)
21+
{
22+
rt_pin_write(2, PIN_HIGH);
23+
rt_thread_mdelay(500);
24+
rt_pin_write(2, PIN_LOW);
25+
rt_thread_mdelay(500);
26+
}
27+
28+
return RT_EOK;
29+
}

0 commit comments

Comments
 (0)