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

chore: add FlashOnStBootloaderCommunicator #257

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

EkelmansPh
Copy link
Contributor

@EkelmansPh EkelmansPh commented Feb 4, 2024

No description provided.

Copy link
Contributor

github-actions bot commented Feb 4, 2024

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 5 0 0.02s
✅ CPP clang-format 14 3 0 0.11s
✅ DOCKERFILE hadolint 1 0 0.08s
✅ JSON jsonlint 7 0 0.12s
✅ JSON prettier 7 2 0 0.72s
⚠️ MARKDOWN markdownlint 6 1 7 1.15s
⚠️ MARKDOWN markdown-link-check 6 2 58.62s
✅ MARKDOWN markdown-table-formatter 6 1 0 0.22s
✅ REPOSITORY checkov yes no 28.36s
✅ REPOSITORY git_diff yes no 0.02s
✅ REPOSITORY grype yes no 22.64s
✅ REPOSITORY ls-lint yes no 0.06s
✅ REPOSITORY secretlint yes no 56.07s
✅ REPOSITORY trivy yes no 6.88s
✅ REPOSITORY trivy-sbom yes no 0.7s
✅ REPOSITORY trufflehog yes no 12.31s
⚠️ SPELL lychee 31 2 69.79s
✅ YAML prettier 8 1 0 0.75s
✅ YAML v8r 8 0 6.69s
✅ YAML yamllint 8 0 0.23s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@rjaegers rjaegers changed the title chore: add FlasOnStBootloaderCommunicator chore: add FlashOnStBootloaderCommunicator Feb 13, 2024
this->onDone = onDone;
this->beginIndex = beginIndex;
this->endIndex = endIndex;
this->page[1] = static_cast<uint8_t>(beginIndex);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This suggests that 2 pages are being erased. It turns out the interface is misleading: It should accept a MemoryRange<unt16_t> instead, and then do its little/big endian transformation itself.

@@ -105,7 +106,8 @@ namespace services

void StBootloaderCommunicatorUart::ReadMemory(uint32_t address, infra::ByteRange& data, const infra::Function<void()>& onDone)
{
really_assert(data.size() <= 255);
really_assert(data.size() <= 256);
really_assert(data.size() > 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we also should support reading 1 byte, although that may need implementation with a kind of workaround. Otherwise some poor fellow a few years from now will be searching really hard why his application crashes at inconvenient moments

@@ -136,7 +138,8 @@ namespace services

void StBootloaderCommunicatorUart::WriteMemory(uint32_t address, infra::ConstByteRange data, const infra::Function<void()>& onDone)
{
really_assert(data.size() <= 255);
really_assert(data.size() <= 256);
really_assert(data.size() % 4 == 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

These kind of conditions need to be documented at the interface, otherwise they're Liskov substitution failures

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