Skip to content

Firmware: Move driver instances into driver implementation files#1745

Merged
mossmann merged 15 commits into
greatscottgadgets:mainfrom
antoinevg:antoinevg/organize-drivers
May 5, 2026
Merged

Firmware: Move driver instances into driver implementation files#1745
mossmann merged 15 commits into
greatscottgadgets:mainfrom
antoinevg:antoinevg/organize-drivers

Conversation

@antoinevg

Copy link
Copy Markdown
Member

This PR moves driver instances out of a central drivers.x file and into the individual driver implementation files.

This shift is to reduce linker coupling that would result in unnecessary inclusion of symbols from firmware/common/ in HackRF firmware other than hackrf_usb.

As per conversation at: #1709 (comment)

@antoinevg
antoinevg force-pushed the antoinevg/organize-drivers branch from 96566da to 3b1a21e Compare April 30, 2026 14:53
@antoinevg
antoinevg marked this pull request as ready for review April 30, 2026 15:04
Comment thread firmware/blinky/CMakeLists.txt Outdated
@martinling

Copy link
Copy Markdown
Member

From an integration point of view this is a good improvement and gets rid of most of the awkward legacy of hackrf_core being a module that depends on everything else in the tree.

Looking a bit beyond the scope of this PR, there is still a bit of a problem with pins.c depending on things that it doesn't really need to, because of code in pins_setup which writes to ssp_config_max283x, ssp_config_max5864, sgpio_config, ssp_config_w25q80bv, spi_flash, etc. Much of that initialization code doesn't need to be part of pins_setup - it could move into init/setup functions within the driver files that now own those structures.

@antoinevg
antoinevg force-pushed the antoinevg/organize-drivers branch from 3b1a21e to 8bdefc2 Compare May 4, 2026 07:52
@antoinevg

Copy link
Copy Markdown
Member Author

Looking a bit beyond the scope of this PR, there is still a bit of a problem with pins.c depending on things that it doesn't really need to, because of code in pins_setup which writes to ssp_config_max283x, ssp_config_max5864, sgpio_config, ssp_config_w25q80bv, spi_flash, etc. Much of that initialization code doesn't need to be part of pins_setup - it could move into init/setup functions within the driver files that now own those structures.

💯 -- this is one of the things I've been looking at in my carcinization branch. Tight-coupling is a blessing for readability when there is complex, inter-dependent configuration steps but most of pins_setup() really is just boilerplate that doesn't need to be right in your face.

@mossmann mossmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! Thank you!

@mossmann
mossmann merged commit 475db9c into greatscottgadgets:main May 5, 2026
98 checks passed
@antoinevg
antoinevg deleted the antoinevg/organize-drivers branch May 14, 2026 08:07
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