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

[Bug] Realign and size check EECONFIG structures #20541

Merged
merged 19 commits into from
May 8, 2023

Conversation

drashna
Copy link
Member

@drashna drashna commented Apr 24, 2023

Description

RGB/LED matrix eeconfig is overwriting addresses pass 34, which is not good.

Technically, it only takes up 6 bytes, but there is no uint48_t. So for correctness, extends the config to uint64_t to properly fit everything, which requires extending the EECONFIG blocks too.

Types of Changes

  • Core
  • Bugfix

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@github-actions github-actions bot added the core label Apr 24, 2023
quantum/eeconfig.c Outdated Show resolved Hide resolved
@drashna drashna requested review from sigprof and a team April 24, 2023 07:26
Copy link
Member

@fauxpark fauxpark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this affect the Input Club boards, if at all? Their EEPROM becomes locked to 32 bytes after flashing QMK for the first time due to misconfiguration in the driver.

@drashna
Copy link
Member Author

drashna commented Apr 24, 2023

How does this affect the Input Club boards, if at all? Their EEPROM becomes locked to 32 bytes after flashing QMK for the first time due to misconfiguration in the driver.

A quick look at it would seem to indicate that the val, speed, and flags would get truncated. Would it be worth moving the reserved block? It would mean that the led and rgb matrix would not be as parity like it is now, but it could fit in 32bit structure and would be fully under the 32byte limit, I think.

@zvecr
Copy link
Member

zvecr commented Apr 24, 2023

You could always reorder and bump haptic to the end, far less users on that feature.

@drashna
Copy link
Member Author

drashna commented Apr 25, 2023

You could always reorder and bump haptic to the end, far less users on that feature.

Haptic isn't used on their boards, as far as I'm aware. So sounds "safe"

@drashna drashna changed the title [Bug] Fix RGB/LED Matrix size in EEPROM issues [Bug] Realign and size check EECONFIG structures Apr 25, 2023
@drashna
Copy link
Member Author

drashna commented Apr 25, 2023

Apparently, because of how the struct was set up for haptic config, the size of the config was actually larger than 32 bits. Seems like AVR-GCC was okay with this, but arm-gcc did not like this.

https://github.com/drashna/qmk_firmware/actions/runs/4793553713/jobs/8526110742#step:4:494

Rearranging struct seems to fix this, and since we're already decrementing the Magic number...

Copy link
Contributor

@sigprof sigprof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not completely convinced that we should waste 4 bytes of EEPROM to store the data that the RGBLIGHT subsystem does not actually use in any way. But if we choose to do it that way, at least we should clean up the misleading comments from that code.

quantum/rgblight/rgblight.h Outdated Show resolved Hide resolved
quantum/rgblight/rgblight.c Outdated Show resolved Hide resolved
@drashna
Copy link
Member Author

drashna commented Apr 25, 2023

I'm still not completely convinced that we should waste 4 bytes of EEPROM to store the data that the RGBLIGHT subsystem does not actually use in any way. But if we choose to do it that way, at least we should clean up the misleading comments from that code.

Can definitely understand that.

And part of that was me wanting to avoid with bitwise stuff.

Reverted some of the reorganization, and split off a block for rgblight speed. Can decide to nuke it or whatnot later.

@drashna drashna closed this Apr 25, 2023
@drashna drashna reopened this Apr 25, 2023
@drashna drashna requested review from sigprof and tzarc April 25, 2023 16:57
@drashna drashna merged commit 5c4b53a into qmk:develop May 8, 2023
@drashna drashna deleted the fix/led_eeprom branch May 8, 2023 17:56
coquizen pushed a commit to coquizen/qmk_firmware that referenced this pull request Jun 22, 2023
autoferrit pushed a commit to SpaceRockMedia/bastardkb-qmk that referenced this pull request Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants