Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Loader improvements#264

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
andreagilardoni wants to merge3 commits intoarduino:main
base:main
Choose a base branch
Loading
fromandreagilardoni:loader-improv

Conversation

@andreagilardoni
Copy link

This PR aims to:

  • add a check on header fields to ensure endianness throughbyteorder zephyr library
  • redefinestruct sketch_header_v1 to a union which can simplify the procedure of converting a 16 byte buffer into a C struct and respect the strict aliasing rule.

Copy link

@pillo79pillo79 left a comment
edited
Loading

Choose a reason for hiding this comment

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

LGTM, not sure about the need for endianness checks as it would require a very big effort to go over the whole project (code and tools) to make sure there is proper support for it.

EDIT: please add a short commit message that explains why this is useful.

@andreagilardoni
Copy link
Author

@pillo79 I believe that the endianness commit has little to no cost in terms of code space (on little endian platforms) and in a distant future where we may try a big endian platform we have one place less to check to make it compatible. I don't see any other reasons except that this is a free improvement in platform independent code.

sketch_hdr.len=sys_le32_to_cpu(sketch_hdr.len);
sketch_hdr.magic=sys_le16_to_cpu(sketch_hdr.magic);

if (sketch_hdr.ver!=0x1||sketch_hdr.magic!=0x2341) {
Copy link
Member

@leonardocavagnisleonardocavagnisNov 14, 2025
edited
Loading

Choose a reason for hiding this comment

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

Suggested change
if (sketch_hdr.ver!=0x1||sketch_hdr.magic!=0x2341) {
if (sketch_hdr.ver!=SKETCH_VER||sketch_hdr.magic!=SKETCH_MAGIC) {

Consider replacing the magic numbers with#define constants for maintainability

andreagilardoni reacted with thumbs up emoji
Copy link
Member

@leonardocavagnisleonardocavagnis left a comment

Choose a reason for hiding this comment

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

LGTM :)
minor change suggested

@per1234per1234 added the enhancementNew feature or request labelNov 17, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@pillo79pillo79pillo79 left review comments

@leonardocavagnisleonardocavagnisleonardocavagnis left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

enhancementNew feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@andreagilardoni@pillo79@leonardocavagnis@per1234

[8]ページ先頭

©2009-2025 Movatter.jp