1.实现了在Linux下的esp idf的一键编译,烧录,与监视的脚本,并且监视具有交互能力(依赖于ide的cmake应用调用,需要配合ide使用)
This commit is contained in:
+2
-1
@@ -1,2 +1,3 @@
|
||||
./cmake-build-debug
|
||||
cmake-build-debug
|
||||
build
|
||||
.idea
|
||||
|
||||
@@ -4,5 +4,17 @@
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# 注意!如果你使用了下面的编译烧录监视方式,那么Clion对于你来说就只是个代码编辑器,几乎不承担编译功能
|
||||
# 如果你把脚本放项目根,可直接用 ${CMAKE_SOURCE_DIR}/build_flash_monitor.sh
|
||||
add_custom_target(flash_monitor_gui
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"IDF_PATH=$ENV{IDF_PATH}" # 保证 idf.py 能找到
|
||||
${CMAKE_SOURCE_DIR}/build_flash_monitor.sh
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
USES_TERMINAL # 让 ninja 把 stdout 实时转发到 CLion Build 窗口
|
||||
COMMENT "Build + Flash in CLion, then launch Konsole with idf.py monitor"
|
||||
)
|
||||
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(Bionic_sphere)
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env zsh
|
||||
### 本脚本实现了Linux下的esp idf的一键编译,烧录,与监视,并且监视具有交互能力
|
||||
### Code by Misaki ---- 2025.8.22
|
||||
|
||||
# 如果 idf.py 不在 PATH,请 source export.sh 或手动 export IDF_PATH/PATH
|
||||
# source $HOME/Apps/esp/esp-idf/export.sh
|
||||
|
||||
set -e # 任何一步失败就退出
|
||||
PORT=${1:-/dev/ttyACM0} # 允许外部传参,默认 /dev/ttyACM0
|
||||
|
||||
# 1) 实时 build + flash
|
||||
export PYTHONUNBUFFERED=1
|
||||
idf.py -p "$PORT" build flash
|
||||
|
||||
# 2) 在外部 Konsole 打开 monitor (注意,这个地方要根据自己系统使用的终端来修改,我使用的是konsole + zsh
|
||||
# --new-tab 在当前窗口新建标签页
|
||||
# --hold monitor 退出后不自动关窗口
|
||||
konsole --new-tab --hold -e zsh -c "idf.py -p $PORT monitor"
|
||||
@@ -1,6 +1,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
|
||||
ESP_LOGI("main", "Now is Misaki");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user