ESP32_C3: Improve Readme, fix compile errors/warnings

This commit is contained in:
tangzz98 2022-12-12 17:12:20 -05:00 committed by guo
parent 9860b168b8
commit 89c3bf5f92
4 changed files with 38 additions and 20 deletions

View File

@ -50,17 +50,27 @@ ESP-IDF can be installed in two ways
``` ```
pkgs --update pkgs --update
``` ```
- Go to ESP-IDF package directory and install IDF tools. This command only needs to be run once after the package is downloaded for the first time. - Install IDF tools. If you are using Linux or MacOS, go to ESP-IDF package directory and install IDF tools by running
``` ```
cd packages/ESP-IDF-latest cd packages/ESP-IDF-latest
./install.sh ./install.sh
# Use install.bat in Windows environment
``` ```
If you are using Windows, open Command Prompt. Note that you cannot use any other terminals, such as the Env command line or PowerShell. Enter the BSP directory and run
```
install.bat
```
No matter what operating system you are using, this step only needs to be done once after the package is downloaded for the first time.
- Under the ESP-IDF package directory, export IDF environment variables. This commands need to be run every time when the BSP is built in a new terminal. - Under the ESP-IDF package directory, export IDF environment variables. This commands need to be run every time when the BSP is built in a new terminal.
If you are using Linux or MacOS, run
``` ```
. export.sh . export.sh
# Use export.bat in Windows environment
``` ```
If you are using Windows, run
```
export.bat
```
Same as the previous step, you can only use Command Prompt.
2. Apply patch to a local installation of ESP-IDF 2. Apply patch to a local installation of ESP-IDF
- Select the below option with `SCons --menuconfig` - Select the below option with `SCons --menuconfig`
``` ```
@ -73,6 +83,10 @@ RT-Thread online packages
peripheral libraries and drivers peripheral libraries and drivers
[ ] ESP-IDF: Espressif IoT Development Framework [ ] ESP-IDF: Espressif IoT Development Framework
``` ```
- Install FreeRTOS wrapper
```
pkgs --update
```
- Any convenient method to install ESP-IDF can be used, such as [VSCode plugin](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md). Make sure to install the master version of ESP-IDF. - Any convenient method to install ESP-IDF can be used, such as [VSCode plugin](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md). Make sure to install the master version of ESP-IDF.
- Enter the local ESP-IDF directory and run the following commands - Enter the local ESP-IDF directory and run the following commands
``` ```
@ -90,7 +104,7 @@ scons --menuconfig
``` ```
scons --target=esp-idf scons --target=esp-idf
``` ```
- If ESP-IDf is installed using Env, use `idf.py` to compile and upload the program. Refer to [Espressif official documents](https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/get-started/index.html#build-your-first-project) for reference. Otherwise follow the appropriate steps depending on how ESP-IDF was installed, such as using [VSCode plugin](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md). - If ESP-IDf is installed using Env, use `idf.py` to compile and upload the program. Refer to [Espressif official documents](https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/get-started/index.html#build-your-first-project) for reference. Note if you are using Windows, you can only use `idf.py` commands in Windows Command Prompt. Otherwise follow the appropriate steps depending on how ESP-IDF was installed, such as using [VSCode plugin](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md).
- Once the project is successfully downloaded, the system runs automatically, the red LED will blink in 1s on cycles. - Once the project is successfully downloaded, the system runs automatically, the red LED will blink in 1s on cycles.
## Notes ## Notes

View File

@ -57,17 +57,27 @@
``` ```
pkgs --update pkgs --update
``` ```
- 进入到ESP-IDF软件包路径安装IDf工具链。此命令只需要在下载完软件包后执行一次。 - 安装IDF工具链。如果使用Linux或MacOS系统在命令行内进入到ESP-IDF软件包路径安装IDf工具链。
``` ```
cd packages/ESP-IDF-latest cd packages/ESP-IDF-latest
./install.sh ./install.sh
# Windows环境下使用install.bat
``` ```
如果使用Windows系统打开Command Prompt注意不能使用其他任何命令行如Env命令行和PowerShell。进入BSP目录并执行
```
install.bat
```
无论使用任何系统,这一步只需要在下载完软件包后执行一次。
- 在软件包路径下设置IDF路径。每当在新的命令行编译BSP时需要执行此命令。 - 在软件包路径下设置IDF路径。每当在新的命令行编译BSP时需要执行此命令。
如果使用Linux或MacOS系统执行
``` ```
. export.sh . export.sh
# Windows环境下使用export.bat
``` ```
如果使用Windows系统执行
```
export.bat
```
这一步仍然只能使用Command Prompt。
2. 在本地ESP-IDF加载patch 2. 在本地ESP-IDF加载patch
- 通过`SCons --menuconfig`选择 - 通过`SCons --menuconfig`选择
``` ```
@ -80,6 +90,10 @@ RT-Thread online packages
peripheral libraries and drivers peripheral libraries and drivers
[ ] ESP-IDF: Espressif IoT Development Framework [ ] ESP-IDF: Espressif IoT Development Framework
``` ```
- 使用Env工具下载FreeRTOS兼容层
```
pkgs --update
```
- 可以选择其他方式在本地安装ESP-IDF如[VSCode插件](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md)。确保安装的ESP-IDF是master版本。 - 可以选择其他方式在本地安装ESP-IDF如[VSCode插件](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md)。确保安装的ESP-IDF是master版本。
- 进入本地ESP-IDF目录执行以下命令 - 进入本地ESP-IDF目录执行以下命令
``` ```
@ -98,7 +112,7 @@ scons --menuconfig
``` ```
scons --target=esp-idf scons --target=esp-idf
``` ```
3. 如果使用Env安装了ESP-IDF使用`idf.py`命令编译,烧录。具体参考[乐鑫官网](https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/get-started/index.html#build-your-first-project)。如果使用了在本地ESP-IDF加载patch的方式可使用其他相应的编译和烧录方法如[VSCode插件](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md)。 3. 如果使用Env安装了ESP-IDF使用`idf.py`命令编译,烧录。具体参考[乐鑫官网](https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/get-started/index.html#build-your-first-project)。注意如果使用Windows系统`idf.py`只能在Command Prompt里执行。如果使用了在本地ESP-IDF加载patch的方式可使用其他相应的编译和烧录方法如[VSCode插件](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md)。
4. 下载程序成功之后,系统会运行,红色的 LED灯以 1S 周期闪烁。 4. 下载程序成功之后,系统会运行,红色的 LED灯以 1S 周期闪烁。
## 注意事项 ## 注意事项

View File

@ -27,16 +27,6 @@ static int mcu_pin_read(rt_device_t dev, rt_base_t pin)
value = gpio_get_level(pin); value = gpio_get_level(pin);
return value; return value;
} }
static gpio_config_t init_io(gpio_num_t num)
{
gpio_config_t io_conf;
io_conf.intr_type = GPIO_INTR_DISABLE;
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = (1ULL << num);
io_conf.pull_down_en = 0;
io_conf.pull_up_en = 0;
return io_conf;
}
static void mcu_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) static void mcu_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
{ {
@ -84,7 +74,7 @@ const static struct rt_pin_ops _mcu_pin_ops =
mcu_pin_attach_irq, mcu_pin_attach_irq,
mcu_pin_dettach_irq, mcu_pin_dettach_irq,
mcu_pin_irq_enable, mcu_pin_irq_enable,
///NULL, RT_NULL,
}; };
int rt_hw_pin_init(void) int rt_hw_pin_init(void)

View File

@ -294,9 +294,9 @@ static int _msh_exec_cmd(char *cmd, rt_size_t length, int *retp)
return 0; return 0;
} }
#if defined(RT_USING_LWP) && defined(DFS_USING_POSIX)
pid_t exec(char*, int, int, char**); pid_t exec(char*, int, int, char**);
#if defined(RT_USING_LWP) && defined(DFS_USING_POSIX)
/* check whether a file of the given path exits */ /* check whether a file of the given path exits */
static rt_bool_t _msh_lwp_cmd_exists(const char *path) static rt_bool_t _msh_lwp_cmd_exists(const char *path)
{ {