Skip to content

Commit 9d6a654

Browse files
authored
Merge pull request #5010 from supperthomas/rice_nrf52833
[bsp/nrf5x] add the bsp of nrf52833
2 parents 877bb07 + 8da2f96 commit 9d6a654

File tree

24 files changed

+14907
-0
lines changed

24 files changed

+14907
-0
lines changed

bsp/nrf5x/docs/images/nrf52833.jpg

140 KB
Loading

bsp/nrf5x/nrf52833/.config

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

bsp/nrf5x/nrf52833/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/nrf5x/nrf52833/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# nRF52833-PCA10010 BSP说明
2+
3+
## 简介
4+
5+
该文件夹主要存放所有主芯片为nRF52833的板级支持包。目前默认支持的开发板是官方[PCA10100](https://www.nordicsemi.com/Products/Development-hardware/nRF52833-DK)
6+
本文主要内容如下:
7+
8+
- 开发板资源介绍
9+
- 进阶使用方法
10+
11+
## 开发板介绍
12+
13+
PCA10100-nRF52833是Nordic 官方的开发板,搭载nRF52833 芯片,基于ARM Cortex-M4内核,最高主频64 MHz,具有丰富的外设资源。
14+
15+
开发板外观如下图所示
16+
17+
![nrf52833](../docs/images/nrf52833.jpg)
18+
19+
PCA10100-nRF52833 开发板常用 **板载资源** 如下:
20+
21+
- MCU:NRF52833,主频 64MHz,512KB FLASH ,128kB RAM
22+
- MCU 外设: GPIO, UART, SPI, I2C(TWI), RTC,TIMER,NFC,QSPI,PWM,ADC,USB,I2S
23+
- 板载设
24+
- LED:4个,USB communication (LD1), user LED (LD2), power LED (LD3) 。
25+
- 按键:5个,4个USER and 1个RESET 。
26+
- USB: 1个
27+
- 常用接口:USB device、Arduino Uno 接口
28+
- 调试接口:板载 J-LINK 调试器。
29+
30+
开发板更多详细信息请参考NORDIC官方[PCA10100](https://www.nordicsemi.com/Products/Development-hardware/nRF52833-DK)
31+
32+
33+
34+
## 外设支持
35+
36+
本 BSP 目前对外设的支持情况如下:
37+
38+
| **片上外设** | **支持情况** | **备注** |
39+
| :----------- | :----------: | :--------------------: |
40+
| UART | 支持 | UART0 |
41+
42+
43+
44+
### 进阶使用
45+
46+
此 BSP 默认只开启了串口 0 的功能,更多高级功能需要利用 env 工具对 BSP 进行配置,步骤如下:
47+
48+
1. 在 bsp 下打开 env 工具。
49+
50+
2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
51+
52+
3. 输入`pkgs --update`命令更新软件包。
53+
54+
4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。
55+
56+
57+
58+
## 支持其他开发板
59+
60+
客户可以将自己的开发板的.config文件和board/Kconfig文件到board/$(board_name)下面添加README.md即可,使用的时候替换.config文件
61+
62+
## 注意事项
63+
64+
## 联系人信息
65+
66+
维护人:
67+
68+
- [RiceChen], 邮箱:<[email protected]>

bsp/nrf5x/nrf52833/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/nrf5x/nrf52833/SConstruct

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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 = 'rt-thread.' + 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+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
26+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
27+
28+
if rtconfig.PLATFORM == 'iar':
29+
env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
30+
env.Replace(ARFLAGS = [''])
31+
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rt-thread.map')
32+
33+
Export('RTT_ROOT')
34+
Export('rtconfig')
35+
36+
SDK_ROOT = os.path.abspath('./')
37+
38+
if os.path.exists(SDK_ROOT + '/libraries'):
39+
libraries_path_prefix = SDK_ROOT + '/libraries'
40+
else:
41+
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
42+
43+
SDK_LIB = libraries_path_prefix
44+
Export('SDK_LIB')
45+
print(SDK_LIB)
46+
47+
# prepare building environment
48+
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
49+
50+
# include drivers
51+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
52+
53+
# include cmsis
54+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'cmsis', 'SConscript')))
55+
56+
# make a building
57+
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 = os.path.join(str(Dir('#')), 'applications')
6+
src = Glob('*.c')
7+
CPPPATH = [cwd, str(Dir('#'))]
8+
9+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
10+
11+
Return('group')
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
* 2020-04-29 supperthomas first version
9+
*
10+
*/
11+
12+
#include <rtthread.h>
13+
#include <rtdevice.h>
14+
15+
int main(void)
16+
{
17+
while (1)
18+
{
19+
rt_thread_mdelay(500);
20+
}
21+
return RT_EOK;
22+
}
23+

