Skip to content

Commit 764a9ca

Browse files
committed
[bsp/stm32] add the bsp of sensor_tile_box
1 parent 2967da3 commit 764a9ca

32 files changed

+15665
-0
lines changed

bsp/stm32/stm32l4r9-st-sensortile-box/.config

Lines changed: 578 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
*.pyc
2+
*.map
3+
*.dblite
4+
*.elf
5+
*.bin
6+
*.hex
7+
*.axf
8+
*.exe
9+
*.pdb
10+
*.idb
11+
*.ilk
12+
*.old
13+
build
14+
Debug
15+
documentation/html
16+
packages/
17+
*~
18+
*.o
19+
*.obj
20+
*.out
21+
*.bak
22+
*.dep
23+
*.lib
24+
*.i
25+
*.d
26+
.DS_Stor*
27+
.config 3
28+
.config 4
29+
.config 5
30+
Midea-X1
31+
*.uimg
32+
GPATH
33+
GRTAGS
34+
GTAGS
35+
.vscode
36+
JLinkLog.txt
37+
JLinkSettings.ini
38+
DebugConfig/
39+
RTE/
40+
settings/
41+
*.uvguix*
42+
cconfig.h
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 "../libraries/Kconfig"
21+
source "board/Kconfig"
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# STM32L4R9ZI-MKSBOX1V1 开发板bsp说明
2+
3+
## 简介
4+
5+
由 supperthomas 为 STM32L4R9ZI-MKSBOX1V1 开发板提供的 BSP (板级支持包) 说明。
6+
7+
主要内容如下:
8+
9+
- 开发板资源介绍
10+
- BSP 快速上手
11+
- 进阶使用方法
12+
13+
通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
14+
15+
## 开发板介绍
16+
17+
开发板外观如下图所示:
18+
19+
![board](figures/board.png)
20+
21+
该开发板常用 **板载资源** 如下:
22+
23+
- MCU:STM32L4R9,主频 120MHz,2048KB FLASH ,640KB RAM
24+
- 常用外设
25+
- 状态指示灯:2个,LED1(PB5)LED 2(PF2)
26+
- UART1: RX(PA9) TX(PA10)
27+
- 按键:1个,USER_PB1(PG1)
28+
- 板载 BLE 模组SPBTLE-1S(SPI/UART)
29+
- 温度传感器STTS751(I2C3_SDA PG8 I2C3_SCL PG7 )
30+
- 温湿度HTS221 压力传感器LPS22HH I2C3_SDA(PB7) I2C3_SCL(PB6)
31+
- 加速度LIS2DW12 CS_ACC(PE11)
32+
-
33+
- 常用接口:SD 卡接口、USB OTG Micro USB 接口
34+
- 调试接口,ST-LINK Micro USB 接口
35+
开发板更多详细信息请参考 ST 的 [STM32L4R9ZI-MKSBOX1V1](https://www.st.com/zh/evaluation-tools/steval-mksbox1v1.html)介绍。
36+
37+
## 外设支持
38+
39+
本 BSP 目前对外设的支持情况如下:
40+
41+
| **板载外设** | **支持情况** | **备注** |
42+
| ---- | ---- | ---- |
43+
| 板载 ST-LINK 转串口 | 支持 | RX(PA9) TX(PA10) 需要外接ST-LINK 有ST-LINK插槽 |
44+
| BLE 模组SPBTLE-1S | 待支持 | |
45+
| 传感器 | 待支持 | |
46+
| | | |
47+
| **片上外设** | **支持情况** | **备注** |
48+
| GPIO | 支持 | LED1(PB5)LED 2(PF2) USER_PB1(PG1) |
49+
| UART | 支持 | UART1: RX(PA9) TX(PA10) CONSOLE |
50+
| USBD | 支持 | USBD CDC 虚拟串口已验证 |
51+
| SPI1 | 待支持 | SPI1_MOSI(PE15) SPI1_MISO(PE14) SPI1_CLK(PE13) |
52+
| SPI2 | 待支持 | SPI2_MOSI(PC3) SPI2_MISO(PD3) SPI2_SCK(PD1) SPI2_CS(PD0) |
53+
| IIC1 | 待支持 | I2C1_SCL(PB6) I2C_SDA(PB7) |
54+
55+
56+
## 使用说明
57+
58+
使用说明分为如下两个章节:
59+
60+
- 快速上手
61+
62+
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
63+
64+
- 进阶使用
65+
66+
本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
67+
68+
69+
### 快速上手
70+
71+
本 BSP 为开发者提供 MDK5 和 IAR 工程,并且支持 GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
72+
73+
#### 硬件连接
74+
75+
使用数据线连接开发板到 PC,打开电源开关。
76+
77+
#### 编译下载
78+
79+
双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
80+
81+
> 工程默认配置使用 STLINK 仿真器下载程序,你可以在你的其他NUCLEO板上接一个STLINK到开发板的SWD接口上
82+
83+
下载程序成功之后,系统会自动运行,观察开发板上 LED 的运行效果, LED 会周期性闪烁。
84+
85+
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(由STLINK连接的串口)(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
86+
87+
```bash
88+
\ | /
89+
- RT - Thread Operating System
90+
/ | \ 4.0.3 build Mar 22 2020
91+
2006 - 2020 Copyright by rt-thread team
92+
msh >
93+
```
94+
### 进阶使用
95+
96+
此 BSP 默认只开启了 GPIO 和 串口1的功能,如果需使用 SD 卡、Flash 等更多高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下:
97+
98+
1. 在 bsp 下打开 env 工具。
99+
100+
2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
101+
102+
3. 输入`pkgs --update`命令更新软件包。
103+
104+
4. 输入`scons --target=mdk5/iar` 命令重新生成工程。
105+
106+
本章节更多详细的介绍请参考 [STM32 系列 BSP 外设驱动使用教程](../docs/STM32系列BSP外设驱动使用教程.md)
107+
108+
## 注意事项
109+
110+
- 调试串口为串口1 映射到PA9 PA10,由ST-LINK连接
111+
- 板子上的外接接口有限,建议使用官方提供的转接板ST-LINK进行调试,也可以用DFU的方式进行烧入
112+
113+
114+
## 联系人信息
115+
116+
- 维护人:
117+
118+
- [super_mcu] 邮箱:[[email protected]](mailto:[email protected])
119+
120+
- 更详细的资料会整理在
121+
122+
[STM32L4R9ZI-MKSBOX1V1](https://github.com/supperthomas/BSP_BOARD_STM32L4R9ZI_MKSBOX1V1.git)
123+
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')
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
11+
try:
12+
from building import *
13+
except:
14+
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
15+
print(RTT_ROOT)
16+
exit(-1)
17+
18+
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
19+
20+
DefaultEnvironment(tools=[])
21+
env = Environment(tools = ['mingw'],
22+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
23+
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
24+
AR = rtconfig.AR, ARFLAGS = '-rc',
25+
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
26+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
27+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
28+
29+
if rtconfig.PLATFORM == 'iar':
30+
env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
31+
env.Replace(ARFLAGS = [''])
32+
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map')
33+
34+
Export('RTT_ROOT')
35+
Export('rtconfig')
36+
37+
SDK_ROOT = os.path.abspath('./')
38+
39+
if os.path.exists(SDK_ROOT + '/libraries'):
40+
libraries_path_prefix = SDK_ROOT + '/libraries'
41+
else:
42+
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
43+
44+
SDK_LIB = libraries_path_prefix
45+
Export('SDK_LIB')
46+
47+
# prepare building environment
48+
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
49+
50+
stm32_library = 'STM32L4xx_HAL'
51+
rtconfig.BSP_LIBRARY_TYPE = stm32_library
52+
53+
# include libraries
54+
objs.extend(SConscript(os.path.join(libraries_path_prefix, stm32_library, 'SConscript')))
55+
56+
# include drivers
57+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript')))
58+
59+
# make a building
60+
DoBuilding(TARGET, objs)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from building import *
2+
3+
cwd = GetCurrentDir()
4+
src = Glob('*.c')
5+
CPPPATH = [cwd]
6+
7+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
8+
9+
Return('group')
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-08-09 supperthomas first version
9+
*/
10+
11+
#include <rtthread.h>
12+
#include <rtdevice.h>
13+
#include <board.h>
14+
15+
/* defined the LED0 pin: PB15 */
16+
#define LED0_PIN GET_PIN(B, 15)
17+
18+
int main(void)
19+
{
20+
/* set LED0 pin mode to output */
21+
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
22+
while (1)
23+
{
24+
rt_pin_write(LED0_PIN, PIN_HIGH);
25+
rt_thread_mdelay(500);
26+
rt_pin_write(LED0_PIN, PIN_LOW);
27+
rt_thread_mdelay(500);
28+
}
29+
}

0 commit comments

Comments
 (0)