Skip to content

Commit bee6e72

Browse files
authored
Merge branch 'RT-Thread:master' into master
2 parents 681c024 + 31ff6fe commit bee6e72

File tree

16 files changed

+953
-350
lines changed

16 files changed

+953
-350
lines changed

.github/workflows/bsp_buildings.yml

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -41,66 +41,29 @@ permissions:
4141
jobs:
4242
generate-matrix:
4343
runs-on: ubuntu-22.04
44+
name: 🔍 Summary of Git Diff Changes
4445
outputs:
4546
filtered_matrix: ${{ steps.filter.outputs.filtered_matrix }}
4647
steps:
4748
- name: Checkout repo
4849
uses: actions/checkout@main
4950
with:
50-
sparse-checkout: .github/ALL_BSP_COMPILE.json
5151
persist-credentials: false
52-
- name: Read matrix config
53-
id: read-config
54-
run: |
55-
#读取ALL_BSP_COMPILE.json文件
56-
raw_matrix_base64=$(cat .github/ALL_BSP_COMPILE.json |egrep -v '^//'|base64 -w 0)
57-
echo "raw_matrix=$raw_matrix_base64" >> $GITHUB_OUTPUT
58-
- name: Get changed files
59-
id: changed_files
60-
if: github.event_name == 'pull_request'
61-
run: |
62-
changed_files=$(curl -s \
63-
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
64-
jq -r '.[].filename')
65-
prefix=$(echo "$changed_files" | cut -d'/' -f1 | sort -u )
66-
has_bsp=true
67-
for r in "$prefix"; do
68-
if [[ ! "$r" == "bsp" ]]; then
69-
has_bsp=false
70-
break
71-
fi
72-
done
73-
if [[ $has_bsp == true ]]; then
74-
changed_files=$(echo "${changed_files}"| cut -d'/' -f2 | sort -u| tr '\n' ',' | sed 's/,$//')
75-
echo "CHANGED_FILES=[${changed_files}]" >> $GITHUB_OUTPUT
76-
fi
77-
#获取修改文件的路径,如果有bsp以外的文件夹则编译全部bsp,否则获取对应文件夹名
78-
79-
echo "${changed_files}"
52+
fetch-depth: 0
8053
- name: Filter matrix
8154
id: filter
8255
run: |
83-
raw_matrix=$(echo "${{ steps.read-config.outputs.raw_matrix }}" | base64 --decode)
84-
85-
CHANGED_FILES=${{ steps.changed_files.outputs.CHANGED_FILES }}
86-
CHANGED_FILES=$(echo "$CHANGED_FILES" | sed 's/\[\|\]//g')
87-
# 将修改的文件路径与ALL_BSP_COMPILE.json文件的SUB_RTT_BSP进行判断,判断是否包含
88-
filtered_matrix=[]
89-
echo "${CHANGED_FILES}"
90-
if [[ -z "$CHANGED_FILES" ]]; then
91-
FILTER_CONDITION='.legs[]'
92-
filtered_matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix")
93-
else
94-
CONDITIONS=$(echo "$CHANGED_FILES" | awk 'BEGIN { RS="," } { printf "contains(\"%s\") or ", $1 }')
95-
CONDITIONS=${CONDITIONS% or }
96-
97-
FILTER_CONDITION=".legs[] | select(any(.SUB_RTT_BSP[]; $CONDITIONS))"
98-
99-
filtered_matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix")
100-
fi
56+
git config --global http.postBuffer 524288000
57+
git remote -v
58+
git fetch origin
59+
git branch
60+
git branch -a
61+
python tools/ci/git_diff_show.py origin/master
62+
raw_matrix=$(cat .github/ALL_BSP_COMPILE_TEMP.json)
10163
64+
FILTER_CONDITION='.legs[]'
65+
filtered_matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix")
10266
echo "filtered_matrix=${filtered_matrix}" >> $GITHUB_OUTPUT
103-
10467
echo ${filtered_matrix}
10568
build:
10669
runs-on: ubuntu-22.04

