Skip to content

Conversation

@Dharshinir004
Copy link

RT-Thread Board Support Package for ESP32-C3

📝 Introduction

This is the Board Support Package (BSP) for the Espressif ESP32-C3 series of microcontrollers, built to run the RT-Thread Real-Time Operating System.

This BSP is configured to use the [Specify the name of your specific evaluation/dev board, e.g., 'ESP32-C3-DevKitM-1'].

✨ Features

This BSP provides the standard RT-Thread kernel and system components, and includes the following application features by default:

  1. System Initialization: Initializes basic system clocks and required drivers.
  2. LED Blinking: A separate thread is started in main.c to blink the onboard LED, demonstrating basic thread management and GPIO control.
  3. FinSH Shell Access: Enables command-line access via the serial port for runtime management and debugging.
  4. Application Demo Command: Includes a custom FinSH command (app_data_cmd) for reading/writing a global application variable.

🛠️ Build and Configuration

1. Building the Project

  1. Navigate to the BSP directory:

    cd bsp/ESP32_C3
  2. Run the SCons build tool:

    scons

    This generates the firmware image (e.g., rtthread.elf).

  3. Flashing: Use the standard flash command for your environment (e.g., scons --target=download).

2. Configuration (menuconfig)

You can modify system settings and enable features using the menuconfig tool:

menuconfig

@CLAassistant
Copy link

CLAassistant commented Oct 10, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:esp32c3-app-update
  • 设置PR number为 \ Set the PR number to:10780
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 esp32c3-app-update 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the esp32c3-app-update branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions bot added the BSP label Oct 10, 2025
@supperthomas
Copy link
Member

image

Please deal with the error

* 2023-10-20 WCX1024979076 add wifi application
*/

#define RT_BSP_LED_PIN 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redefine

@supperthomas supperthomas requested a review from Copilot October 11, 2025 03:23
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"outDir": "./dist",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?? what's this file used for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete the useless file

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an application update to the ESP32-C3 BSP that introduces a FinSH command for managing application data and configures LED GPIO settings. The purpose is to demonstrate basic RT-Thread functionality including thread management, GPIO control, and shell command integration.

  • Added a custom FinSH command (app_data_cmd) for reading/writing a global application variable
  • Configured LED GPIO pin definitions in both header and source files
  • Extended Kconfig with board-level driver options and application command settings

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

File Description
bsp/ESP32_C3/rtconfig.h Added LED GPIO pin definition placeholder with comment instructions
bsp/ESP32_C3/main/main.c Implemented FinSH command functionality and LED pin definition
bsp/ESP32_C3/main/SConscript Added duplicate build configuration with source file specifications
bsp/ESP32_C3/Kconfig Extended configuration options for board drivers and application features
Comments suppressed due to low confidence (1)

bsp/ESP32_C3/main/SConscript:1

  • Maintainability/可维护性: The entire build configuration is duplicated after line 11, creating redundant and potentially conflicting build rules. This will likely cause build errors.
    中文:整个构建配置在第11行后重复,创建了冗余且可能冲突的构建规则。这可能会导致构建错误。
import os


// Define the GPIO pin number for the on-board LED
// *** You must replace 'X' with the correct physical GPIO number (e.g., 2, 8, 15, etc.) ***
#define RT_BSP_LED_PIN X
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug/错误: The LED pin is defined as 'X' which is not a valid GPIO number and will cause compilation errors.
中文:LED引脚定义为'X',这不是有效的GPIO编号,会导致编译错误。

Suggested change
#define RT_BSP_LED_PIN X
#define RT_BSP_LED_PIN 12

Copilot uses AI. Check for mistakes.
#ifndef RT_CONFIG_H__
#define RT_CONFIG_H__

// Inside bsp/ESP32_C3/board.h
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation/文档: Comment incorrectly references 'board.h' but this code is in 'rtconfig.h'.
中文:注释错误地引用了'board.h',但此代码在'rtconfig.h'中。

Suggested change
// Inside bsp/ESP32_C3/board.h
// Board-related configuration options

Copilot uses AI. Check for mistakes.
* 2023-10-20 WCX1024979076 add wifi application
*/

#define RT_BSP_LED_PIN 2
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainability/可维护性: LED pin definition is duplicated between rtconfig.h and main.c, creating inconsistency risk. The definition should come from a single source.
中文:LED引脚定义在rtconfig.h和main.c之间重复,存在不一致的风险。定义应该来自单一源。

Suggested change
#define RT_BSP_LED_PIN 2
#include <rtconfig.h>

Copilot uses AI. Check for mistakes.
config BSP_USING_BLE
bool "Enable Bluetooth Low Energy (BLE) Support"
default y
select ESP32C3_BLE_DRV # Link to the underlying chip driver config (name may vary)
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug/错误: The config option 'ESP32C3_BLE_DRV' may not exist in the RT-Thread configuration system, which could cause Kconfig errors.
中文:配置选项'ESP32C3_BLE_DRV'可能在RT-Thread配置系统中不存在,这可能导致Kconfig错误。

Suggested change
select ESP32C3_BLE_DRV # Link to the underlying chip driver config (name may vary)
# select ESP32C3_BLE_DRV # Link to the underlying chip driver config (name may vary)

Copilot uses AI. Check for mistakes.
config RT_USING_WIFI
bool "Enable Wi-Fi Support"
default y
select RT_USING_WIFI_DRIVER_ESP32C3 # Link to the underlying driver config (name may vary)
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug/错误: The config option 'RT_USING_WIFI_DRIVER_ESP32C3' may not exist in the RT-Thread configuration system, which could cause Kconfig errors.
中文:配置选项'RT_USING_WIFI_DRIVER_ESP32C3'可能在RT-Thread配置系统中不存在,这可能导致Kconfig错误。

Copilot uses AI. Check for mistakes.
Copy link
Member

@supperthomas supperthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix code by the comment

@Dharshinir004
Copy link
Author

@supperthomas sure sir I will work on it..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants