ソースを参照

ESP32_C3: Improve Readme, fix compile errors/warnings

tangzz98 2 年 前
コミット
89c3bf5f92
4 ファイル変更38 行追加20 行削除
  1. 18 4
      bsp/ESP32_C3/README.md
  2. 18 4
      bsp/ESP32_C3/README_ZH.md
  3. 1 11
      bsp/ESP32_C3/drivers/drv_gpio.c
  4. 1 1
      components/finsh/msh.c

+ 18 - 4
bsp/ESP32_C3/README.md

@@ -50,17 +50,27 @@ ESP-IDF can be installed in two ways
 ```
 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
 ./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.
+If you are using Linux or MacOS, run
 ```
 . 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
 - Select the below option with `SCons --menuconfig`
 ```
@@ -73,6 +83,10 @@ RT-Thread online packages
     peripheral libraries and drivers
         [ ] 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.
 - Enter the local ESP-IDF directory and run the following commands
 ```
@@ -90,7 +104,7 @@ scons --menuconfig
 ```
 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.
 
 ## Notes

+ 18 - 4
bsp/ESP32_C3/README_ZH.md

@@ -57,17 +57,27 @@
 ```
 pkgs --update
 ```
-- 进入到ESP-IDF软件包路径,安装IDf工具链。此命令只需要在下载完软件包后执行一次。
+- 安装IDF工具链。如果使用Linux或MacOS系统,在命令行内进入到ESP-IDF软件包路径,安装IDf工具链。
 ```
 cd packages/ESP-IDF-latest
 ./install.sh
-# Windows环境下使用install.bat
 ```
+如果使用Windows系统,打开Command Prompt,注意不能使用其他任何命令行,如Env命令行和PowerShell。进入BSP目录并执行
+```
+install.bat
+```
+无论使用任何系统,这一步只需要在下载完软件包后执行一次。
 - 在软件包路径下设置IDF路径。每当在新的命令行编译BSP时需要执行此命令。
+如果使用Linux或MacOS系统,执行
 ```
 . export.sh
-# Windows环境下使用export.bat
 ```
+如果使用Windows系统,执行
+```
+export.bat
+```
+这一步仍然只能使用Command Prompt。
+
 2. 在本地ESP-IDF加载patch
 - 通过`SCons --menuconfig`选择
 ```
@@ -80,6 +90,10 @@ RT-Thread online packages
     peripheral libraries and drivers
         [ ] 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目录执行以下命令
 ```
@@ -98,7 +112,7 @@ scons --menuconfig
 ```
 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 周期闪烁。
 
 ## 注意事项

+ 1 - 11
bsp/ESP32_C3/drivers/drv_gpio.c

@@ -27,16 +27,6 @@ static int mcu_pin_read(rt_device_t dev, rt_base_t pin)
     value = gpio_get_level(pin);
     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)
 {
@@ -84,7 +74,7 @@ const static struct rt_pin_ops _mcu_pin_ops =
     mcu_pin_attach_irq,
     mcu_pin_dettach_irq,
     mcu_pin_irq_enable,
-    ///NULL,
+    RT_NULL,
 };
 
 int rt_hw_pin_init(void)

+ 1 - 1
components/finsh/msh.c

@@ -294,9 +294,9 @@ static int _msh_exec_cmd(char *cmd, rt_size_t length, int *retp)
     return 0;
 }
 
+#if defined(RT_USING_LWP) && defined(DFS_USING_POSIX)
 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 */
 static rt_bool_t _msh_lwp_cmd_exists(const char *path)
 {