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

Add support for hardware and board initialisation overrides. #8330

Merged
merged 10 commits into from
Apr 12, 2020

Conversation

tzarc
Copy link
Member

@tzarc tzarc commented Mar 7, 2020

Description

ChibiOS board files aren't normally able to be overridden without making duplicates of the definitions, and modding them.

This PR introduces some new API methods and provides a way to override the initialisation files such that hooking the early bootup sequence can be achieved whilst retaining the original ChibiOS board definitions.

Effective changes, replacing modifications for each board definition's board.c:

  • __early_init has been overridden, and now has qmk api equivalents early_hardware_init_pre and early_hardware_init_post
  • boardInit has been overridden, and now has qmk api equivalent board_init

See documentation for notes on the constraints for usage -- any board developer that has previously overridden these will likely know the constraints already.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project.
  • 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).

@tzarc
Copy link
Member Author

tzarc commented Mar 7, 2020

Any ideas where these new APIs should be documented?

@tzarc
Copy link
Member Author

tzarc commented Mar 7, 2020

I've made the early_hardware_init_pre a no-op for now, so that we're not attempting to enter bootloader twice. Will have a followup set of PRs which migrate existing usage of the __early_init currently in use by keyboards, and once all the migration is complete, it can probably be swapped back in.

@tzarc
Copy link
Member Author

tzarc commented Mar 7, 2020

Initial testing makes it possible to remove the custom board definitions from the test projects I've been working with (BOARD = ...... in rules.mk), dropping back to the ChibiOS-supplied ones.

@tzarc
Copy link
Member Author

tzarc commented Mar 21, 2020

Seems to work fine for both Proton-C (F303), custom L082, custom G431, custom G474.

Copy link
Member

@zvecr zvecr left a comment

Choose a reason for hiding this comment

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

Tested, working. Just a small suggestion

tmk_core/protocol/chibios/main.c Outdated Show resolved Hide resolved
Co-Authored-By: Joel Challis <git@zvecr.com>
@zvecr zvecr requested a review from a team April 12, 2020 23:13
@zvecr zvecr requested a review from a team April 12, 2020 23:39
@tzarc tzarc merged commit 05e9ff6 into qmk:master Apr 12, 2020
calmh added a commit to calmh/qmk_firmware that referenced this pull request Apr 13, 2020
* master: (973 commits)
  Fix AVR SPI parameter configuration, remove timeouts due to sync protocol. (qmk#8775)
  VIA Support: Jane V2 (qmk#8735)
  Add a simple custom keymap for Gergo. (qmk#8662)
  Add via support to keebio/bdn9 (qmk#8620)
  DP60 VIA cleanups (qmk#8697)
  Adding Niu Mini to VIA (qmk#8702)
  Allow trailing whitespace in markdown docs, for formatting purposes. (qmk#8774)
  Add support for hardware and board initialisation overrides. (qmk#8330)
  [Keyboard] Add IDOBAO ID80 (qmk#8728)
  [Keyboard] Quefrency Rev2 Caps Lock LED, set lighting defaults (qmk#8729)
  [Keyboard] Add handwired Fc200rt qmk board (qmk#8726)
  Bugfix for quantum/dip_switch.c (qmk#8731)
  Add *OPT aliases for *ALT keycodes and macros (qmk#8714)
  [Keymap] Add keymap for Nyquist rev3 (qmk#8706)
  format code according to conventions [skip ci]
  Added Workman ZXCVM variation (qmk#8686)
  [Keyboard] jotpad16 status leds (qmk#8643)
  [Keyboard] Add handwired BDN9-BLE (qmk#8192)
  Fix bug with layer caching in get_event_keycode (qmk#8693)
  [Keyboard] Add CannonKeys Atlas keyboard (qmk#8207)
  ...
Quarren42 pushed a commit to Quarren42/qmk_firmware that referenced this pull request Apr 15, 2020
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
kylekuj pushed a commit to kylekuj/qmk_firmware that referenced this pull request Apr 21, 2020
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
mrlinuxfish pushed a commit to mrlinuxfish/qmk_firmware that referenced this pull request May 3, 2020
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
bitherder pushed a commit to bitherder/qmk_firmware that referenced this pull request May 15, 2020
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
drashna pushed a commit to zsa/qmk_firmware that referenced this pull request May 24, 2020
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
sowbug pushed a commit to sowbug/qmk_firmware that referenced this pull request May 24, 2020
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
fdidron pushed a commit to zsa/qmk_firmware that referenced this pull request Jun 12, 2020
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
turky pushed a commit to turky/qmk_firmware that referenced this pull request Jun 13, 2020
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
jakobaa pushed a commit to jakobaa/qmk_firmware that referenced this pull request Jul 7, 2020
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
@tzarc tzarc deleted the init-hooks branch September 10, 2020 02:27
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* Add support for hardware and board initialisation overrides.

* qmk cformat.

* Add some documentation.

* Docs clarity.

* Make early_hardware_init_pre a no-op for now, until migrations occur.

* Doco update

* Make distinction between keyboard and ChibiOS board in docs

* Doc anchors.

* Update tmk_core/protocol/chibios/main.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Rework bootloader entry to be off by default, allow opting-in.

Co-authored-by: Joel Challis <git@zvecr.com>
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.

None yet

2 participants