.github/workflows/git_diff_status_show.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

bsp/ESP32_C3/README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Each peripheral supporting condition for this BSP is as follows:
4141
| ------------------------ | --------------- | ------------------------------------------------------------ |
4242
| GPIO | Support | |
4343
| UART | Support | Using LUATOS_ESP32C3 development board requires connecting serial port to USB chip UART0_TX and UART0_RX (such as CP2102) |
44+
| I2C | Supported | Hardware I2C may encounter transmission errors. Software I2C is recommended, but it occupies a general hardware system timer. |
45+
| SPI | Supported | Supports custom configuration |
4446
| JTAG debug | Support | ESP32C3 usb-linked development boards can be debugged |
4547
| WIFI | Partial support | There are currently some problems, such as `rt_mq_recive` cannot be used in ISR, etc. |
4648
| BLE | Partially supported | There are currently some problems, such as `NimBLE` running errors after starting for a while |
@@ -91,6 +93,48 @@ Type "apropos word" to search for commands related to "word".
9193

9294
## Environment construction and compilation
9395

96+
### Docker deploy
97+
98+
If you want to lightly experiment with the ESP32-C3, it is recommended to quickly set up the environment using Docker. Otherwise, use a native environment setup.
99+
100+
1. Ensure Docker is installed and the inner network environment is properly configured. You can obtain the Docker image either via a pre-built docker image or by building it from a Dockerfile. Note that the docker image may not always be up-to-date, while the Dockerfile allows you to fetch the latest main branch. Below are the setup commands:
101+
* Setting up the development environment using a Dockerfile:
102+
103+
```sh
104+
cd docker
105+
sudo docker build --build-arg HTTP_PROXY=http://ip:port --build-arg HTTPS_PROXY=http://ip:port -t image_name .
106+
```
107+
Replace ip:port with your proxy server's IP and port. Otherwise, network issues may occur when pulling repositories.
108+
109+
* Setting up the development environment using a pre-built Docker image:
110+
111+
```sh
112+
sudo docker pull 1078249029/rtthread_esp32c3:latest
113+
```
114+
115+
2. Enter the Docker container:
116+
117+
```sh
118+
sudo docker run -it --device=/dev/ttyUSB* image_name
119+
```
120+
121+
The --device parameter is used for debugging and flashing code. You can obtain the corresponding port by running ls /dev/ttyUSB* on the host machine. If you used the pre-built Docker image, replace image_name with 1078249029/rtthread_esp32c3.
122+
123+
3. Using the Environment:
124+
125+
Flashing firmware:
126+
127+
```sh
128+
sudo esptool.py -b 115200 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x0 path/to/your/bootloader.bin 0x08000 path/to/your/partition-table.bin 0x010000 path/to/your/rtthread.bin
129+
```
130+
131+
Debugging:
132+
133+
```sh
134+
sudo minicom -c on -D /dev/ttyUSB*
135+
```
136+
### Native setup
137+
94138
1. Download the RISC-V toolchain:
95139
96140
```sh
@@ -180,7 +224,8 @@ or we can check ESPRESSIF's [Troubleshooting](https://docs.espressif.com/project
180224
Maintainer:
181225

182226
- [supperthomas](https://github.com/supperthomas) email address: [[email protected]](mailto:[email protected])
183-
- [tangzz98](https://github.com/tangzz98) email address: [[email protected]]([email protected])
227+
- [tangzz98](https://github.com/tangzz98) email address: [[email protected]]([email protected])
228+
- [wumingzi](https://github.com/1078249029) email address: [[email protected]]([email protected])
184229

185230
Special thanks to [chenyingchun0312](https://github.com/chenyingchun0312) for providing support on the RISC-V part working.
186231

bsp/ESP32_C3/README_ZH.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
| :----------------- | :----------: | :------------------------------------- |
4949
| GPIO | 支持 | |
5050
| UART | 支持 | 使用LUATOS_ESP32C3开发板需要在UART0_TX和UART0_RX连接串口转USB芯片(如CP2102)|
51+
| I2C | 支持 | 硬件I2C会产生传输错误,推荐使用软件I2C,但使用软件I2C会占用一个硬件通用定时器 |
52+
| SPI | 支持 | 支持自定义配置|
5153
| JTAG调试 | 支持 | ESP32C3采用USB方式和PC链接的开发板可以调试 |
5254
| WIFI | 部分支持 | 目前存在一些问题,例如不能在ISR中使用`rt_mq_recive`|
5355
| BLE | 部分支持 | 目前存在一些问题,例如`NimBLE`启动一段时间后运行错误 |
@@ -99,12 +101,55 @@ Type "apropos word" to search for commands related to "word".
99101

100102
## 环境搭建及编译
101103

104+
### Docker
105+
106+
如果想要通轻度尝鲜esp32c3,推荐使用docker快速搭建环境,否则请使用原生环境搭建
107+
108+
1. 在确保已经安装 docker 并配置docker内部网络环境的基础上可以通过 docker image 或 dockerfile 获取镜像,docker image 不保证时效性,而 dockerfile 可以获取最新的主线分支,下面是对应的搭建命令
109+
* 通过 dockerfile 搭建开发环境
110+
111+
```sh
112+
cd docker
113+
sudo docker build --build-arg HTTP_PROXY=http://ip:port --build-arg HTTPS_PROXY=http://ip:port -t image_name .
114+
```
115+
这里的 ip:port 需要修改为代理服务器 ip 和端口号,否则拉取仓库时可能会出现网络问题
116+
117+
* 通过docker image搭建开发环境
118+
119+
```sh
120+
sudo docker pull 1078249029/rtthread_esp32c3:latest
121+
```
122+
123+
2. 进入 docker
124+
125+
```sh
126+
sudo docker run -it --device=/dev/ttyUSB* image_name
127+
```
128+
129+
device 参数用于调试、烧录代码,通过在宿主机内执行`ls /dev/ttyUSB*`即可获得对应端口,如果是通过 docker image 搭建环境的需要将 image_name 替换为`1078249029/rtthread_esp32c3`
130+
131+
3. 环境使用
132+
133+
使用下列命令烧录
134+
135+
```sh
136+
sudo esptool.py -b 115200 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x0 path/to/your/bootloader.bin 0x08000 path/to/your/partition-table.bin 0x010000 path/to/your/rtthread.bin
137+
```
138+
139+
使用下列命令调试
140+
141+
```sh
142+
sudo minicom -c on -D /dev/ttyUSB*
143+
```
144+
145+
### 原生环境搭建
146+
102147
1. 下载 RISC-V 工具链:
103148

104-
```sh
105-
wget https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1-RC1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz
106-
tar xf riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz
107-
```
149+
```sh
150+
wget https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1-RC1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz
151+
tar xf riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz
152+
```
108153

109154
2. 配置工具链的路径:
110155

@@ -190,6 +235,7 @@ Linux 下可以使用先前下载的 esptool 进行烧录
190235

191236
- [supperthomas](https://github.com/supperthomas) 邮箱:<[email protected]>
192237
- [tangzz98](https://github.com/tangzz98) 邮箱:<[email protected]>
238+
- [wumingzi](https://github.com/1078249029) 邮箱:<[email protected]>
193239

194240
## 特别感谢
195241

bsp/ESP32_C3/docker/Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM ubuntu:22.04
2+
3+
ARG HTTP_PROXY
4+
ARG HTTPS_PROXY
5+
ENV http_proxy=${HTTP_PROXY}
6+
ENV https_proxy=${HTTPS_PROXY}
7+
8+
9+
# 1. Basic options(with root)
10+
RUN apt update && \
11+
apt install -y software-properties-common && \
12+
add-apt-repository universe && \
13+
apt update && \
14+
apt install -y --no-install-recommends \
15+
sudo git wget python3 python3-pip scons vim xz-utils minicom && \
16+
pip3 install esptool && \
17+
useradd -m dev && \
18+
echo "dev ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
19+
20+
# 2. Switch to dev user
21+
USER dev
22+
WORKDIR /home/dev
23+
24+
# 3. Install esp-idf toolchains
25+
RUN wget -q https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1-RC1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz && \
26+
sudo tar -xf riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz -C /opt
27+
28+
# 4. Clone RT-Thread and switch master
29+
RUN git clone https://github.com/RT-Thread/rt-thread.git && \
30+
cd rt-thread && \
31+
git switch master
32+
33+
# 5. Install env tools
34+
WORKDIR /home/dev/rt-thread
35+
RUN wget https://raw.githubusercontent.com/RT-Thread/env/master/install_ubuntu.sh && \
36+
chmod +x install_ubuntu.sh && \
37+
./install_ubuntu.sh
38+
39+
# 6. Modify toolchains path
40+
RUN sed -i "s|^.*EXEC_PATH.*| EXEC_PATH = r'/opt/riscv32-esp-elf/bin'|" bsp/ESP32_C3/rtconfig.py
41+
42+
# 7. Set enviroment variables
43+
ENV PATH="/opt/riscv32-esp-elf/bin:/home/dev/.env/tools/scripts:$PATH"
44+
45+
# 8. Update rtthread packages
46+
WORKDIR /home/dev/rt-thread/bsp/ESP32_C3
47+
RUN pkgs --update
48+

bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart_v2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ static void dma_recv_isr(struct rt_serial_device *serial, rt_uint8_t isr_flag)
411411
RT_ASSERT(serial != RT_NULL);
412412
uart = rt_container_of(serial, struct stm32_uart, serial);
413413

414-
recv_len = 0;
415414
counter = __HAL_DMA_GET_COUNTER(&(uart->dma_rx.handle));
416415

417416
if (counter <= uart->dma_rx.remaining_cnt)

components/drivers/include/drivers/pci.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ struct rt_pci_device
157157
rt_uint8_t pin;
158158
struct rt_pic *intx_pic;
159159

160+
rt_bool_t pm_enabled;
161+
160162
struct rt_pci_bus_resource resource[RT_PCI_BAR_NR_MAX];
163+
struct rt_pci_bus_resource rom;
161164

162165
rt_uint8_t pme_cap;
163166
rt_uint8_t msi_cap;

components/drivers/pci/SConscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ src = ['access.c', 'host-bridge.c', 'irq.c', 'pci.c', 'pme.c', 'probe.c']
1414
if GetDepend(['RT_USING_OFW']):
1515
src += ['ofw.c']
1616

17+
if GetDepend(['RT_USING_DFS_PROCFS']):
18+
src += ['procfs.c']
19+
1720
if GetDepend(['RT_PCI_ECAM']):
1821
src += ['ecam.c']
1922

components/drivers/pci/pci.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,10 @@ rt_err_t rt_pci_device_alloc_resource(struct rt_pci_host_bridge *host_bridge,
695695
rt_pci_write_config_u32(pdev, rom_addr, addr);
696696
}
697697
command |= PCIM_CMD_MEMEN;
698+
699+
pdev->rom.base = addr;
700+
pdev->rom.size = size;
701+
pdev->rom.flags = PCI_BUS_REGION_F_MEM;
698702
}
699703
}
700704

components/drivers/pci/pme.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ static void pci_pme_active(struct rt_pci_device *pdev, rt_bool_t enable)
107107
}
108108

109109
rt_pci_write_config_u16(pdev, pdev->pme_cap + PCIR_POWER_STATUS, pmcsr);
110+
pdev->pm_enabled = enable;
110111
}
111112

112113
void rt_pci_pme_active(struct rt_pci_device *pdev, rt_bool_t enable)

0 commit comments

Comments
 (0)