Skip to content

Initial Rev 3 flash driver#261

Merged
ETSells merged 13 commits into
mainfrom
feature/ES/r3-flash
Jun 2, 2026
Merged

Initial Rev 3 flash driver#261
ETSells merged 13 commits into
mainfrom
feature/ES/r3-flash

Conversation

@ETSells

@ETSells ETSells commented May 5, 2026

Copy link
Copy Markdown
Member

Description

Adds flash support to rev3 test app

Issue Link

Parent: SunDevilRocketry/driver#30

Depends on: SunDevilRocketry/mod#127 (can be reviewed separately though, just make sure this branch is checked out if you run any tests)

Testing

  • Passes existing unit tests
  • Unit tests modified
  • Integration test performed

Automated HW/SW integration test procedure written. Unit tests add support for the debug/assert macros.

Other

Leave any additional notes here

Reviewer Checklist

Standards

  • Follows FCF Architectural Standards
  • Follows SDR Coding Standards
  • Code complexity/function Size is minimized
  • Code is testable
  • Code is readable and commented properly
  • License terms are respected

Error Handling

  • Potentially unsafe functions return a status code
  • Error returns properly handled

Memory

  • Stack allocated memory is scoped correctly
  • Heap allocated memory is avoided
  • Globally allocated memory is minimized except when necessary
  • Pointers are used correctly
  • Concurrency has been considered

Performance

  • Rate limiters are respected
  • Busy waiting is avoided
  • "Delay" calls are not used in performance sensitive code

@ETSells ETSells requested a review from NArmistead May 23, 2026 20:44

@NArmistead NArmistead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but the code format in flash_validation_routine is nonstandard for FCF

Comment thread app/rev3/hardware_validation.c Outdated
Comment on lines +72 to +78
for(uint32_t i = 0; i < FLASH_MAX_ADDR; i+=FLASH_PAGE_SIZE) {
flash_handle.address = i;
flash_status = flash_read(&flash_handle, 2);
assert_fail_fast( flash_status == FLASH_OK, ERROR_FLASH_CMD_ERROR );
assert_fail_fast( flash_buf[0] == 127, ERROR_FLASH_CMD_ERROR );
assert_fail_fast( flash_buf[1] == 0xFF, ERROR_FLASH_CMD_ERROR );
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see code format here, for example

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is temporary and will most likely not be on the final product of rev 3. It will likely become a test utility after app integration on the new platform. Regardless, I will move to standardize the code seen here.

Comment on lines +134 to +137
flash_validation_routine();


} /* run_hardware_validation */ No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add some indication that the routine is finished

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention is to eventually set this up to use the uart debug interface for driver development, which should come soon.

@266-750Balloons 266-750Balloons left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me. Flash isn't my area of expertise, but this looks good besides my notes.

Sorry for taking forever to get to this.

Comment thread app/rev3/main.c

#ifdef DO_HARDWARE_VALIDATION
run_hardware_validation();
while (1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like there's a good chance that while(1) and the way the validation is done her in general is accidentally going to cost someone a particularly frustrating 45 minutes one day when they're trying to figure out why the firmware is seemingly not working, only to find out they had forgotten to remove this flag during a previous debug session.

I feel like we need some warning for this; at the very least, we could have a well-documented LED sequence to signal that it's a hardware validation build, and I also wonder if we could do something to tell SDEC and have it warn a user that they're on a hardware validation build.

@ETSells ETSells Jun 1, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is temporary. If we keep these routines after the initial HW bring up, they'll live in test and need a different way to be compiled into the FW. Right now, this is the only way we'll be running rev 3 until we port the app. Gonna go NAT.

Also, I intend to have our debug logging indicate the results of HW validation once implemented for rev 3.

@ETSells ETSells merged commit 7def325 into main Jun 2, 2026
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.

3 participants