bsp/nrf5x/nrf52833/board/Kconfig

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
menu "Hardware Drivers Config"
2+
3+
config SOC_NRF52833
4+
bool
5+
select RT_USING_COMPONENTS_INIT
6+
select RT_USING_USER_MAIN
7+
default y
8+
9+
config SOC_NORDIC
10+
bool
11+
default y
12+
13+
choice
14+
prompt "Select BSP board "
15+
default BSP_BOARD_PCA_10100
16+
17+
config BSP_BOARD_PCA_10100
18+
bool "NRF52833 pca10100"
19+
20+
endchoice
21+
22+
menu "On-chip Peripheral Drivers"
23+
config BSP_USING_UART
24+
bool "Enable UART"
25+
default y
26+
select RT_USING_SERIAL
27+
config BSP_USING_UART0
28+
bool "Enable UART0"
29+
default y
30+
depends on BSP_USING_UART
31+
32+
config BSP_UART0_RX_PIN
33+
depends on BSP_USING_UART0
34+
int "uart0 rx pin number"
35+
default 8 if BSP_BOARD_PCA_10100
36+
37+
config BSP_UART0_TX_PIN
38+
depends on BSP_USING_UART0
39+
int "uart0 tx pin number"
40+
default 6 if BSP_BOARD_PCA_10100
41+
42+
menu "On-chip flash config"
43+
44+
config MCU_FLASH_START_ADDRESS
45+
hex "MCU FLASH START ADDRESS"
46+
default 0x00000000
47+
48+
config MCU_FLASH_SIZE_KB
49+
int "MCU FLASH SIZE, MAX size 1024 KB"
50+
default 1024
51+
52+
config MCU_SRAM_START_ADDRESS
53+
hex "MCU RAM START ADDRESS"
54+
default 0x20000000
55+
56+
config MCU_SRAM_SIZE_KB
57+
int "MCU RAM SIZE"
58+
default 256
59+
60+
config MCU_FLASH_PAGE_SIZE
61+
hex "MCU FLASH PAGE SIZE, please not change,nrfx default is 0x1000"
62+
default 0x1000
63+
endmenu
64+
65+
endmenu
66+
67+
if SOC_NORDIC
68+
config NRFX_CLOCK_ENABLED
69+
int
70+
default 1
71+
config NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY
72+
int
73+
default 7
74+
config NRFX_CLOCK_CONFIG_LF_SRC
75+
int
76+
default 1
77+
endif
78+
79+
if BSP_USING_UART
80+
config NRFX_USING_UART
81+
bool
82+
default y
83+
84+
config NRFX_UART_ENABLED
85+
int
86+
default 1
87+
88+
config NRFX_UART0_ENABLED
89+
int
90+
default 1
91+
depends on BSP_USING_UART0
92+
endif
93+
94+
choice
95+
prompt "BLE STACK"
96+
default BLE_STACK_USING_NULL
97+
help
98+
Select the ble stack
99+
100+
config BLE_STACK_USING_NULL
101+
bool "not use the ble stack"
102+
103+
config BSP_USING_SOFTDEVICE
104+
select PKG_USING_NRF5X_SDK
105+
bool "Nordic softdevice(perpheral)"
106+
107+
config BSP_USING_NIMBLE
108+
select PKG_USING_NIMBLE
109+
select PKG_NIMBLE_BSP_NRF52840
110+
bool "use nimble stack(iot)"
111+
endchoice
112+
113+
114+
endmenu
115+
116+
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]
8+
define = ['USE_APP_CONFIG']
9+
10+
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH,CPPDEFINES = define)
11+
Return('group')

0 commit comments

Comments
 (0)