chore(build): reduce root firmware to no-op stub and freeze layout

Retire the product-firmware skeleton until the v4.2 architecture is
signed off (README marks the repo draft/PoC):

- main/ reduced to a no-op stub (main.cc + CMakeLists registering only
  main.cc; idf_component.yml with the cjson managed dependency), root
  app builds clean under both dev and prod presets (IDF v6.0.2)
- delete the 13 product components/ files (app_framework, and the
  display/network/ota/startup_ui/storage service stubs)
- freeze root build/layout: CMakeLists.txt, CMakePresets.json,
  partitions.csv (16 MiB custom layout), sdkconfig.defaults,
  dependencies.lock, cmake/ helpers
- add tooling config: .clang-format, .clang-tidy, .clangd,
  .devcontainer/, .vscode/

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
This commit is contained in:
2026-08-31 08:01:06 +08:00
co-authored by Sisyphus
parent a6d6168fd5
commit e71bcce56e
29 changed files with 167 additions and 166 deletions
+5
View File
@@ -0,0 +1,5 @@
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 100
PointerAlignment: Left
SortIncludes: CaseSensitive
+11
View File
@@ -0,0 +1,11 @@
Checks: >
-*,
bugprone-*,
performance-*,
portability-*,
modernize-use-nullptr,
-bugprone-reserved-identifier,
-modernize-use-nullptr,
-performance-enum-size
WarningsAsErrors: '*'
HeaderFilterRegex: '(^|/)(poc/common|poc/host)/'
+1
View File
@@ -1,2 +1,3 @@
CompileFlags:
Add: [-Ipoc/common/components/frame_poc_runtime/include]
Remove: [-f*, -m*]
+1 -1
View File
@@ -1,4 +1,4 @@
ARG DOCKER_TAG=latest
ARG DOCKER_TAG=v6.0.2
FROM espressif/idf:${DOCKER_TAG}
ENV LC_ALL=C.UTF-8
+4 -1
View File
@@ -1,7 +1,10 @@
{
"name": "ESP-IDF QEMU",
"build": {
"dockerfile": "Dockerfile"
"dockerfile": "Dockerfile",
"args": {
"DOCKER_TAG": "v6.0.2"
}
},
"customizations": {
"vscode": {
+1 -1
View File
@@ -2,7 +2,7 @@
"configurations": [
{
"name": "ESP-IDF",
"compilerPath": "/home/lain/.espressif/tools/xtensa-esp-elf/esp-15.2.0_20251204/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc",
"compilerPath": "/home/lain/.espressif/tools/xtensa-esp-elf/esp-15.2.0_20251204/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc",
"compileCommands": "/home/lain/Projects/esp_study/esp_study/.build/dev/compile_commands.json",
"intelliSenseMode": "gcc-x86",
"includePath": [
+14 -1
View File
@@ -29,5 +29,18 @@
"--background-index",
"--query-driver=**",
"--compile-commands-dir=/home/lain/Projects/esp_study/esp_study/.build/dev"
]
],
"chat.tools.terminal.autoApprove": {
"/^awk '/\\^FRAME_ERR_\\[A-Z_\\]\\+ -\\[0-9\\]\\+ / \\{ defs\\[\\$1\\]\\+\\+; values\\[\\$2\\]\\+\\+ \\} \\{ rest=\\$0; while \\(match\\(rest, /FRAME_ERR_\\[A-Z_\\]\\+/\\)\\) \\{ refs\\[substr\\(rest, RSTART, RLENGTH\\)\\]=1; rest=substr\\(rest, RSTART\\+RLENGTH\\) \\} \\} END \\{ for \\(code in refs\\) if \\(!\\(code in defs\\)\\) \\{ print \"missing: \" code; bad=1 \\} for \\(code in defs\\) if \\(defs\\[code\\] != 1\\) \\{ print \"duplicate definition: \" code; bad=1 \\} for \\(value in values\\) if \\(values\\[value\\] != 1\\) \\{ print \"duplicate value: \" value; bad=1 \\} exit bad \\}' _doc/project\\.md; and set fences \\(rg -c '\\^```' _doc/project\\.md\\); printf 'fences=%s\\\\n' \"\\$fences\"; and test \\(math \"\\$fences % 2\"\\) -eq 0; and git diff --no-index --check /dev/null _doc/project\\.md; set diff_code \\$status; test \\$diff_code -eq 1$/": {
"approve": true,
"matchCommandLine": true
},
"/^git --no-pager status --short && printf 'document-lines=' && wc -l < _doc/project\\.md && printf 'document-bytes=' && wc -c < _doc/project\\.md$/": {
"approve": true,
"matchCommandLine": true
}
},
"idf.customExtraVars": {
"IDF_TARGET": "esp32s3"
}
}
+20 -7
View File
@@ -1,8 +1,14 @@
cmake_minimum_required(VERSION 3.25)
if(NOT DEFINED IDF_TARGET)
set(IDF_TARGET "esp32s3" CACHE STRING "ESP-IDF target")
endif()
set(FRAME_REQUIRED_IDF_TAG "v6.0.2" CACHE STRING
"Exact ESP-IDF release tag required by the architecture")
set(FRAME_REQUIRED_IDF_COMMIT "7101770dc6db2667b3c477cc31365dd1acd6db4e" CACHE STRING
"Exact ESP-IDF commit required by the architecture")
set(FRAME_REQUIRED_COMPILER_VERSION "15.2.0" CACHE STRING
"Exact Xtensa GCC version required by the architecture")
include("${CMAKE_CURRENT_LIST_DIR}/cmake/FramePlatform.cmake")
frame_require_esp_idf("${FRAME_REQUIRED_IDF_TAG}")
if(NOT DEFINED SDKCONFIG)
set(SDKCONFIG "${CMAKE_BINARY_DIR}/sdkconfig")
@@ -13,8 +19,15 @@ if(NOT DEFINED SDKCONFIG_DEFAULTS)
"${CMAKE_SOURCE_DIR}/sdkconfig.defaults;${CMAKE_SOURCE_DIR}/sdkconfig.defaults.dev")
endif()
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esp_study)
project(esp_study)
frame_verify_platform("${FRAME_REQUIRED_IDF_COMMIT}" "${FRAME_REQUIRED_COMPILER_VERSION}")
# ESP-IDF v6.0.2 deliberately defaults components to GNU C++26. Frame code is
# compiled as strict C++26 by appending the stricter dialect after IDF options.
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++26" APPEND)
if(CMAKE_CXX_STANDARD LESS 26)
message(FATAL_ERROR "The selected toolchain does not provide C++26 mode.")
endif()
+8 -12
View File
@@ -6,31 +6,27 @@
"patch": 0
},
"configurePresets": [
{
"name": "idf-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/.build/${presetName}",
"cacheVariables": {
"IDF_TARGET": "esp32s3",
"SDKCONFIG": "${sourceDir}/.build/${presetName}/sdkconfig"
}
},
{
"name": "dev",
"inherits": "idf-base",
"displayName": "Default (development)",
"description": "Development configuration",
"generator": "Ninja",
"binaryDir": "${sourceDir}/.build/dev",
"cacheVariables": {
"IDF_TARGET": "esp32s3",
"SDKCONFIG": "${sourceDir}/.build/dev/sdkconfig",
"SDKCONFIG_DEFAULTS": "${sourceDir}/sdkconfig.defaults;${sourceDir}/sdkconfig.defaults.dev"
}
},
{
"name": "prod",
"inherits": "idf-base",
"displayName": "Production",
"description": "Production configuration",
"generator": "Ninja",
"binaryDir": "${sourceDir}/.build/prod",
"cacheVariables": {
"IDF_TARGET": "esp32s3",
"SDKCONFIG": "${sourceDir}/.build/prod/sdkconfig",
"SDKCONFIG_DEFAULTS": "${sourceDir}/sdkconfig.defaults;${sourceDir}/sdkconfig.defaults.prod"
}
}
+85
View File
@@ -0,0 +1,85 @@
include_guard(GLOBAL)
macro(frame_require_esp_idf required_tag)
if(NOT DEFINED ENV{IDF_PATH} OR "$ENV{IDF_PATH}" STREQUAL "")
message(FATAL_ERROR
"IDF_PATH is not set. Export the ESP-IDF ${required_tag} environment first.")
endif()
if(NOT EXISTS "$ENV{IDF_PATH}/tools/cmake/project.cmake")
message(FATAL_ERROR
"IDF_PATH does not point to an ESP-IDF checkout: $ENV{IDF_PATH}")
endif()
execute_process(
COMMAND git -C "$ENV{IDF_PATH}" describe --tags --exact-match
RESULT_VARIABLE FRAME_IDF_TAG_RESULT
OUTPUT_VARIABLE FRAME_IDF_TAG
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT FRAME_IDF_TAG_RESULT EQUAL 0 OR
NOT "${FRAME_IDF_TAG}" STREQUAL "${required_tag}")
message(FATAL_ERROR
"ESP-IDF must be checked out at exact tag ${required_tag}; detected '${FRAME_IDF_TAG}'.")
endif()
if(NOT DEFINED IDF_TARGET)
set(IDF_TARGET "esp32s3" CACHE STRING "ESP-IDF target")
endif()
if(NOT IDF_TARGET STREQUAL "esp32s3")
message(FATAL_ERROR "This project only supports IDF_TARGET=esp32s3.")
endif()
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endmacro()
function(frame_verify_platform required_commit required_compiler_version)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(FATAL_ERROR
"Frame requires the ESP-IDF GNU Xtensa compiler; detected ${CMAKE_CXX_COMPILER_ID}.")
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL required_compiler_version)
message(FATAL_ERROR
"Frame requires Xtensa GCC ${required_compiler_version}; detected ${CMAKE_CXX_COMPILER_VERSION}.")
endif()
execute_process(
COMMAND git -C "$ENV{IDF_PATH}" rev-parse HEAD
RESULT_VARIABLE commit_result
OUTPUT_VARIABLE detected_commit
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT commit_result EQUAL 0 OR NOT detected_commit STREQUAL required_commit)
message(FATAL_ERROR
"ESP-IDF commit must be ${required_commit}; detected '${detected_commit}'.")
endif()
execute_process(
COMMAND git -C "$ENV{IDF_PATH}" status --short
RESULT_VARIABLE status_result
OUTPUT_VARIABLE idf_changes
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT status_result EQUAL 0 OR NOT idf_changes STREQUAL "")
message(FATAL_ERROR "The ESP-IDF checkout must be clean for a reproducible Frame build.")
endif()
execute_process(
COMMAND "${CMAKE_CXX_COMPILER}" -dumpmachine
RESULT_VARIABLE machine_result
OUTPUT_VARIABLE compiler_machine
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT machine_result EQUAL 0 OR NOT compiler_machine STREQUAL "xtensa-esp-elf")
message(FATAL_ERROR
"Frame requires compiler target xtensa-esp-elf; detected '${compiler_machine}'.")
endif()
message(STATUS
"Frame platform: IDF ${required_commit}, ${compiler_machine} GCC ${CMAKE_CXX_COMPILER_VERSION}, ${IDF_TARGET}")
endfunction()
-5
View File
@@ -1,5 +0,0 @@
idf_component_register(SRCS
"application.cc"
"context.cc"
"loader.cc"
INCLUDE_DIRS ".")
-45
View File
@@ -1,45 +0,0 @@
#include "application.hh"
#include <new> // For std::nothrow
#include <stop_token> // For std::stop_source, std::stop_token, std::nostopstate
#include <thread> // For std::jthread
#include "context.hh" // For context
#include "loader.hh" // For loader::ui, loader::service
class impl {
public:
impl()
: ui_thread_(&impl::ui_thread_function, this),
service_thread_(&impl::service_thread_function, this),
context_() {};
~impl() noexcept = default;
void run() {
context_.run();
}
private:
void ui_thread_function(std::stop_token token) {
// Implementation of the UI thread function
loader::ui ui_instance;
ui_instance.set_context(&context_);
}
void service_thread_function(std::stop_token token) {
// Implementation of the service thread function
loader::service service_instance;
service_instance.set_context(&context_);
}
private:
std::jthread ui_thread_;
std::jthread service_thread_;
context context_;
};
application::application() : pimpl_(new(std::nothrow) impl()) {}
application::~application() noexcept { delete pimpl_; }
void application::run() { pimpl_->run(); }
-18
View File
@@ -1,18 +0,0 @@
#ifndef APPLICATION_HH
#define APPLICATION_HH
#pragma once
class impl;
class application {
public:
application();
~application() noexcept;
void run();
private:
impl *pimpl_;
};
#endif // APPLICATION_HH
View File
-12
View File
@@ -1,12 +0,0 @@
#ifndef CONTEXT_HH
#define CONTEXT_HH
#pragma once
// 事件循环上下文
class context {
public:
context() = default;
~context() noexcept = default;
void run() noexcept;
};
#endif // CONTEXT_HH
View File
-25
View File
@@ -1,25 +0,0 @@
#ifndef LOADER_HH
#define LOADER_HH
#pragma once
class context;
namespace loader {
class ui {
public:
ui() = default;
~ui() noexcept = default;
void set_context(context *ctx);
};
class service {
public:
service() = default;
~service() noexcept = default;
void set_context(context *ctx);
};
} // namespace loader
#endif // LOADER_HH
@@ -1 +0,0 @@
idf_component_register()
@@ -1 +0,0 @@
idf_component_register()
-1
View File
@@ -1 +0,0 @@
idf_component_register()
-1
View File
@@ -1 +0,0 @@
idf_component_register()
@@ -1,3 +0,0 @@
idf_component_register(REQUIRES littlefs)
littlefs_create_partition_image(assets_fs "../../assets" FLASH_IN_PROJECT)
@@ -1,3 +0,0 @@
dependencies:
idf: ">=6.0.0,<6.1.0"
joltwallet/littlefs: "~=1.22.3"
+1 -14
View File
@@ -3,19 +3,6 @@ dependencies:
source:
type: idf
version: 6.0.2
joltwallet/littlefs:
component_hash: 3af20a3d75c49db9dc2286fd50862c34055c9f578419ad1f2bf7ed3ed01391fe
dependencies:
- name: idf
require: private
version: '>=5.0'
source:
registry_url: https://components.espressif.com/
type: service
version: 1.22.3
direct_dependencies:
- idf
- joltwallet/littlefs
manifest_hash: 25f711fa39d438b5d864dd7aeb4896a3f989485a893f69e56fc846156a31272a
manifest_hash: d52a0103e27a79c6636ba44efeb692dc7d97512e8deb6cddb52bf3f7f29847f2
target: esp32s3
version: 3.0.0
+3 -8
View File
@@ -1,9 +1,4 @@
idf_component_register(SRCS "main.cc"
INCLUDE_DIRS "."
PRIV_REQUIRES
app_framework
startup_ui
display_service
network_service
storage_service
ota_service)
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE -std=c++26)
+1
View File
@@ -0,0 +1 @@
version: "0.0.0"
+3 -3
View File
@@ -1,7 +1,7 @@
// #include "application.hh"
// Product firmware is intentionally a no-op until the v4.2 architecture
// sign-off passes (_doc/requirements-v4.2.md GOV-004; _doc/development-plan.md D0:
// do not build product service skeletons to bypass the coding gate).
extern "C" void app_main(void)
{
// application app;
// app.run();
}
+4 -3
View File
@@ -1,8 +1,9 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x15000,
nvs, data, nvs, 0x9000, 0x14000,
nvs_keys, data, nvs_keys,0x1D000, 0x1000, encrypted
otadata, data, ota, 0x1E000, 0x2000,
coredump, data, coredump,0x20000, 0x20000,
ota_0, app, ota_0, 0x40000, 0x500000,
ota_1, app, ota_1, 0x540000, 0x500000,
plugin_fs, data, littlefs,0xA40000, 0x200000,
assets_fs, data, littlefs,0xC40000, 0x3C0000,
plugin_fs, data, littlefs,0xA40000, 0x4C0000,
system_fs, data, littlefs,0xF00000, 0x100000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x15000 0x14000
3 nvs_keys data nvs_keys 0x1D000 0x1000 encrypted
4 otadata data ota 0x1E000 0x2000
5 coredump data coredump 0x20000 0x20000
6 ota_0 app ota_0 0x40000 0x500000
7 ota_1 app ota_1 0x540000 0x500000
8 plugin_fs data littlefs 0xA40000 0x200000 0x4C0000
9 assets_fs system_fs data littlefs 0xC40000 0xF00000 0x3C0000 0x100000
+5
View File
@@ -1,5 +1,7 @@
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_FREERTOS_HZ=1000
CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_OCT=y
@@ -8,6 +10,9 @@ CONFIG_SPIRAM_SPEED_80M=y
CONFIG_SPIRAM_USE_MALLOC=y
# CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM is not set
# pthread uses TLS index 0 in ESP-IDF v6.0.2; index 1 is reserved for Frame.
CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=2
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y