Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spi_nand_flash): add diagnostics application for NAND flash #451

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RathiSonika
Copy link
Collaborator

Change description

Added a diagnostics application for NAND flash to facilitate debugging and performance analysis.

spi_nand_flash/src/nand_diag_api.c Fixed Show fixed Hide fixed
spi_nand_flash/src/nand_diag_api.c Fixed Show fixed Hide fixed
@RathiSonika RathiSonika marked this pull request as ready for review December 2, 2024 08:40
@RathiSonika RathiSonika requested a review from igrr December 2, 2024 08:41
@pacucha42
Copy link

pacucha42 commented Dec 2, 2024

Please, consider adding ESP_ERROR_CHECK wherever applicable. I didn't comment all single cases, however, we should provide clean-code example.

Beside of such minor points, all LGTM. Thanks

@RathiSonika RathiSonika force-pushed the feat/spi_nand_flash_diagnostic_app branch 2 times, most recently from 099bdcd to 85e299d Compare December 2, 2024 10:20
Copy link
Member

@igrr igrr left a comment

Choose a reason for hiding this comment

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

I think nand_read_write_sectors_tp isn't a great "API" now because it returns information by printing it to console. This means that it can only be used in a test/diagnostic application.

If we keep the function as is, I would suggest:

  • Move the function definition to the new diagnostics example
  • Remove benchmarking part of the test_app — this is now covered by testing the example.

If you would prefer to keep this as an API, I would suggest some changes:

  • Combine most of function arguments into a structure. This way, if you need to add yet another argument or a benchmarking option, that won't be a breaking change.
  • Instead of printing the results using ESP_LOG, fill in another "result" structure, return the structure to the caller using an output pointer, and let the caller print the results.

@RathiSonika
Copy link
Collaborator Author

RathiSonika commented Dec 2, 2024

Thank you for the review @igrr. I had considered this point earlier, but I’m not sure how the throughput would be used from the user’s perspective. This API is primarily designed for testing throughput, similar to how the iperf command works—where you provide arguments, and it prints the throughput. That was the idea behind creating this API. Of course, I can update it, but is it really necessary to return the time intervals required for reading and writing sectors?

@igrr
Copy link
Member

igrr commented Dec 2, 2024

Would it then be enough to define this benchmarking function within the diagnostics application/example? This way you aren't committing it any specific API — you are free to change the example at any time without making it a breaking change. And as you said, it's not clear how the throughput will be used from users' perspective. My guess that having a benchmarking application is enough and the users won't need to integrate this into their own apps.

@RathiSonika
Copy link
Collaborator Author

Yes, I’ll move this function to the diagnostics application as it’s a better option.

@RathiSonika RathiSonika force-pushed the feat/spi_nand_flash_diagnostic_app branch from 85e299d to db46e1a Compare December 2, 2024 16:48
@RathiSonika RathiSonika requested a review from igrr December 3, 2024 08:03
Copy link
Member

@igrr igrr left a comment

Choose a reason for hiding this comment

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

LGTM, just one nitpick.

#include "soc/spi_pins.h"
#include "spi_nand_flash.h"
#include "nand_diag_api.h"
#include "nand_private/nand_impl_wrap.h"
Copy link
Member

Choose a reason for hiding this comment

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

Is it okay that the example depends on a private API?

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