Add nice!nano v2 board support#100
Conversation
📝 WalkthroughWalkthroughChangesArrr, this adds complete nice!nano v2 support: board and variant definitions, UF2 conversion from Intel HEX, upload configuration, bootloader options, and documentation for UF2 programming. nice!nano v2 hardware variant
UF2 export and board integration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ArduinoBuild
participant uf2conv.py
participant UF2Bootloader
participant nice_nano_v2
ArduinoBuild->>uf2conv.py: Convert Intel HEX with family ID
uf2conv.py-->>ArduinoBuild: Produce UF2 image
ArduinoBuild->>UF2Bootloader: Copy UF2 image
UF2Bootloader->>nice_nano_v2: Program firmware
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 127-131: Expand the “Uploading via UF2” section with the exact IDE
action used to export the .uf2 file, then document how to reset the board into
its UF2 bootloader, including the required reset-button or reset-sequence steps
before copying the file to the mounted drive.
In `@tools/uf2conv.py`:
- Around line 31-44: The HEX parser must reject type-specific structural errors
and trailing data after EOF. Update the record parser function containing the
length/checksum validation to enforce required payload lengths and addresses for
each supported record type, including a valid zero-length EOF record; then
update the main record-processing loop to require exactly one EOF, reject any
non-empty records after it, and fail when EOF is missing instead of silently
stopping.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 25c5a43d-dd9f-43bc-9d38-7c74a46489f6
📒 Files selected for processing (6)
README.mdboards.txtplatform.txttools/uf2conv.pyvariants/nice_nano_v2/variant.cppvariants/nice_nano_v2/variant.h
| ### Uploading via UF2 | ||
| Boards with an Adafruit UF2 bootloader, such as the nice!nano v2, can be reset | ||
| into the bootloader and programmed by copying the exported `.uf2` file to the | ||
| mounted bootloader drive. UF2 export requires Python 3 to be available on the | ||
| system path. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Arrr, add the missing UF2 workflow steps.
This section says to copy an “exported” .uf2 file but does not explain how to export it or how to trigger the board’s UF2 bootloader. Add the exact IDE action and reset sequence so users can complete the documented workflow.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` around lines 127 - 131, Expand the “Uploading via UF2” section
with the exact IDE action used to export the .uf2 file, then document how to
reset the board into its UF2 bootloader, including the required reset-button or
reset-sequence steps before copying the file to the mounted drive.
| if len(raw) < 5: | ||
| raise ValueError(f"line {line_number}: record is too short") | ||
|
|
||
| count = raw[0] | ||
| if len(raw) != count + 5: | ||
| raise ValueError(f"line {line_number}: record length mismatch") | ||
|
|
||
| if (sum(raw) & 0xFF) != 0: | ||
| raise ValueError(f"line {line_number}: checksum mismatch") | ||
|
|
||
| address = (raw[1] << 8) | raw[2] | ||
| record_type = raw[3] | ||
| payload = raw[4:4 + count] | ||
| return record_type, address, payload |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Arrr, reject malformed HEX records before generating firmware.
The parser accepts invalid type-specific lengths—for example, extended-address records with payloads other than 2 bytes—and accepts malformed EOF records. It also stops at the first EOF and silently ignores any subsequent records, which can produce a partial or incorrectly addressed UF2 image.
Validate each record type’s required byte count and address, require exactly one valid EOF record, and reject non-empty content after EOF.
Also applies to: 57-71
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tools/uf2conv.py` around lines 31 - 44, The HEX parser must reject
type-specific structural errors and trailing data after EOF. Update the record
parser function containing the length/checksum validation to enforce required
payload lengths and addresses for each supported record type, including a valid
zero-length EOF record; then update the main record-processing loop to require
exactly one EOF, reject any non-empty records after it, and fail when EOF is
missing instead of silently stopping.
|
I test on Arm(Nim)BLE Boards 4.0. Work well on BLE Scan example. |
Validation passed:
Summary by CodeRabbit
New Features
Documentation