Skip to content

Commit 2a395ff

Browse files
committed
Merge branch 'develop' into CMSIS-Pack
2 parents 252e14c + 00c5e22 commit 2a395ff

43 files changed

Lines changed: 8908 additions & 434 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
name: cmsis-pack-guard
3+
description: Use when generating or repairing the CMSIS-Pack for this repository, or before editing `fool_cat.fc_embed.pdsc`, `gen_pack.sh`, `cmsis-pack/*`, or pack-related GitHub Actions. Apply this skill when changing pack component layers, file inclusion scope, workflow triggers, or the release pipeline, and enforce the rule that the pack only describes tracked `HEAD` files unless the user explicitly asks for working-tree content.
4+
---
5+
6+
# CMSIS Pack Guard
7+
8+
Apply this skill before changing the CMSIS-Pack definition or generation flow in this repository.
9+
10+
## Scope
11+
12+
Treat these as the canonical pack files:
13+
14+
- `fool_cat.fc_embed.pdsc`
15+
- `gen_pack.sh`
16+
- `cmsis-pack/README.md`
17+
- `cmsis-pack/*.pack`
18+
- `.github/workflows/cmake-single-platform.yml`
19+
- `.github/workflows/publish-pack.yml`
20+
21+
Also inspect the tracked module tree under:
22+
23+
- `core/`
24+
- `device/`
25+
26+
## Required Start Checks
27+
28+
Run these before editing pack files:
29+
30+
```powershell
31+
git status --short
32+
git ls-tree -r --name-only HEAD
33+
Get-Content fool_cat.fc_embed.pdsc
34+
Get-Content gen_pack.sh
35+
Get-Content .github/workflows/cmake-single-platform.yml
36+
Get-Content .github/workflows/publish-pack.yml
37+
```
38+
39+
Use `rg` to confirm component names and dependencies from real code, not from memory:
40+
41+
```powershell
42+
rg -n '#include "fc_[^"]+"' core device
43+
```
44+
45+
## Core Rules
46+
47+
1. Treat the PDSC component list as a released pack contract, not a scratch view of the current worktree.
48+
2. Only add modules to the pack when their files are tracked in `HEAD`.
49+
3. Do not add ignored or untracked `device/` or `core/` files to `fool_cat.fc_embed.pdsc`.
50+
4. When the repo contains uncommitted module work, keep the official pack scoped to tracked files unless the user explicitly asks for working-tree packaging.
51+
5. Keep `fool_cat.fc_embed.pdsc`, `gen_pack.sh`, and pack-related workflows aligned in the same change.
52+
6. If a new top-level directory is added to the pack, restrict the generated pack to tracked files. Do not rely on whole-directory copy alone.
53+
7. Use CMSIS component layering with:
54+
- `Cgroup` for the major repository layer such as `core` or `device`
55+
- `Csub` for the concrete module such as `log`, `fifo`, or `sig`
56+
8. Derive `<require ...>` relations from actual header or source dependencies before editing conditions.
57+
9. Keep generated `.pack` artifacts under `cmsis-pack/`.
58+
10. If a workflow commits generated pack files, make sure at least one trigger path can actually reach that commit step.
59+
60+
## Repository-Specific Baseline
61+
62+
As of the current tracked tree, the official pack baseline is:
63+
64+
- `core`: `fc_auto_init`, `fc_fifo`, `fc_pool`, `fc_port`, `fc_trans`, `fc_stdio`, `fc_log`
65+
- `device`: `fc_type`, `fc_sig`, `fc_sig_filter`, `fc_stp_base`, `fc_stp_curve`
66+
67+
Files that exist only in the working tree must stay out of the official pack until they are committed.
68+
69+
## Standard Workflow
70+
71+
1. Inspect `git status --short` and `git ls-tree -r --name-only HEAD`.
72+
2. Build the allowed pack component set from tracked `core/` and `device/` files only.
73+
3. Update `fool_cat.fc_embed.pdsc` so component layering and conditions match the tracked code.
74+
4. Update `gen_pack.sh` if pack directory scope or file pruning needs to change.
75+
5. Review pack workflows and fix any trigger or commit path that became inconsistent with the generation flow.
76+
6. Validate XML syntax and verify the pack scope when feasible.
77+
78+
## Recommended Verification Commands
79+
80+
PowerShell:
81+
82+
```powershell
83+
git status --short
84+
git ls-tree -r --name-only HEAD | rg "^(core|device|\\.github/workflows|cmsis-pack|gen_pack\\.sh|fool_cat\\.fc_embed\\.pdsc)"
85+
python -c "import xml.etree.ElementTree as ET; ET.parse('fool_cat.fc_embed.pdsc')"
86+
```
87+
88+
If a local Linux or WSL pack build is available:
89+
90+
```powershell
91+
wsl.exe bash -lc "cd /mnt/d/GitHub_Clone/fc_embed && ./gen_pack.sh"
92+
```
93+
94+
If a `.pack` file is regenerated, inspect its contents:
95+
96+
```powershell
97+
Expand-Archive -Path cmsis-pack/fool_cat.fc_embed.1.0.0.pack -DestinationPath $env:TEMP\\fc_embed_pack_check -Force
98+
Get-ChildItem -Recurse -File $env:TEMP\\fc_embed_pack_check
99+
```
100+
101+
## Final Report Checklist
102+
103+
State explicitly:
104+
105+
- whether the pack scope was limited to tracked `HEAD` files
106+
- whether untracked `core/` or `device/` files were excluded
107+
- whether `fool_cat.fc_embed.pdsc`, `gen_pack.sh`, and workflows were kept in sync
108+
- whether XML or pack generation was validated locally, and how
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
> 说明:
2+
> - 实际触发、标准引用和后续维护基线只看 [SKILL.md](./SKILL.md)
3+
> - 本文件只是给中文开发者提供母语理解,不作为正式 skill 入口。
4+
5+
# CMSIS Pack Guard 中文版
6+
7+
在修改本仓库 CMSIS-Pack 定义或生成链路前,应先参考这个 skill。
8+
9+
## 适用范围
10+
11+
下面这些文件属于 pack 正式入口:
12+
13+
- `fool_cat.fc_embed.pdsc`
14+
- `gen_pack.sh`
15+
- `cmsis-pack/README.md`
16+
- `cmsis-pack/*.pack`
17+
- `.github/workflows/cmake-single-platform.yml`
18+
- `.github/workflows/publish-pack.yml`
19+
20+
同时要核对真实模块树:
21+
22+
- `core/`
23+
- `device/`
24+
25+
## 开始前必须检查
26+
27+
先执行:
28+
29+
```powershell
30+
git status --short
31+
git ls-tree -r --name-only HEAD
32+
Get-Content fool_cat.fc_embed.pdsc
33+
Get-Content gen_pack.sh
34+
Get-Content .github/workflows/cmake-single-platform.yml
35+
Get-Content .github/workflows/publish-pack.yml
36+
```
37+
38+
并用真实代码确认依赖关系:
39+
40+
```powershell
41+
rg -n '#include "fc_[^"]+"' core device
42+
```
43+
44+
## 核心约束
45+
46+
1. `pdsc` 里的组件列表属于正式发布契约,不是工作区临时视图。
47+
2. 只有 `HEAD` 已跟踪的模块,才能加入正式 pack。
48+
3. 不要把未跟踪或被忽略的 `core/``device/` 文件加入 `fool_cat.fc_embed.pdsc`
49+
4. 如果仓库里有未提交模块,正式 pack 默认仍只描述已跟踪文件,除非用户明确要求基于 working tree 打包。
50+
5. `fool_cat.fc_embed.pdsc``gen_pack.sh` 和 pack 相关 workflow 要一起维护。
51+
6. 只要 pack 新增了顶层目录,就必须控制打包范围,只保留已跟踪文件,不能简单整目录照搬。
52+
7. 分层时使用:
53+
- `Cgroup` 表示大层级,如 `core``device`
54+
- `Csub` 表示具体模块,如 `log``fifo``sig`
55+
8. `<require ...>` 依赖关系要从真实头文件和源码推出来,不要凭印象写。
56+
9. 生成的 `.pack` 文件统一落在 `cmsis-pack/`
57+
10. 如果 workflow 负责提交 pack 文件,要保证至少存在一条真的能走到提交步骤的触发路径。
58+
59+
## 当前仓库基线
60+
61+
当前 `HEAD` 已跟踪、适合作为正式 pack 基线的模块是:
62+
63+
- `core`: `fc_auto_init``fc_fifo``fc_pool``fc_port``fc_trans``fc_stdio``fc_log`
64+
- `device`: `fc_type``fc_sig``fc_sig_filter``fc_stp_base``fc_stp_curve`
65+
66+
只存在于工作区、还没提交的模块,暂时不要写进正式 pack。
67+
68+
## 标准流程
69+
70+
1. 先看 `git status --short``git ls-tree -r --name-only HEAD`
71+
2. 只从已跟踪的 `core/``device/` 文件里建立 pack 允许集合。
72+
3. 修改 `fool_cat.fc_embed.pdsc`,让组件分层和条件依赖对齐真实代码。
73+
4. 如果 pack 顶层目录或打包范围变化,同步修改 `gen_pack.sh`
74+
5. 检查 pack workflow,修掉触发条件和提交路径不一致的问题。
75+
6. 在可行时做 XML 或本地 pack 校验。
76+
77+
## 建议校验
78+
79+
```powershell
80+
git status --short
81+
git ls-tree -r --name-only HEAD | rg "^(core|device|\\.github/workflows|cmsis-pack|gen_pack\\.sh|fool_cat\\.fc_embed\\.pdsc)"
82+
python -c "import xml.etree.ElementTree as ET; ET.parse('fool_cat.fc_embed.pdsc')"
83+
```
84+
85+
如果本机能跑 Linux/WSL 打包:
86+
87+
```powershell
88+
wsl.exe bash -lc "cd /mnt/d/GitHub_Clone/fc_embed && ./gen_pack.sh"
89+
```
90+
91+
如果重新生成了 `.pack`,再解包检查实际内容:
92+
93+
```powershell
94+
Expand-Archive -Path cmsis-pack/fool_cat.fc_embed.1.0.0.pack -DestinationPath $env:TEMP\\fc_embed_pack_check -Force
95+
Get-ChildItem -Recurse -File $env:TEMP\\fc_embed_pack_check
96+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "CMSIS Pack Guard"
3+
short_description: "Guard CMSIS-Pack pdsc and build flow"
4+
default_prompt: "Use $cmsis-pack-guard to update fool_cat.fc_embed.pdsc, gen_pack.sh, and pack workflows safely."
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
name: host-test-guard
3+
description: Use when working on host-side validation, PC-side verification, WSL/Linux test runs, or any task touching `test/host` in this repository. Apply this skill before editing `test/host/README.md`, `test/host/CMakeLists.txt`, `test/host/support/*`, `test/host/cases/*`, or host verification configuration. Keep `test/host` as the canonical entry, prefer Linux native or WSL only, and do not revive `test/core` as the primary path.
4+
---
5+
6+
# Host Test Guard
7+
8+
Apply this skill before editing or running host-side validation in this repository.
9+
10+
## Canonical Layout
11+
12+
- `test/host` is the only canonical host verification entry.
13+
- `test/core` is legacy or historical context. Do not extend it or point new docs, scripts, or builds back to it unless the user explicitly asks for legacy cleanup.
14+
- Keep only `build_linux` and `build_wsl` as supported host build directories.
15+
- Keep harness code under `test/host/support/`.
16+
- Keep host-side cases for `core/` modules under `test/host/cases/core/`.
17+
- Keep host-side config in `test/host/fc_config.h`.
18+
19+
## Required Start Checks
20+
21+
Run these before changing host verification files:
22+
23+
```powershell
24+
Get-ChildItem test\host
25+
Get-Content test\host\README.md
26+
Get-Content test\host\CMakeLists.txt
27+
```
28+
29+
If the task changes harness code or test cases, also inspect:
30+
31+
```powershell
32+
Get-ChildItem -Recurse -File test\host\support
33+
Get-ChildItem -Recurse -File test\host\cases
34+
```
35+
36+
If the task involves path migration or cleanup, inspect both old and new names:
37+
38+
```powershell
39+
rg -n "test/core|test/host" test .agent
40+
```
41+
42+
## Core Rules
43+
44+
1. Treat `test/host` as the source of truth for host-side validation.
45+
2. Do not reintroduce `test/core/build*`, `build_local`, `build_ninja`, or 32-bit host validation flows.
46+
3. Prefer Linux native or WSL verification only.
47+
4. If the public host workflow changes, update `README.md`, `CMakeLists.txt`, and related support files together.
48+
5. If a `core/` header depends on `device/` headers, keep host-side include paths aligned. Do not assume host validation is fully isolated from `device/`.
49+
6. Do not rely on `git status` to detect `test/` changes in this repo. Inspect files directly because `test/` is ignored.
50+
7. Preserve local `_deps/` when possible to avoid unnecessary online fetches during configure.
51+
8. Keep build outputs under `test/host/build_linux` or `test/host/build_wsl`.
52+
9. Keep generated runtime logs inside `test/host`. Do not allow host verification to create `test/log` or other log directories outside the canonical host path.
53+
10. Keep `test/host/support/test_clock.*` usable in two modes: real clock by default for host-like behavior, and manual clock when deterministic scheduler tests need precise control.
54+
55+
## Standard Workflow
56+
57+
1. Read `test/host/README.md` and `test/host/CMakeLists.txt` to confirm the current baseline.
58+
2. Edit only the canonical host path under `test/host`.
59+
3. If adding a new host test:
60+
- put test cases in `test/host/cases/core/`
61+
- put shared harness code in `test/host/support/`
62+
- keep config changes in `test/host/fc_config.h` or `test/host/CMakeLists.txt`
63+
4. If the task affects build behavior, keep the supported matrix to:
64+
- Linux native -> `build_linux`
65+
- WSL -> `build_wsl`
66+
5. Verify with a real configure, build, or test run when feasible.
67+
68+
## Recommended Verification Commands
69+
70+
Linux shell:
71+
72+
```bash
73+
cmake -S test/host -B test/host/build_linux
74+
cmake --build test/host/build_linux --target fc_embed_tests -j2
75+
ctest --test-dir test/host/build_linux --output-on-failure
76+
```
77+
78+
PowerShell with WSL:
79+
80+
```powershell
81+
wsl.exe -d Ubuntu-22.04 bash -lc "cd /mnt/<drive>/<repo-path> && cmake -S test/host -B test/host/build_wsl && cmake --build test/host/build_wsl --target fc_embed_tests -j2 && ctest --test-dir test/host/build_wsl --output-on-failure"
82+
```
83+
84+
Resolve the repository path to its corresponding `/mnt/...` form before using the WSL command.
85+
86+
If configure unexpectedly falls back to online fetches, inspect whether `test/host/_deps/*-src` still contains a complete local source tree before assuming network access is required.
87+
88+
## Final Report Checklist
89+
90+
State explicitly:
91+
92+
- whether `test/host` was treated as the canonical path
93+
- whether only `build_linux` and `build_wsl` were kept
94+
- whether host verification was configured, built, or tested, and in which environment
95+
- whether any legacy `test/core` references were intentionally left untouched

0 commit comments

Comments
 (0)