-
-
Notifications
You must be signed in to change notification settings - Fork 39.2k
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
massdrop alt/ctrl: support saving into nvm #6068
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! 👍 |
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 <alex@alexdalton.org>
- Use define for SmartEEPROM buffer address - Check buffer overflow - Do not perform operation when timeout occurs Signed-off-by: Alexandre d'Alton <alex@alexdalton.org>
Signed-off-by: Alexandre d'Alton <alex@alexdalton.org>
* qmk/develop: (21 commits) massdrop alt/ctrl: support saving into nvm (qmk#6068) Added power tracking api (qmk#12691) Mechlovin Hannah60RGB touch-up (qmk#14646) [Core] Fix "6kro enable" and clarify naming (qmk#14563) [Keymap] Update to Drashna Code (qmk#14644) [Keyboard] add support for Quark_LP (qmk#14552) [Keyboard] Update Grandiceps to Rev2 (qmk#14618) [Keymap] Jonavin murphpad keymap update (qmk#14637) [Keyboard] Updates for Tractyl Manuform config (qmk#14641) [Keyboard] Fix end of file issue for Owlab suit80 (qmk#14640) [Keyboard] Add support for PaladinPad, Arya pcb and move keyboards by KapCave into their own directory (qmk#14194) [Keymap] Keychron Q1 user keymap (qmk#14636) Fix for mechlovin/adelais/standard_led/arm/rev4 (qmk#14639) convert checkerboards/quark_squared:via rules.mk to Unix line endings (qmk#14638) Mechlovin Delphine: add LAYOUT_numpad_6x4 (qmk#14635) Move "firmware size check skipped" note to message.mk (qmk#14632) [Keymap] fix NKRO - switch to get_mods() and refactor encoder action code (qmk#14278) [Keyboard] Yampad VIA support (qmk#14397) [Keyboard] Add OwLab Suit80 (qmk#14362) [Keymap] arkag userspace/keymap -- new macro and minor preonic keymap change (qmk#14623) ...
@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 <alex@alexdalton.org> * 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 <alex@alexdalton.org> * return 0 instead of ff for invalid address or timeout Signed-off-by: Alexandre d'Alton <alex@alexdalton.org> * clang-format * Add extra bounds checks Co-authored-by: zvecr <git@zvecr.com>
* support saving into SmartEEPROM Signed-off-by: Alexandre d Alton <alex@alexdalton.org> * 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 <alex@alexdalton.org> * return 0 instead of ff for invalid address or timeout Signed-off-by: Alexandre d'Alton <alex@alexdalton.org> * clang-format * Add extra bounds checks Co-authored-by: zvecr <git@zvecr.com>
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 alex@alexdalton.org