ESP32-C3 迷你开发板上手

/ 0评 / 0

最近逛淘宝发现一个特别迷你的板子,ESP32-C3仅引出USB(Built-in JTAG)接口的板子,而且长得很精致,于是买入了一块,根据淘宝店里描述,这一块目前天线电路有问题,我到手后看了一下,是天线背面覆地了,应该只是信号很差,不至于完全没用.

大小大家对比下.

我直到合宇什么更便宜,不过我不太喜欢他们家东西,乱七八糟一塌糊涂的感觉.而且,我买他,还有他迷你的原因啊.

首先要用Zadig或者类似工具替换驱动.

刚买回来是空片,空片时候,按住BOOT然后复位,可以进入下载模式.这时候就可以直接下载了.

当你不再空片,并且也没程序里用USB,并且没修改idf中的配置,下次直接复位就是USB JTAG,这时候复位后可以准备调试,调试的launch.json也很简单.

{
  "version": "0.2.0",
  "configurations": [
    {
        "name": "ESP-IDF Debug: Launch",
        "type": "espidf",
        "request": "launch"
    },
  ]
}

也还行,好歹还能搜到路由器(就在10米以内).

SVD下载和配置:

https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/DEBUGGING.md

最后为了能"找到定义",还要设置Intelisense(c_cpp_properties.json).

{
  "configurations": [
    {
      "name": "ESP-IDF",
      "cStandard": "c11",
      "cppStandard": "c++17",
      "includePath": [
        "${config:idf.espIdfPath}/components/**",
        "${config:idf.espIdfPathWin}/components/**",
        "${workspaceFolder}/**"
      ],
      "browse": {
        "path": [
          "${config:idf.espIdfPath}/components",
          "${config:idf.espIdfPathWin}/components",
          "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": false
      },
      "compilerPath": "/path/to/toolchain-gcc"
    }
  ],
  "version": 4
}

特别提醒(如果出现RTOS检测问题,可以尝试做简单的launch.json,而不用esp-idf调试器的rtos探测器!实际上,gdb的rtos探测器也挺好用的.):

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "GDB",
      "type": "cppdbg",
      "request": "launch",
      "MIMode": "gdb",
      "miDebuggerPath": "${command:espIdf.getXtensaGdb}",
      "program": "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
      "cwd": "${workspaceFolder}",
      "environment": [{ "name": "PATH", "value": "${config:idf.customExtraPaths}" }],
      "setupCommands": [
        { "text": "target remote :3333" },
        { "text": "set remote hardware-watchpoint-limit 2"},
        { "text": "mon reset halt" },
        { "text": "thb app_main" },
        { "text": "flushregs" }
      ],
      "externalConsole": false,
      "logging": {
        "engineLogging": true
      }
    }
  ]
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注