steami: Add config zone commands (WRITE/READ/CLEAR_CONFIG).#3
steami: Add config zone commands (WRITE/READ/CLEAR_CONFIG).#3nedseb wants to merge 2 commits intorelease_letssteamfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa805b35a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds a dedicated 4 KB “config zone” at 0x7FE000 in the W25Q64JV flash and exposes it via new I2C commands so persistent board configuration (calibration, board info, etc.) can be stored independently of the main data/file region.
Changes:
- Introduces new I2C commands:
WRITE_CONFIG (0x30),READ_CONFIG (0x31),CLEAR_CONFIG (0x32). - Reserves flash address range
0x7FE000–0x7FEFFFfor config and reducesSTEAMI_FLASH_FILE_SIZEaccordingly. - Implements flash helpers to erase/write/read the config zone and wires them into the task/command processing loop.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
source/board/steami/steami_i2c.h |
Adds new command enum values for config operations. |
source/board/steami/steami_i2c.c |
Extends command validation and argument-length mapping for new commands. |
source/board/steami/steami_flash.h |
Defines config zone address/size and declares config read/write/erase APIs; adjusts file size. |
source/board/steami/steami_flash.c |
Implements config zone erase/write/read helpers on top of W25Q64 primitives. |
source/board/steami/steami32.c |
Adds new tasks and command handlers to execute config operations via I2C. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fa805b3 to
14ed7ca
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14ed7cabd0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
source/board/steami/steami_flash.h
Outdated
| #define STEAMI_FLASH_CONFIG_ADDR (uint32_t)0x007F0000 | ||
| #define STEAMI_FLASH_NAME_ADDR (uint32_t)0x007FF000 | ||
|
|
||
| #define STEAMI_FLASH_FILE_SIZE 8384512 | ||
| #define STEAMI_FLASH_FILE_SIZE 8323072 /* 0x7F0000 - 0x000000 */ |
There was a problem hiding this comment.
Move config region to end-of-flash 4KB window
STEAMI_FLASH_CONFIG_SIZE declares a 4KB config partition, but STEAMI_FLASH_CONFIG_ADDR is set to 0x007F0000 while the filename sector is at 0x007FF000, which leaves an unintended 0xF000 (60KB) gap that is no longer part of STEAMI_FLASH_FILE_SIZE. This silently reduces usable data capacity far beyond the intended 4KB reservation and makes addresses 0x7F1000..0x7FEFFF unreachable by file operations.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed: the config zone has been moved to 0x007FE000 (last 4K before the filename sector at 0x7FF000), eliminating the gap. File region now starts at 0x00000000 and extends to 0x7FE000, preserving full data capacity.
14ed7ca to
4d5773c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d5773c5eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4d5773c to
a954f62
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b93c219197
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for(uint16_t i = 0; i < STEAMI_FLASH_MAX_DATA_SIZE; ++i){ | ||
| if( data[i] == 0xFF ){ | ||
| return STEAMI_FLASH_FILE_ADDR + offset + i; | ||
| return offset + i; |
There was a problem hiding this comment.
Restore file-base offset before programming appended data
Changing steami_flash_get_size() to return offset + i makes the size relative to the file partition, but steami_flash_append_file() still uses that value as an absolute flash address in w25q64_page_program. With STEAMI_FLASH_FILE_ADDR now non-zero, WRITE_DATA writes into 0x000000 (config area) while reads/size scans start at 0x001000, so appended file data is not visible in the MSC file and config bytes can be corrupted.
Useful? React with 👍 / 👎.
source/board/steami/steami_flash.h
Outdated
| #define STEAMI_FLASH_NAME_ADDR (uint32_t)0x007FF000 | ||
| #define STEAMI_FLASH_CONFIG_ADDR (uint32_t)0x00000000 | ||
| #define STEAMI_FLASH_CONFIG_SIZE 4096 | ||
| #define STEAMI_FLASH_FILE_ADDR (uint32_t)0x00001000 /* after config zone */ |
There was a problem hiding this comment.
Align file partition start with block erase operations
Moving STEAMI_FLASH_FILE_ADDR to 0x00001000 makes the data region unaligned for the existing 32KB/64KB erase path in steami_flash_erase(). For files of at least 32KB, the first block erase is issued at 0x1000, which on W25Q64 erases the containing aligned block starting at 0x0000; that includes the config sector and breaks the new guarantee that CLEAR_FLASH does not erase config data.
Useful? React with 👍 / 👎.
- Add page-boundary and length validation in steami_flash_write_config - Fix steami_flash_get_size returning absolute address instead of relative size - Separate bad-parameters error from flash-write failure in TASK_WRITE_CONFIG - Update doc to reflect actual 28-byte max payload via I2C protocol - Document fixed 31-byte frame layout for WRITE_CONFIG command
b93c219 to
5770096
Compare
Summary
Reserve a 4 KB config zone in the W25Q64JV flash at
0x7FE000for persistent configuration storage (calibration, board info, etc.). Add 3 new I2C commands.Flash layout
STEAMI_FLASH_FILE_SIZEreduced from 8384512 to 8380416 to exclude config zone.New I2C commands
0x300x310x32Key behavior
CLEAR_FLASH(0x10) does NOT erase the config zone (data zone stops at0x7FDFFF)CLEAR_CONFIG(0x32) only erases the 4 KB config sectorFiles modified
steami_i2c.h-- 3 new enum valuessteami_i2c.c-- command validation + argument byte countssteami_flash.h--STEAMI_FLASH_CONFIG_ADDR, 3 function prototypes, adjusted FILE_SIZEsteami_flash.c--erase_config(),write_config(),read_config()implementationssteami32.c-- 3 new tasks + callback handlers + process_task casesTest script
Test plan
Closes #2