VSCode
以及对应PIO组件
以及开发框架所需的固件
请注意所安装的固件版本,如果没有什么特殊需求,请尽量安装最新的固件版本。
2. 找到PIO
固件安装目录:C:\Users\Administrator\.platformio\platforms\espressif32\boards
(根据个人电脑名字,有可能有差异)
找到
esp32-c3-devkitm-1.json复制粘贴一份,重命名:esp32-c3-luat.json
当然也可以不这么做,直接在现有的这个esp32-c3-devkitm-1.json
上面来修改也行,只需将文件中的信息原来; “flash_mode”: “qio”,改为 “flash_mode”: “dio”,然后保存即可。
SPI flash
,所以我修改了下面的: “flash_size”: “16MB"容量以及 “maximum_size”: 16777216,,如果你的没有换,那就默认的4MB
即"maximum_size”: 4194304,。.json
文件上修改的就保持文件这个名字,如果是复制粘贴出来的,或者新建的注意,新命名一个新名字,用于在创建项目时,选择对应开发板型号,注意不要和现有的重复了。{
"build": {
"arduino":{
"ldscript": "esp32c3_out.ld"
},
"core": "esp32",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "dio",
"extra_flags": "-DARDUINO_ESP32C3_DEV",
"mcu": "esp32c3",
"variant": "esp32c3"
},
"connectivity": [
"wifi"
],
"debug": {
"openocd_target": "esp32c3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "Espressif ESP32-C3-luat",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"require_upload_port": true,
"speed": 460800
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html",
"vendor": "Espressif"
}
#include
void setup() {
Serial.begin(115200);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
}
void loop() {
delay(1000);
Serial.println("hello esp32c3");
digitalWrite(13,!digitalRead(13));
digitalWrite(12,!digitalRead(12));
}
platformio.ini
文件中的配置信息[env:esp32-c3-devkitm-1]
platform = espressif32
board = esp32-c3-luat
framework = arduino
upload_speed = 921600
monitor_speed = 115200
board_build.partitions = partitions_16m.csv
; set frequency to 80MHz
board_build.f_flash = 80000000L
; set frequency to 160MHz
board_build.f_cpu = 160000000L
board_build.flash_mode =dio
;upload_port = /dev/cu.SLAB_USBtoUART
;monitor_port = /dev/cu.SLAB_USBtoUART
partitions_16m.csv
分区表配置信息# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x630000,
app1, app, ota_1, 0x640000,0x630000,
fdb, 0x5A, 0x5B, 0xC70000,0x20000,
script, 0x5A, 0x5A, 0xC90000,0x100000,
script_ota, 0x5A, 0x5A, 0xD90000,0x100000,
spiffs, data, spiffs, 0xE90000,0x170000,