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

Support for image files larger than 4GB #98

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

mactcp
Copy link

@mactcp mactcp commented Apr 21, 2022

Changed the file position calculation to 64bit to handle image files larger than 4GB.

I tested this with Sedit. Before this change, sectors are aliasing every 4GB (0x80000 blocks). Reading block 0x800000 is the same as block 0, and writing to block 0x800000 overwrites block 0. After this change, everything works as expected.

In a quick test on an LC III+, I did notice a very small performance regression, maybe 1-2%, which I was not expecting. This calculation is only done once per transfer, and the STM32F103 has hardware support for long multiply (umull), so I wouldn't expect these code changes to have a direct impact on performance. I'm guessing there is some sort of alignment sensitivity in writeDataPhaseSD and readDataPhaseSD. Haven't had a chance to investigate that yet.

@erichelgeson
Copy link
Owner

Tested and works great. Thanks again @mactcp

@erichelgeson erichelgeson merged commit 7b7f194 into erichelgeson:main Apr 22, 2022
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