Skip to content

An attempt at mostly complete avr support#947

Open
philocalyst wants to merge 22 commits into
ZigEmbeddedGroup:mainfrom
philocalyst:avr-avr-avr
Open

An attempt at mostly complete avr support#947
philocalyst wants to merge 22 commits into
ZigEmbeddedGroup:mainfrom
philocalyst:avr-avr-avr

Conversation

@philocalyst

Copy link
Copy Markdown

No description provided.

@philocalyst

Copy link
Copy Markdown
Author

@mattnite Let me know if this is a good direction! Built on your work.

@philocalyst

Copy link
Copy Markdown
Author

Eek! I did not check the linting configuration. One second

if (limit <= 0) @compileError("limit must be non-negative!");

comptime var bits = 0;
inline while ((1 << bits) <= limit) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

won't this put 20'000 increment instructions rather than a loop?

@mattnite

Copy link
Copy Markdown
Contributor

@philocalyst I am back on MicroZig. I will get to reviewing this once we're on 0.16 because it has fixes for AVR in compiler_rt.

Thank you for the patience!

@philocalyst

philocalyst commented May 20, 2026 via email

Copy link
Copy Markdown
Author

@philocalyst

Copy link
Copy Markdown
Author

@mattnite Is the migration complete? I can resolve the conflicts...

@mattnite

Copy link
Copy Markdown
Contributor

@philocalyst it's stabilizing, I'm on 0.17/master, but now there are LLVM miscompilations :/

@philocalyst

Copy link
Copy Markdown
Author

Oh brother :(

@philocalyst philocalyst marked this pull request as ready for review July 7, 2026 02:16
@mattnite

mattnite commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Hey @philocalyst I'm letting you know that I see there's an issuewith the zig import check. It's very late for me now, but I'll check it out tomorrow.

@mattnite mattnite 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.

Please revert all your changes outside the port, examples, and build.zig change. That should get rid of a lot of the CI failures. We seem to have a linter check that is failing because it's pulling the wrong Zig version in.

Even if CI fails once you're done that, don't sweat it, it will likely be in a good position for merging.

Also, I think I fould the root cause for AVR not compiling on latest Zig and I'll be working with the compiler team to fix it. It's quite minor!

Comment thread sim/aviron/build.zig

const ext = std.fs.path.extension(entry.basename);
const action: FileAction = inline for (@typeInfo(@TypeOf(extension_to_action)).@"struct".field_names) |field_name| {
const action: FileAction = inline for (@typeInfo(@TypeOf(extension_to_action)).@"struct".fields) |field| {

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.

Please revert this change, it is using the old API

Comment thread tools/linter/build.zig
b.installArtifact(exe);

const run_cmd = b.addRunArtifact(exe);
run_cmd.addPassthruArgs();

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.

Please revert this change

Comment thread sim/aviron/build.zig

const run_cmd = b.addRunArtifact(aviron_exe);
run_cmd.step.dependOn(b.getInstallStep());
run_cmd.addPassthruArgs();

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.

Please revert this change

@philocalyst

Copy link
Copy Markdown
Author

Okay, going through and fixing now.

How does you feel

pub const porta_dir = 0x0400;
pub const porta_out = 0x0404;

as

pub const porta = struct {
    pub const dir = 0x0400;
    pub const out = 0x0404;
};

I find it pleasant because you can handle the qualification, but not pressing

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