jsanchez-2g opened a new pull request, #20520:
URL: https://github.com/apache/nuttx/pull/20520

   ## Summary
   
   The RAMTRON SPI FRAM driver currently provides block writes but no optional 
MTD byte-write callback. Add `CONFIG_MTD_BYTE_WRITE` support for unaligned 
offsets and lengths. Reject out-of-device ranges with `-EINVAL`; valid empty 
writes return zero without SPI traffic.
   
   Use the initialized SPI device ID, hold the bus lock across the request, and 
issue write-enable for each transfer. With `CONFIG_RAMTRON_CHUNKING`, split 
transfers at the write-buffer boundaries of chunk-limited parts. Document the 
behavior and fix two existing missing blank lines for full-file style 
compliance.
   
   ## Impact
   
   - Optional driver capability using the existing MTD API and configuration; 
no new public API or Kconfig symbols.
   - Existing block operations and configurations with byte writes disabled 
remain unchanged. No user migration or build-system change required.
   - RAMTRON documentation updated. No related NuttX Apps change or dependency 
on another PR.
   - Bounds checks prevent byte requests from wrapping around the physical 
device. No other security behavior changed.
   
   ## Testing
   
   Build host: Ubuntu 24.04.4 LTS / WSL2, Linux x86_64. Target compiler: 
arm-none-eabi GCC 13.2.1 (20231009). Target: Conductor G005251, STM32H743BI, 
auxiliary UART-only NSH RAMTRON profile.
   
   The exact candidate driver was copied into the integrated Conductor NuttX 
checkout, clean-configured, and built using `make -j1 V=1`. Build passed with 
existing warnings retained in the local build log. This was a fork integration 
build with local board support and patches, not a pristine Apache board build. 
Candidate driver identity against this submission was verified byte-for-byte.
   
   Standalone full-driver object compilation also passed without diagnostics 
for byte writes disabled, enabled without chunking, and enabled with chunking. 
Local mocked-SPI tests compile the actual callback with `-Wall -Wextra 
-Werror`, with chunking on/off, covering bounds, oversized requests, valid 
empty writes, unaligned writes, final-byte writes, surrounding bytes, nonzero 
device ID, command sequencing and chunk progression. The harness and auxiliary 
board test are local evidence, not included in this PR.
   
   Full-file style and encoding checks pass. Codespell passes with `-L fram`, 
ignoring the valid FRAM acronym (default codespell flags existing upstream 
occurrences).
   
   Hardware test reported by the operator on the installed 32 KiB FRAM:
   
   ```text
   nsh> ramtron_test run 31744 /mnt/ramtron-test-7c00-backup.bin
   RAMTRON geometry: block=512 erase=512 blocks=64 capacity=32768
   Saved 1024 bytes at offset 31744 to /mnt/ramtron-test-7c00-backup.bin
   PASS: relative offset=1 length=1, surrounding bytes intact
   PASS: relative offset=255 length=257, surrounding bytes intact
   PASS: relative offset=511 length=257, surrounding bytes intact
   PASS: empty write and invalid ranges
   PASS: original region restored and verified
   RAMTRON_TEST PASS
   ```
   
   The test exercised a 1024-byte region at physical offset 31744, saved its 
contents to SPI flash before writes, compared the entire region including 
guards after each pattern, and restored and verified the original contents. The 
captured backup was reconstructed and validated as exactly 1024 bytes. 
Chunk-limited hardware has not been tested; that path has host-test and 
compilation coverage only. There is no before/after hardware failure 
comparison: this adds an optional callback absent upstream.
   
   ## PR verification Self-Check
   
   - [x] This PR introduces only one functional change.
   - [x] Required description fields are provided.
   - [x] Human Signed-off-by commit and post-commit checks completed.
   - [ ] This PR is still work in progress (not ready for review).
   - [x] This PR is ready for review and can be safely merged into a codebase.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to