We tested 2 development boards, it all works, but due to the different LED pins of the two development boards, so we'll need to select the corresponding development board in the menuconfig.
| WIFI | Partial support | There are currently some problems, such as `rt_mq_recive` cannot be used in ISR, etc., and we are still trying to solve it |
| BLE | Partially supported | There are currently some problems, such as running errors caused by the same `PC` and `SP` pointers after `NimBLE` is started for a period of time |
| GDBStub | Support | You can use the GDB provided by ESP-IDF by turning on the `BSP_ENABLE_GDBSTUB` switch, which will enter GDB mode after a chip error |
Note:
1. WIFI and BLE cannot be enabled at the same time. When using the BLE driver, be sure to turn off the `RT_USING_WIFI` and `LWIP` switches in `menuconfig`. In addition, due to limited personal abilities and lack of debugging equipment, there are problems with the operation of WIFI and BLE drivers. If you can solve it, please contact me [timwcx@qq.com](mailto:timwcx@qq.com), I will be grateful.
2. The BLE driver only supports `NimBLE` and is provided by the `bluetooth` component in `esp-idf`. To use the BLE driver, please refer to `bsp/ESP32_C3/packages/ESP-IDF-latest/examples/bluetooth/nimble` Sample program, please note that the `esp_timer_init()` function must be called to initialize the clock driver before calling the `NimBLE` related interface.
One way to run the BLE sample is to add the sample program to `scons` compilation and call the clock initialization program and sample program entry in `bsp/ESP32_C3/main/main.c`.
```c
int main(void) {
...
#ifdef BSP_USING_BLE
esp_timer_init(); //Call clock initialization program
app_main(); //Call the BLE sample program entry
#endif
...
}
```
3、 Regarding the use of the GDBStub component, please see [ESP-IDF official documentation on GDBStub](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32c3/api-guides/tools/idf- monitor.html?#gdbstub-gdb), currently I have provided a debugging script `esp32c3.gdb`, the specific usage method is as follows.
tar xf riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz
```
2. Configure the path of the toolchain:
Add the local path of the `RISC-V` toolchain to the `EXEC_PATH` variable in the `rtconfig.py` file, or specify the path by setting the `RTT_EXEC_PATH` environment variable, for example:
```sh
export RTT_EXEC_PATH=/opt/riscv32-esp-elf/bin
```
3. Compile
Install esptool to convert ELF files to binary flash files:
```sh
pip install esptool
```
Execute the following command on the Linux platform to configure:
```
scons --menuconfig
```
It will automatically download env-related scripts to the `~/.env` directory, and then execute:
```sh
source ~/.env/env.sh
cd bsp/ESP32_C3/
pkgs --update
```
It will automatically download `RT-Thread-packages/esp-idf` and `RT-Thread-packages/FreeRTOS-Wrapper`, after updating the software packages, execute `scons` to compile the board support package.
If the compilation is successful, `rtthread.elf`, `rtthread.bin` files will be generated.
## Download and program
1. Programming tool download
The current bsp test uses the `flash_download_tool_3.9.4` tool to program without errors.
Configure the binary file and offset address as follows:
| binary file | offset address |
| ------------------- | -------- |
| bootloader.bin | 0x0 |
| partition-table.bin | 0x8000 |
| rtthread.bin | 0x10000 |
Among them, `bootloader.bin` and `partition-table.bin` can be found in the `bsp/ESP32_C3/builtin_imgs` folder. After the configuration is completed, the screenshot is as follows, and then click `START` to download.