Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gowin: Implement User Flash programming for GW1N9 #499

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

jeanthom
Copy link
Contributor

Hi,

Gowin FPGA with built-in flash memory offer a separate "user flash" zone (documentation), either accessible from programmable logic, or used as system memory for the EMCU. This memory can be configured by JTAG, but this isn't documented at the moment. We've reversed how flashing was performed for the GW1N9 FPGAs by sniffing the JTAG wires: it works in the same way you flash the bitstream, but with a different base address.

This PR implements user flash programming for GW1N(R)9 FPGAs (other models probably have different base addresses). The documentation lists this addition as experimental because of the reverse engineered nature of this development. A few safeguards have been implemented to prevent misuse of this functionality (FPGA model checking, file size).

Jean

@jeanthom
Copy link
Contributor Author

Looking at the diff from the PR, it seems like my attempt at fixing indentation issues modified more core than I expected. Should I remove those lines from this PR?

src/gowin.cpp Outdated Show resolved Hide resolved
src/gowin.cpp Outdated Show resolved Hide resolved
@trabucayre
Copy link
Owner

It looks good, but I have a question: is mcufw principle is not working in this case? The approach here looks similar to the one for 4k.
I'm wrong?

Thanks

@jeanthom jeanthom force-pushed the gowin-gw1n9-userflash branch from b5a591f to 46ff6cb Compare December 11, 2024 11:19
@jeanthom
Copy link
Contributor Author

Hi,

I just force pushed a newer version of this MR. I kept separate arguments for mcufw and userflash to avoid confusion (Gowin documentation clearly distinguishes between the two). Let me know what you think?

@trabucayre
Copy link
Owner

Globally this PR is ready to be merged.
In fact the only think where I'm hesitant is with the addition to a new argument: openFPGALoader has many options and I have no idea about the part of time took by the argument parser compared to the operation. Also for user it's maybe hard to find which argument to use.

@jeanthom
Copy link
Contributor Author

I don't really think the argument parsing is much of a concern here. I can run some benchmarks if you want though.

I understand your concerns regarding the user experience being affected by extra arguments. However I can't think of a better solution, that's both doesn't require complicated setup and that would be easy to discover.

@trabucayre trabucayre merged commit cdc4d32 into trabucayre:master Dec 13, 2024
14 checks passed
@trabucayre
Copy link
Owner

Applied Thanks @jeanthom!
I will do some tests regarding arguments and maybe trying to reorder it to have something more easy

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.

2 participants