Locate FPGA bitstream via the firmware_info at start of flash - #1810
Open
martinling wants to merge 5 commits into
Open
Locate FPGA bitstream via the firmware_info at start of flash#1810martinling wants to merge 5 commits into
firmware_info at start of flash#1810martinling wants to merge 5 commits into
Conversation
This commit does not bump the struct_version field, as that would break compatibility with existing versions of hackrf_spiflash. Instead, we add a magic field to indicate that a bitstream address is present.
This allows a firmware that has been embedded inside a larger image to determine where it should find its bitstream in the flash.
Setting this option forces the bitstream not to be included in the hackrf_usb image (as is already the case for RAM and DFU builds). This may be useful for integration into other firmwares which seek to embed a hackrf_usb firmware image whilst placing its bitstream elsewhere. The loader will find the bitstream via the firmware_info struct at the start of flash.
This is a best-effort approach. If a valid bitstream address is not found in the flash, loading fails similarly to how it is skipped now.
martinling
force-pushed
the
bitstream-in-firmware-info
branch
from
August 21, 2026 17:55
db84d04 to
2eeddc2
Compare
martinling
marked this pull request as ready for review
August 25, 2026 16:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes are intended to help simplify integration with PortaPack firmware.
Currently, normal
hackrf_usbbuilds embed the FPGA bitstream image as a binary blob, the address of which is known at link time and used by thefpga_loaderimplementation. DFU and RAM-only builds omit the bitstream, and don't bring up the FPGA.PortaPack firmwares embed a
hackrf_usbfirmware image which is copied to RAM and executed to put the device in USB mode. Having both codebases able to access the FPGA has previously been achieved by placing the bitstreams at a fixed offset in the flash, but this forces an arbitrary partitioning of the flash space.Here's a nicer solution: put the bitstream address in the authoritative
firmware_infostructure, which is always located at an offset of0x400in the flash image, after the vector table.After making that change, it's then easy to also fix #1739, by having DFU and RAM builds access the bitstream from flash in the same manner.