Skip to content

feat(spi): configure write-protection fallback and document contributions - #19

Merged
MarsDoge merged 3 commits into
masterfrom
fix/spi-write-protection-option
Oct 28, 2026
Merged

MarsDoge merged 3 commits into
masterfrom
fix/spi-write-protection-option

Conversation

@MarsDoge

@MarsDoge MarsDoge commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

问题与改动

SPI 的 WREN/WRSR 写保护兼容流程原先需要通过 ENABLE_WRITE_PROTECTION 宏重新编译才能启用。新增 --write-protection 命令行选项,默认关闭,运行时控制原有两处宏条件中的流程;每次 SPI 命令调用时重置配置。该选项控制额外的兼容流程,基础写保护操作仍执行。

OsTools spi -u -f bios.bin --write-protection

同时规范仓库后续提交:更新 commit-template.txt,新增 .github/pull_request_template.md 和 CONTRIBUTING.md,说明提交类型、模块范围、模板启用方式和验证记录要求。SPI 功能、文档规范与构建兼容性修复分为三个提交,均使用 <type>(<scope>): <简短说明> 格式。

验证结果

  • gcc -std=gnu11 -fsyntax-only spi.c argparse.c 通过。
  • 补丁反向应用检查通过。
  • 已审阅模板字段和启用说明。
  • 使用 <stdbool.h> 替代 util.c 的自定义 bool/true/false,消除 C23 关键字冲突。
  • 移除 Makefile 的语言标准限制,采用编译器默认模式。保留 build.sh 失败立即退出和 shebang 修正。
  • 整理前的相同源码树已通过 GCC 15 完整构建 CI,使用编译器默认语言模式;此次仅整理提交历史。

@MarsDoge
MarsDoge force-pushed the fix/spi-write-protection-option branch from c90cec3 to bd8faa1 Compare October 28, 2026 08:31
@MarsDoge MarsDoge changed the title LoongArch: 将 SPI 写保护兼容流程改为运行时参数 feat(spi): configure write-protection fallback and document contributions Oct 28, 2026
Replace ENABLE_WRITE_PROTECTION guards with the
--write-protection command-line option, disabled by default.
Reset the option for each SPI command invocation.

Validation:
- C syntax check passed.
- Patch reverse-application check passed.
Simplify the commit template and add a pull request template and
contribution guide. Document types, scopes, template setup and
accurate build and hardware validation reporting.

Validation:
- Reviewed template fields and setup instructions.
- Documentation-only change; no runtime tests performed.
Use stdbool.h instead of custom bool, true and false definitions
in util.c. The affected values are internal MAC parsing results;
public interfaces and structure layouts are unchanged.

Use the compiler default language standard and preserve supplied
CFLAGS. Put the build script shebang first and stop immediately
on command failure.

Validation:
- Reviewed boolean usage across LoongArch C sources and headers.
- The identical final source tree passed the complete GCC 15 CI build.
@MarsDoge
MarsDoge force-pushed the fix/spi-write-protection-option branch from 5869d8b to fca6221 Compare October 28, 2026 08:41
@MarsDoge
MarsDoge merged commit 6993de4 into master Oct 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant