-
-
Notifications
You must be signed in to change notification settings - Fork 43.3k
massdrop alt/ctrl: support saving into nvm #6068
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
Conversation
|
@patrickmt you should absolutely see this. |
22b28ff to
ca9816a
Compare
|
Anyone want to test this out? |
|
I wouldn’t be able to test the nvm part, but could test that it behaves normally without those bits set. |
|
I'll test this out later tonight I hope |
|
To fully understand the situation, does the proposed change require mdloader changes or external hardware to function? If this code was merged as-is, what would users who dont have access to the above see? If its runtime failures, I dont see how this can be merged yet. |
|
@zvecr Looks like the code will work with or without changes to mdloader. Though you wouldn't see the benefits until mdloader is changed. |
|
@reywood that's good. Let's see what the testing brings. |
|
Well, so far my CTRL has yet to crap itself from these changes. Also types just fine, except my fingers are now too use to a grid layout... |
|
I can try to add the code that will automatically update the configuration area, but this is too dangerous in my opinion as it cannot be recovered without a change in mdloader or JTAG hardware. having mdloader changed would allow to securely update the configuration area without risking to lose some important data that is stored in it. |
|
Please no, last thing that needs to be floating around is test code that could break a popular kb. We can wait for an official mdloader change. |
|
fully agree. |
|
This patch to mdloader allows to enable smarteeprom feature in order to test configuration persistence. |
|
@daltona tried your modified mdloader on windows with no luck. It still does not save out rgb matrix state. Did I use the right option? Interestingly enough, when I swap the order of the params, it spits out that another command conflicts with download: And the command list does not mention the -r option at all. Tried -r option by itself: Running it again states it is already configured: Final edit: Switching to the correct branch makes it work! Nice! 👍 |
Given there are "proprietary" blobs involved, I doubt it would be a good idea to maintain a "community official" branch or something similar. Massdrop also seem to have their own unpublished versions of the blob for new keyboards that they're using in their configurator, all of this is in violation of GPL btw. The assumption that you can plug the blobs in and it'd work is false because they change between the MD boards and their revisions so you can never actually maintain that. |
|
How feasible would it be to create our own open source bootloader to be able to ditch their proprietary |
|
It's certainly possible to write your own bootloader for ATSAM devices, the problem is that you will need extra hardware to replace it, in this case a J-Link and a Tag-Connect cable: https://learn.adafruit.com/how-to-program-samd-bootloaders |
|
I see, thanks for explaining. I thought the Apart from the bootloader (that's definitely different between boards, mine is |
|
As far as I can tell, the applet simply contains routines for programming external memories; it is uploaded to the chip before flashing proper starts, so that the bootloader knows where to shove the data it's receiving. From the SAM-BA docs:
So it would make sense that the mdloader's applet file hasn't changed, as it is fairly specific to the hardware configuration. In any case, I don't think it would be useful. |
Signed-off-by: Alexandre d Alton <[email protected]>
- Use define for SmartEEPROM buffer address - Check buffer overflow - Do not perform operation when timeout occurs Signed-off-by: Alexandre d'Alton <[email protected]>
Signed-off-by: Alexandre d'Alton <[email protected]>
|
@zvecr Thank you for completing this and allowing it to be merged ! |
|
Thanks go to you for putting in the bulk of the work! |
|
@vmalloc mdloader officially supports persistence starting from v1.0.6 https://github.com/Massdrop/mdloader/releases/tag/1.0.6 |
|
@nicoelayda awesome! I missed that bit - updated mdloader and it works great. Thanks for all the hard work you guys put into this! |
* support saving into SmartEEPROM Signed-off-by: Alexandre d Alton <[email protected]> * atsam: update smarteeprom implementation - Use define for SmartEEPROM buffer address - Check buffer overflow - Do not perform operation when timeout occurs Signed-off-by: Alexandre d'Alton <[email protected]> * return 0 instead of ff for invalid address or timeout Signed-off-by: Alexandre d'Alton <[email protected]> * clang-format * Add extra bounds checks Co-authored-by: zvecr <[email protected]>

Use SAMD51 virtual eeprom to store eeprom in nvm instead of ram buffer so it is persistent accross reboots.
In order to have this working it is required to set PSZ and SBLK values in the NVM user row, I believe that can be done with the mdloader, but not having the source code, I am not able to implement this, I would be happy to do so.
I've tested by manualy updating the NVM user row connecting a JLINK probe on my keyboard.
Signed-off-by: Alexandre d Alton [email protected]