Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lfmiao0
rt-thread
提交
40feb745
R
rt-thread
项目概览
lfmiao0
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
40feb745
编写于
1月 30, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
1月 30, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4276 from Guozhanxin/raspberry-pico
[bsp][raspberry-pico]add gpio drivers
上级
85845abb
7be2267c
变更
13
展开全部
显示空白变更内容
内联
并排
Showing
13 changed file
with
5627 addition
and
81 deletion
+5627
-81
.github/workflows/action.yml
.github/workflows/action.yml
+1
-0
bsp/raspberry-pico/.config
bsp/raspberry-pico/.config
+2
-28
bsp/raspberry-pico/README.md
bsp/raspberry-pico/README.md
+52
-4
bsp/raspberry-pico/SConstruct
bsp/raspberry-pico/SConstruct
+0
-6
bsp/raspberry-pico/applications/main.c
bsp/raspberry-pico/applications/main.c
+17
-12
bsp/raspberry-pico/drivers/board.c
bsp/raspberry-pico/drivers/board.c
+3
-3
bsp/raspberry-pico/drivers/board.h
bsp/raspberry-pico/drivers/board.h
+3
-4
bsp/raspberry-pico/drivers/drv_gpio.c
bsp/raspberry-pico/drivers/drv_gpio.c
+67
-0
bsp/raspberry-pico/drivers/drv_gpio.h
bsp/raspberry-pico/drivers/drv_gpio.h
+21
-0
bsp/raspberry-pico/drivers/drv_uart.h
bsp/raspberry-pico/drivers/drv_uart.h
+3
-3
bsp/raspberry-pico/figures/Pico-R3-Pinout.svg
bsp/raspberry-pico/figures/Pico-R3-Pinout.svg
+5457
-0
bsp/raspberry-pico/libraries/SConscript
bsp/raspberry-pico/libraries/SConscript
+0
-21
bsp/raspberry-pico/rtconfig.h
bsp/raspberry-pico/rtconfig.h
+1
-0
未找到文件。
.github/workflows/action.yml
浏览文件 @
40feb745
...
...
@@ -130,6 +130,7 @@ jobs:
-
{
RTT_BSP
:
"
at32/at32f403a-start"
,
RTT_TOOL_CHAIN
:
"
sourcery-arm"
}
-
{
RTT_BSP
:
"
at32/at32f407-start"
,
RTT_TOOL_CHAIN
:
"
sourcery-arm"
}
-
{
RTT_BSP
:
"
smartfusion2"
,
RTT_TOOL_CHAIN
:
"
sourcery-arm"
}
-
{
RTT_BSP
:
"
raspberry-pico"
,
RTT_TOOL_CHAIN
:
"
sourcery-arm"
}
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Set up Python
...
...
bsp/raspberry-pico/.config
浏览文件 @
40feb745
...
...
@@ -123,7 +123,7 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64
# CONFIG_RT_USING_CPUTIME is not set
# CONFIG_RT_USING_I2C is not set
# CONFIG_RT_USING_PHY is not set
# CONFIG_RT_USING_PIN is not set
CONFIG_RT_USING_PIN
=
y
# CONFIG_RT_USING_ADC is not set
# CONFIG_RT_USING_DAC is not set
# CONFIG_RT_USING_PWM is not set
...
...
@@ -274,7 +274,6 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_PDULIB is not set
# CONFIG_PKG_USING_BTSTACK is not set
# CONFIG_PKG_USING_LORAWAN_ED_STACK is not set
# CONFIG_PKG_USING_WAYZ_IOTKIT is not set
#
# security packages
...
...
@@ -314,8 +313,6 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
# CONFIG_PKG_USING_ULOG_FILE is not set
# CONFIG_PKG_USING_LOGMGR is not set
# CONFIG_PKG_USING_ADBD is not set
# CONFIG_PKG_USING_COREMARK is not set
# CONFIG_PKG_USING_DHRYSTONE is not set
...
...
@@ -328,11 +325,6 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_URLENCODE is not set
# CONFIG_PKG_USING_UMCN is not set
# CONFIG_PKG_USING_LWRB2RTT is not set
# CONFIG_PKG_USING_CPU_USAGE is not set
# CONFIG_PKG_USING_GBK2UTF8 is not set
# CONFIG_PKG_USING_VCONSOLE is not set
# CONFIG_PKG_USING_KDB is not set
# CONFIG_PKG_USING_WAMR is not set
#
# system packages
...
...
@@ -370,12 +362,6 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_UC_COMMON is not set
# CONFIG_PKG_USING_UC_MODBUS is not set
# CONFIG_PKG_USING_PPOOL is not set
# CONFIG_PKG_USING_OPENAMP is not set
# CONFIG_PKG_USING_RT_PRINTF is not set
# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set
# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set
# CONFIG_PKG_USING_QFPLIB_M3 is not set
#
# peripheral libraries and drivers
...
...
@@ -384,7 +370,6 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_SHT3X is not set
# CONFIG_PKG_USING_AS7341 is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_U8G2 is not set
...
...
@@ -434,10 +419,6 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_SSD1306 is not set
# CONFIG_PKG_USING_QKEY is not set
# CONFIG_PKG_USING_RS485 is not set
# CONFIG_PKG_USING_NES is not set
# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
# CONFIG_PKG_USING_VDEVICE is not set
# CONFIG_PKG_USING_SGM706 is not set
#
# miscellaneous packages
...
...
@@ -447,7 +428,6 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
# CONFIG_PKG_USING_LZMA is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
# CONFIG_PKG_USING_CANFESTIVAL is not set
...
...
@@ -483,11 +463,9 @@ CONFIG_RT_LIBC_USING_TIME=y
#
# CONFIG_PKG_USING_THREES is not set
# CONFIG_PKG_USING_2048 is not set
# CONFIG_PKG_USING_SNAKE is not set
# CONFIG_PKG_USING_TETRIS is not set
# CONFIG_PKG_USING_LWGPS is not set
# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set
# CONFIG_PKG_USING_STATE_MACHINE is not set
#
# Privated Packages of RealThread
...
...
@@ -525,10 +503,6 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_EMQ is not set
# CONFIG_PKG_USING_CFGM is not set
# CONFIG_PKG_USING_RT_CMSIS_DAP is not set
# CONFIG_PKG_USING_VIRTUAL_DEVICE is not set
# CONFIG_PKG_USING_SMODULE is not set
# CONFIG_PKG_USING_SNFD is not set
# CONFIG_PKG_USING_UDBD is not set
# CONFIG_PKG_USING_BENCHMARK is not set
# CONFIG_PKG_USING_UBJSON is not set
# CONFIG_PKG_USING_DATATYPE is not set
CONFIG_SOC_RP2040
=
y
bsp/raspberry-pico/README.md
浏览文件 @
40feb745
# Raspberry PICO
## Build
## Introduction
**Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces.**
**Key features include:**
-
RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
-
Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz
-
264KB of SRAM, and 2MB of on-board Flash memory
-
Castellated module allows soldering direct to carrier boards
-
USB 1.1 with device and host support
-
Low-power sleep and dormant modes
-
Drag-and-drop programming using mass storage over USB
-
26 × multi-function GPIO pins
-
2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels
-
Accurate clock and timer on-chip
-
Temperature sensor
-
Accelerated floating-point libraries on-chip
-
8 × Programmable I/O (PIO) state machines for custom peripheral support
![
Pico-R3-Pinout
](
figures/Pico-R3-Pinout.svg
)
## Supported compiler
Support GCC 6 and above compilers.
## Program firmware
### Step 1: build
```
scons -c
...
...
@@ -9,16 +40,20 @@ scons
**gcc version >= 6.x.x**
## Flash
### Step 2: flash
Run the following command in the linux environment.
```
./
L
ibraries/generated/elf2uf2 rtthread-pico.elf rtthread-pico.uf2
./
l
ibraries/generated/elf2uf2 rtthread-pico.elf rtthread-pico.uf2
```
-
Copy the rtthread-pico.uf2 file to the "RPI-RP2" disk
-
Then led blink.
## Run
## Running Result
The output information on serial port should be like this:
```
\ | /
...
...
@@ -29,3 +64,16 @@ Hello, RT-Thread!
msh >
```
## Peripheral Condition
| Drive | Support | Remark |
| ----- | ------- | ------ |
| UART | Support | UART0 |
| GPIO | Support | 0-29 |
| I2C | - | - |
| RTC | - | - |
| SDIO | - | - |
| SPI | - | - |
| TIMER | - | - |
| WDT | - | - |
bsp/raspberry-pico/SConstruct
浏览文件 @
40feb745
...
...
@@ -27,11 +27,5 @@ Export('rtconfig')
# prepare building environment
objs
=
PrepareBuilding
(
env
,
RTT_ROOT
)
#if GetDepend('RT_USING_RTGUI'):
# objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
# libc testsuite
# objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
# make a building
DoBuilding
(
TARGET
,
objs
)
bsp/raspberry-pico/applications/main.c
浏览文件 @
40feb745
/*
*
* Copyright (c) 20
20 Raspberry Pi (Trading) Ltd.
/*
* Copyright (c) 20
06-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-01-28 flybreak first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include "board.h"
int
main
()
{
const
uint
LED_PIN
=
25
;
#define LED_PIN 25
int
main
(
void
)
{
rt_kprintf
(
"Hello, RT-Thread!
\n
"
);
gpio_init
(
LED_PIN
);
gpio_set_dir
(
LED_PIN
,
GPIO_OUT
);
while
(
true
)
{
gpio_put
(
LED_PIN
,
1
);
rt_pin_mode
(
LED_PIN
,
PIN_MODE_OUTPUT
);
while
(
1
)
{
rt_pin_write
(
LED_PIN
,
1
);
rt_thread_mdelay
(
1000
);
gpio_put
(
LED_PIN
,
0
);
rt_pin_write
(
LED_PIN
,
0
);
rt_thread_mdelay
(
1000
);
}
}
...
...
bsp/raspberry-pico/drivers/board.c
浏览文件 @
40feb745
/*
* Copyright (c) 2006-20
18
, RT-Thread Development Team
* Copyright (c) 2006-20
21
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 20
09-01-05 Bernard first implementat
ion
* 20
21-01-28 flybreak first vers
ion
*/
#include <rthw.h>
...
...
bsp/raspberry-pico/drivers/board.h
浏览文件 @
40feb745
/*
* Copyright (c) 2006-20
18
, RT-Thread Development Team
* Copyright (c) 2006-20
21
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 20
09-09-22 Bernard add board.h to this bsp
* 20
21-01-28 flybreak first version
*/
// <<< Use Configuration Wizard in Context Menu >>>
#ifndef __BOARD_H__
#define __BOARD_H__
...
...
bsp/raspberry-pico/drivers/drv_gpio.c
0 → 100644
浏览文件 @
40feb745
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-01-28 flybreak first version
*/
#include "drv_gpio.h"
static
void
pico_pin_mode
(
struct
rt_device
*
dev
,
rt_base_t
pin
,
rt_base_t
mode
)
{
RT_ASSERT
((
0
<=
pin
)
&&
(
pin
<
N_GPIOS
));
gpio_init
(
pin
);
switch
(
mode
)
{
case
PIN_MODE_OUTPUT
:
gpio_set_dir
(
pin
,
GPIO_OUT
);
break
;
case
PIN_MODE_INPUT
:
gpio_set_dir
(
pin
,
GPIO_IN
);
break
;
case
PIN_MODE_INPUT_PULLUP
:
gpio_pull_up
(
pin
);
break
;
case
PIN_MODE_INPUT_PULLDOWN
:
gpio_pull_down
(
pin
);
break
;
case
PIN_MODE_OUTPUT_OD
:
gpio_disable_pulls
(
pin
);
break
;
}
}
static
void
pico_pin_write
(
struct
rt_device
*
dev
,
rt_base_t
pin
,
rt_base_t
value
)
{
RT_ASSERT
((
0
<=
pin
)
&&
(
pin
<
N_GPIOS
));
gpio_put
(
pin
,
value
);
}
static
int
pico_pin_read
(
struct
rt_device
*
device
,
rt_base_t
pin
)
{
RT_ASSERT
((
0
<=
pin
)
&&
(
pin
<
N_GPIOS
));
return
(
gpio_get
(
pin
)
?
PIN_HIGH
:
PIN_LOW
);
}
static
const
struct
rt_pin_ops
ops
=
{
pico_pin_mode
,
pico_pin_write
,
pico_pin_read
,
RT_NULL
,
RT_NULL
,
RT_NULL
,
RT_NULL
,
};
int
rt_hw_gpio_init
(
void
)
{
rt_device_pin_register
(
"gpio"
,
&
ops
,
RT_NULL
);
return
0
;
}
INIT_DEVICE_EXPORT
(
rt_hw_gpio_init
);
bsp/raspberry-pico/drivers/drv_gpio.h
0 → 100644
浏览文件 @
40feb745
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-01-28 flybreak first version
*/
#ifndef __DRV_GPIO_H__
#define __DRV_GPIO_H__
#include <rtdevice.h>
#include <rtthread.h>
#include "board.h"
int
rt_hw_gpio_init
(
void
);
#endif
/* __DRV_GPIO_H__ */
bsp/raspberry-pico/drivers/drv_uart.h
浏览文件 @
40feb745
/*
* Copyright (c) 2006-20
18
, RT-Thread Development Team
* Copyright (c) 2006-20
21
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 20
09-01-05 Bernard the
first version
* 20
21-01-28 flybreak
first version
*/
#ifndef __USART_H__
...
...
bsp/raspberry-pico/figures/Pico-R3-Pinout.svg
0 → 100644
浏览文件 @
40feb745
此差异已折叠。
点击以展开。
bsp/raspberry-pico/libraries/SConscript
浏览文件 @
40feb745
...
...
@@ -55,19 +55,6 @@ pico-sdk/src/rp2_common/pico_standard_link/crt0.S
generated/bs2_default_padded_checksummed.S
"""
)
# # starupt scripts for STM32F2xx
# startup_scripts = 'startup_stm32f2xx.s'
# # add for startup script
# if rtconfig.CROSS_TOOL == 'gcc':
# src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F2xx/startup/gcc_ride7/' + startup_scripts]
# elif rtconfig.CROSS_TOOL == 'keil':
# src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F2xx/startup/arm/' + startup_scripts]
# elif rtconfig.CROSS_TOOL == 'iar':
# src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F2xx/startup/iar/' + startup_scripts]
# /home/henson/Documents/rasp-pico/pico/pico-examples/build/generated/pico_base
path
=
[
cwd
+
'/pico-sdk/src/common/pico_stdlib/include'
,
cwd
+
'/pico-sdk/src/rp2_common/hardware_gpio/include'
,
...
...
@@ -106,14 +93,6 @@ path = [
cwd
+
'/generated/pico_base'
]
# path += [cwd + '/CMSIS/CM3/CoreSupport',
# cwd + '/CMSIS/Include']
# if GetDepend('RT_USING_LWIP') == True:
# src = src + ['STM32F2x7_ETH_Driver/src/stm32f2x7_eth.c']
# path = path + [cwd + '/STM32F2x7_ETH_Driver/inc']
CPPDEFINES
=
[
'PICO_NO_BINARY_INFO'
,
'PICO_NO_PROGRAM_INFO'
,
...
...
bsp/raspberry-pico/rtconfig.h
浏览文件 @
40feb745
...
...
@@ -80,6 +80,7 @@
#define RT_USING_SERIAL
#define RT_SERIAL_USING_DMA
#define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_PIN
/* Using USB */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录