Skip to content

Commit e484ff5

Browse files
authored
添加 imxrt1060-evk BSP (#5657)
* 添加 imxrt1060-evk BSP * add LVGL * add README.md * Delete irrelevant files * Modify the optimization level to O1 * Organize documents * Source code formatting
1 parent 7c53d46 commit e484ff5

File tree

305 files changed

+505672
-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.

305 files changed

+505672
-0
lines changed

bsp/imxrt/imxrt1060-nxp-evk/.config

Lines changed: 671 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# files format check exclude path, please follow the instructions below to modify;
2+
3+
dir_path:
4+
- board/board.c
5+
- board/MCUX_Config
6+
- xip
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
mainmenu "RT-Thread Configuration"
2+
3+
config RTT_DIR
4+
string
5+
option env="RTT_ROOT"
6+
default "../../.."
7+
8+
config PKGS_DIR
9+
string
10+
option env="PKGS_ROOT"
11+
default "packages"
12+
13+
source "$RTT_DIR/Kconfig"
14+
source "$PKGS_DIR/Kconfig"
15+
source "../libraries/Kconfig"
16+
source "board/Kconfig"
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# BSP README 模板
2+
3+
## 简介
4+
5+
本文档为 MIMXRT1060-EVK 开发板的 BSP (板级支持包) 说明。
6+
7+
主要内容如下:
8+
9+
- 开发板资源介绍
10+
- BSP 快速上手
11+
- 进阶使用方法
12+
13+
通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
14+
15+
## 开发板介绍
16+
17+
开发板外观如下图所示:
18+
19+
![board](figures/MIMXRT1060EVKB.jpg)
20+
21+
该开发板常用 **板载资源** 如下:
22+
23+
- MCU:MIMXRT1062DVL6A,主频 600MHz,4096KB FLASH ,1024KB RAM
24+
- 外部 RAM:型号IS42S16160J-6BLI,32MB
25+
- 外部 FLASH:型号S26KS512SDPBHI02,64MB
26+
- 常用外设
27+
- LED:1个,D18(绿色)
28+
- 按键:1个
29+
- 常用接口:USB 转串口、SD 卡接口、以太网接口、LCD 接口等
30+
- 调试接口,标准 JTAG/SWD
31+
32+
开发板更多详细信息请参考【NXP】 [MIMXRT1060-EVK开发板介绍](https://www.nxp.com.cn/design/development-boards/i-mx-evaluation-and-development-boards/i-mx-rt1060-evaluation-kit:MIMXRT1060-EVK)
33+
34+
## 外设支持
35+
36+
本 BSP 目前对外设的支持情况如下:
37+
38+
| **板载外设** | **支持情况** | **备注** |
39+
| :----------------- | :----------: | :------------------------------------- |
40+
| USB 转串口 | 支持 | |
41+
| SPI Flash | 支持 | |
42+
| 以太网 | 支持 | |
43+
| **片上外设** | **支持情况** | **备注** |
44+
| GPIO | 支持 | PA0, PA1... PK15 ---> PIN: 0, 1...176 |
45+
| UART | 支持 | UART1 |
46+
| SPI | 暂不支持 | 即将支持 |
47+
| I2C | 暂不支持 | 即将支持 |
48+
| SDIO | 暂不支持 | 即将支持 |
49+
| RTC | 暂不支持 | 即将支持 |
50+
| PWM | 暂不支持 | 即将支持 |
51+
| USB Device | 暂不支持 | 即将支持 |
52+
| USB Host | 暂不支持 | 即将支持 |
53+
| IWG | 暂不支持 | 即将支持 |
54+
| **扩展模块** | **支持情况** | **备注** |
55+
| LVGL | 支持 | |
56+
57+
## 使用说明
58+
59+
使用说明分为如下两个章节:
60+
61+
- 快速上手
62+
63+
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
64+
65+
- 进阶使用
66+
67+
本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
68+
69+
70+
### 快速上手
71+
72+
本 BSP 为开发者提供 MDK4、MDK5 和 IAR 工程,以及GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
73+
74+
#### 硬件连接
75+
76+
使用数据线连接开发板到 PC,打开电源开关。
77+
78+
#### 编译下载
79+
80+
双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
81+
82+
> 工程默认配置使用 CMSIS-DAP 仿真器下载程序,在通过 USB 连接开发板的基础上,点击下载按钮即可下载程序到开发板
83+
84+
#### 运行结果
85+
86+
下载程序成功之后,系统会自动运行,LED会以1Hz的频率闪烁。
87+
88+
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
89+
90+
```bash
91+
\ | /
92+
- RT - Thread Operating System
93+
/ | \ 4.1.0 build Mar 10 2022 18:07:41
94+
2006 - 2022 Copyright by RT-Thread team
95+
msh >
96+
```
97+
### 进阶使用
98+
99+
此 BSP 默认只开启了 GPIO 和 串口1 的功能,如果需使用 SD 卡、Flash 等更多高级功能,需要利用 ENV 工具对BSP 进行配置(暂时还不支持,等待第二阶段),步骤如下:
100+
101+
1. 在 bsp 下打开 env 工具。
102+
103+
2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
104+
105+
3. 输入`pkgs --update`命令更新软件包。
106+
107+
4. 输入`scons --target=mdk/iar` 命令重新生成工程。
108+
109+
本章节更多详细的介绍请参考 [IMXRT 系列 BSP 外设驱动使用教程](../docs/IMXRT系列BSP外设驱动使用教程.md)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# for module compiling
2+
import os
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
objs = []
7+
list = os.listdir(cwd)
8+
9+
for d in list:
10+
path = os.path.join(cwd, d)
11+
if os.path.isfile(os.path.join(path, 'SConscript')):
12+
objs = objs + SConscript(os.path.join(d, 'SConscript'))
13+
14+
Return('objs')
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
DefaultEnvironment(tools=[])
20+
if rtconfig.PLATFORM == 'armcc':
21+
env = Environment(tools = ['mingw'],
22+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
23+
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
24+
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
25+
AR = rtconfig.AR, ARFLAGS = '-rc',
26+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
27+
# overwrite cflags, because cflags has '--C99'
28+
CXXCOM = '$CXX -o $TARGET --cpp -c $CXXFLAGS $_CCCOMCOM $SOURCES')
29+
else:
30+
env = Environment(tools = ['mingw'],
31+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
32+
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
33+
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
34+
AR = rtconfig.AR, ARFLAGS = '-rc',
35+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
36+
CXXCOM = '$CXX -o $TARGET -c $CXXFLAGS $_CCCOMCOM $SOURCES')
37+
38+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
39+
40+
if rtconfig.PLATFORM == 'iar':
41+
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
42+
env.Replace(ARFLAGS = [''])
43+
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map')
44+
45+
Export('RTT_ROOT')
46+
Export('rtconfig')
47+
48+
SDK_ROOT = os.path.abspath('./')
49+
if os.path.exists(SDK_ROOT + '/libraries'):
50+
libraries_path_prefix = SDK_ROOT + '/libraries'
51+
else:
52+
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
53+
54+
SDK_LIB = libraries_path_prefix
55+
Export('SDK_LIB')
56+
57+
# prepare building environment
58+
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
59+
60+
imxrt_library = 'MIMXRT1060'
61+
rtconfig.BSP_LIBRARY_TYPE = imxrt_library
62+
63+
# include libraries
64+
objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SConscript')))
65+
66+
# include drivers
67+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
68+
69+
# include peripherals
70+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'peripherals', 'SConscript')))
71+
72+
# make a building
73+
DoBuilding(TARGET, objs)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import rtconfig
2+
from building import *
3+
4+
cwd = GetCurrentDir()
5+
src = Glob('*.c')
6+
CPPPATH = [cwd]
7+
8+
# add for startup script
9+
if rtconfig.CROSS_TOOL == 'gcc':
10+
CPPDEFINES = ['__START=entry']
11+
else:
12+
CPPDEFINES = []
13+
14+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
15+
16+
list = os.listdir(cwd)
17+
for item in list:
18+
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
19+
group = group + SConscript(os.path.join(item, 'SConscript'))
20+
21+
Return('group')
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
from building import *
3+
4+
cwd = GetCurrentDir()
5+
group = []
6+
src = Glob('*.c')
7+
CPPPATH = [cwd]
8+
CPPDEFINES = []
9+
10+
list = os.listdir(cwd)
11+
for d in list:
12+
path = os.path.join(cwd, d)
13+
if os.path.isfile(os.path.join(path, 'SConscript')):
14+
group = group + SConscript(os.path.join(d, 'SConscript'))
15+
16+
group = group + DefineGroup('LVGL-port', src, depend = ['BSP_USING_LVGL'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
17+
18+
Return('group')
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2006-2022, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-10-18 Meco Man First version
9+
*/
10+
11+
#ifndef LV_CONF_H
12+
#define LV_CONF_H
13+
14+
#define LV_USE_PERF_MONITOR 1
15+
#define LV_COLOR_DEPTH 16
16+
17+
#define LV_USE_NXP_SOC 1
18+
//#define LV_USE_GPU_NXP_PXP 1
19+
//#define LV_USE_GPU_NXP_VG_LITE 0
20+
//#define LV_USE_GPU_NXP_PXP_AUTO_INIT 1
21+
22+
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 64
23+
24+
/* music player demo */
25+
#define LV_HOR_RES_MAX 480
26+
#define LV_VER_RES_MAX 272
27+
#define LV_USE_DEMO_RTT_MUSIC 1
28+
#define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
29+
#define LV_FONT_MONTSERRAT_12 1
30+
#define LV_FONT_MONTSERRAT_16 1
31+
32+
#endif
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (c) 2006-2022, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-10-17 Meco Man First version
9+
*/
10+
#include <rtthread.h>
11+
#include <lvgl.h>
12+
#include <lv_port_indev.h>
13+
#define DBG_TAG "LVGL.demo"
14+
#define DBG_LVL DBG_INFO
15+
#include <rtdbg.h>
16+
17+
#ifndef LV_THREAD_STACK_SIZE
18+
#define LV_THREAD_STACK_SIZE 4096
19+
#endif
20+
21+
#ifndef LV_THREAD_PRIO
22+
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX * 2 / 8)
23+
#endif
24+
25+
static struct rt_thread lvgl_thread;
26+
static rt_uint8_t lvgl_thread_stack[LV_THREAD_STACK_SIZE];
27+
28+
static void lvgl_entry(void *parameter)
29+
{
30+
extern void lv_demo_music(void);
31+
lv_demo_music();
32+
33+
while(1)
34+
{
35+
lv_task_handler();
36+
rt_thread_mdelay(5);
37+
}
38+
}
39+
40+
static int lvgl_demo_init(void)
41+
{
42+
rt_thread_t tid;
43+
44+
rt_thread_init(&lvgl_thread,
45+
"LVGL",
46+
lvgl_entry,
47+
RT_NULL,
48+
&lvgl_thread_stack[0],
49+
sizeof(lvgl_thread_stack),
50+
LV_THREAD_PRIO,
51+
10);
52+
rt_thread_startup(&lvgl_thread);
53+
54+
return 0;
55+
}
56+
INIT_APP_EXPORT(lvgl_demo_init);

0 commit comments

Comments
 (0)