Skip to content

build: compile the drivers module with the firmware's optimize mode - #1096

Merged
mattnite merged 1 commit into
ZigEmbeddedGroup:mainfrom
matpala:build/drivers-optimize
Oct 24, 2026
Merged

mattnite merged 1 commit into
ZigEmbeddedGroup:mainfrom
matpala:build/drivers-optimize

Conversation

@matpala

@matpala matpala commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The drivers module was always built in Debug, even when the firmware was ReleaseSmall.

@Grazfather

Grazfather commented Oct 20, 2026 via email

Copy link
Copy Markdown
Collaborator

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

I don't think we need this? AFAIU, all modules inherit the target and optimize of the root module

@matpala
matpala force-pushed the build/drivers-optimize branch from da405b7 to 6962ee7 Compare October 23, 2026 19:51
@matpala

matpala commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

@mattnite that only applies when the module's optimize is null. drivers/build.zig sets it with b.standardOptimizeOption(.{}), which is Debug here because the dependency gets no optimize option. On main, the ReleaseSmall build shows -Odebug for drivers; with this PR it's -Osmall. The .text of rf-nano-v3_spi_nrf24 goes from 1968 to 1948 bytes.

@Grazfather asserts is already passed since #1077: add_firmware has .asserts = options.asserts.

I also reverted passing optimize to link. The network module asks for it with .{}, so the different arguments made two modules for the same file and broke the rp2xxx net examples.

@mattnite
mattnite merged commit efea1aa into ZigEmbeddedGroup:main Oct 24, 2026
37 checks passed
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