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

ChibiOS upgrade to v19.1.3 #7597

Merged
merged 24 commits into from
Feb 2, 2020
Merged

ChibiOS upgrade to v19.1.3 #7597

merged 24 commits into from
Feb 2, 2020

Conversation

tzarc
Copy link
Member

@tzarc tzarc commented Dec 10, 2019

Description

As per the title, this is a PR in order to upgrade ChibiOS to the latest release version.

The newer ChibiOS itself provides some scripts that are able to upgrade the conf files in use by each board. For chconf.h and halconf.h this applies to all boards, however, for mcuconf.h this only applies to F303, as that's the only "upgrade script" supplied with the distribution. Other MCUs have been manually updated using diff's and the ChibiOS testhal definitions.

To combat making zillions of other changes, I've also added an interim script -- util/chibios-upgrader.sh -- which currently builds the 3rdparty dependencies for the ChibiOS upgrade scripts, and performs the update. In order to identify duplicate conf file and board definitions, each file gets pumped through clang-format before generating a checksum, in order to ensure only one distinct copy of each of the updated files is required for deployment into the rest of the repository. Unfortunately, this script is known to be non-functional in its current form on macOS. I'm unsure if this script (along with the "deployed files") should be included in the final merge.

The last commit on this PR (" Add updated board/conf files ") is the result of the execution of the upgrade script.

At this stage, the only testing that has been done was with a Proton C and a Blue Pill, both the handwired/onekey variants.

I've produced binaries from make all:default and uploaded them to the following location:
https://qmk.tzarc.io/chibios-upgrade/

There are a few outstanding pieces of development required, namely:

Dealing with the submodules:

  • ChibiOS is a direct copy of the main ChibiOS repository, and the referenced revision is specifically the ver19.1.3 tag. This points to my own copy of the repo, and will need to be updated on QMK's side to ensure consistency.
  • ChibiOS contrib is also a direct copy of the contrib repo, pointing at a recent revision of master. I haven't investigated if there have been subsequent updates -- I'd imagine that'll get done when the conversion to QMK-official repositories get done
  • uGFX is a direct copy of their master branch, with one additional change in order to bump compatibility with the newer ChibiOS. QMK uses a version of uGFX that is in maintenance mode, and they haven't seen fit to update it to be compatible with latest ChibiOS.

The other aspect is there have been a few definitions that have gone missing due to people modifying the *conf.h files (such as CORTEX_ENABLE_WFI_IDLE), which the ChibiOS upgrade scripts nuke during update.

I've kicked off this PR for now to get some official discussion going, as well as provide a forum to decide on a formal plan if/when these changes are integrated.

Types of Changes

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

Issues Fixed or Closed by This PR

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).

TODO

  • ChibiOS-Contrib modifications made by QMK already upstreamed, apparently
  • Fix timer subsystem
  • Work out missing #defines automatically removed when doing chibios update scripts
  • Removed: CORTEX_ENABLE_WFI_IDLE -- see Move CORTEX_ENABLE_WFI_IDLE=TRUE to rules.mk files #7766
  • Removed: usb_lld_disconnect_bus/usb_lld_disconnect_bus --in board.h, not modified by ChibiOS
  • Look into LTO build problems
  • Move personal repo's for ChibiOS/Contrib/uGFX to QMK org
  • Work out what to do with the update script and associated files added to util/

@tzarc tzarc changed the title Chibios upgrade to v19.1.3 ChibiOS upgrade to v19.1.3 Dec 10, 2019
@tzarc
Copy link
Member Author

tzarc commented Dec 10, 2019

Regarding converter/siemens_tastatur, discussion on Discord:

[2:06 AM] tz: ahhh, just the person I need to talk to 😛
[2:08 AM] tz: converter/siemens_tastatur was the last one I had to update
[2:08 AM] tz: don't suppose a test would be achievable?
[2:26 AM] yiancar: nah
[2:26 AM] yiancar: u cnt test it lol
[2:26 AM] yiancar: :p
[2:26 AM] yiancar: there is only 1/1
[2:26 AM] yiancar: i think the guy dissasembled it anyway
[2:26 AM] yiancar: so assume its working lol
[2:33 AM] tz: perfect!

@yiancar
Copy link
Contributor

yiancar commented Dec 10, 2019

I dont want to be the annoying dude but I have just 1 question:)
Why did we take out the space alignment in mcuconf.h? Was it to make easier to script?

@yanfali yanfali added breaking_change Changes that need to wait for a version increment enhancement core needs testing in progress labels Dec 10, 2019
@tzarc
Copy link
Member Author

tzarc commented Dec 10, 2019

I dont want to be the annoying dude but I have just 1 question:)
Why did we take out the space alignment in mcuconf.h? Was it to make easier to script?

Honestly, a lot of it was automated -- I'd imagine a clang-format was involved at some point.
The script is capable of backing out all the board+conf changes, will see if it's just a question of using the non-space-removed copy. Will check it out.

@yulei
Copy link
Contributor

yulei commented Dec 11, 2019

It's hard to test all the keyboards using chibios, keeping the current and introducing the v19 chibios as another protocol would be easier.

@tzarc
Copy link
Member Author

tzarc commented Dec 11, 2019

It's hard to test all the keyboards using chibios, keeping the current and introducing the v19 chibios as another protocol would be easier.

That may be the case, but it's unlikely that we'll want to support two ChibiOS versions for eternity, given the frequency of people copypasting of other keyboards. At some point "no" will need to be said when targeting the older ChibiOS with newer boards, and realistically the earlier the better.

Given that QMK doesn't seem to remove existing boards, there's only one course of action if the eventual removal of the v17.x ChibiOS is deemed necessary.

@yanfali
Copy link
Contributor

yanfali commented Dec 11, 2019

It's hard to test all the keyboards using chibios, keeping the current and introducing the v19 chibios as another protocol would be easier.

That's just not sustainable long term. We don't have the resources. If you want to maintain your own fork that might be a possibility, but I would not want to do that. One thing we're currently discussing is having stable and development branches, this would probably be a good approach rather than maintaining an old version of chibios and a current one. We'll update everyone once we've discussed things among collaborators and have something like a plan.

@yiancar
Copy link
Contributor

yiancar commented Dec 11, 2019

Also in theory we dont need to test "each keyboard" rather each platform

@drashna drashna requested review from a team December 11, 2019 19:25
@tzarc tzarc force-pushed the chibios-upgrade branch 3 times, most recently from 2234dae to 81cf2a8 Compare December 11, 2019 20:25
@tzarc
Copy link
Member Author

tzarc commented Dec 11, 2019

I dont want to be the annoying dude but I have just 1 question:)
Why did we take out the space alignment in mcuconf.h? Was it to make easier to script?

Confirmed that it was clang-format -- the ChibiOS upgrade scripts depend on the existence of #define in the code (without spaces after the #), and whilst that might be fine for some keyboards, because we have IndentPPDirectives: AfterHash set in the config, any existing values aren't carried across.

Have modified the scripts to rollback any formatting changes if the ChibiOS upgrade scripts didn't touch them.

@yiancar
Copy link
Contributor

yiancar commented Dec 12, 2019

<3

@yanfali
Copy link
Contributor

yanfali commented Dec 16, 2019

tested clueboard 66 rev 4, seemed to work F303
tested clueboard 60 - unresponsive after flash F303
@tzarc any way you can get the CLI to print the version of chibios being built?

@yanfali
Copy link
Contributor

yanfali commented Dec 16, 2019

hadron v3 with default keymap seems to work.
OK verified that this is head of chibios dir
commit 313416b8fda90d9973a749a0a35970956852c286 (HEAD, tag: ver19.1.3)

@yanfali
Copy link
Contributor

yanfali commented Dec 16, 2019

hadron ver3 weirdly if I flash my personal keymap it refuses to boot at all. flashing master qmk back on to board brings it back to life. branch is here: https://github.com/yanfali/qmk_firmware/tree/yanfali-chibios-upgrade

@yanfali
Copy link
Contributor

yanfali commented Dec 16, 2019

tested my little foot port using CTPC and it also doesn't work on a proton-c. Doesn't boot

@yanfali
Copy link
Contributor

yanfali commented Dec 16, 2019

@tzarc I pushed the littlefoot stuff to my fork so you can try it out for yourself since it's only proton c based. You can build it using make kingly_keys/little_foot:yanfali:flash CTPC=yes. plays some nice music on startup, so you know if it's working if a speaker is installed

@drashna
Copy link
Member

drashna commented Dec 16, 2019

@yanfali just to make sure, you've ran make clean, right? (at least once).

Also, this breaks the bitbang WS2812 implementing, and it breaks solenoid support. And LT, MT, and one shot timeout. And probably more :(
Anything that relies on a (software) timer seems to be broken.

Edit: Also, LTO breaks the new chibiOS. If it's enabled, it will basically compile a nice brick.

@yanfali
Copy link
Contributor

yanfali commented Dec 16, 2019 via email

@tzarc
Copy link
Member Author

tzarc commented Dec 18, 2019

tested my little foot port using CTPC and it also doesn't work on a proton-c. Doesn't boot

......built directly from your branch, started playing music fine. Weird?

@yanfali
Copy link
Contributor

yanfali commented Dec 18, 2019

tested my little foot port using CTPC and it also doesn't work on a proton-c. Doesn't boot

......built directly from your branch, started playing music fine. Weird?

In discord tz figured out it was compiler versions. 8.3.1 arm doesn't build quite right for latest chibios branch.

@tzarc
Copy link
Member Author

tzarc commented Dec 18, 2019

Timers seem like they're cooperating now, rgblight animations are cycling at a (seemingly) normal speed.
Later today I'll work out a test to toggle a GPIO using timer_elapsed, confirm with an oscilloscope.

@noroadsleft noroadsleft merged commit 6115dfb into qmk:future Feb 2, 2020
@noroadsleft noroadsleft added breaking_change Changes that need to wait for a version increment and removed in progress labels Feb 2, 2020
noroadsleft pushed a commit to noroadsleft/qmk_firmware that referenced this pull request Feb 8, 2020
* First stab at getting ChibiOS upgraded.

* Handful of others now working again.

* More updates to boards.

* More conversions of boards, hopefully.

* Add fix for converter/siemens_tastatur getting PAL_USE_CALLBACKS reset during upgrade.

* Restore unmodified/unformatted chibios config files if the upgrade scripts did nothing to them.

* Attempt to fix timers.

* Timer simplification, 100k back working.

* Attempt to sort out 32-bit timer overflow arithmetic for 16-bit timers.

* Another attempt at fixing 16-bit timers.

* Disable LTO on ChibiOS builds.

* Change LTO to a message only.

* Actually use proper makefile syntax for printing messages.

* Collect ChibiOS and ChibiOS-Contrib versions during build.

* Use 64-bit timer internally to match ChibiOS.

* Simplified timer.

* Fix SPI-based WS2812 driver.

* LTO fixes, interrupt handlers were being removed by LTO.

* Update updater script to take into account all available mcuconf updaters (prep for future versions)

* Fix up ldscript search order.

* Fix up another batch of boards.

* Add breaking changes log entry.

* Add updated board/conf files

* Remove staging files.
noroadsleft pushed a commit to noroadsleft/qmk_firmware that referenced this pull request Feb 14, 2020
* First stab at getting ChibiOS upgraded.

* Handful of others now working again.

* More updates to boards.

* More conversions of boards, hopefully.

* Add fix for converter/siemens_tastatur getting PAL_USE_CALLBACKS reset during upgrade.

* Restore unmodified/unformatted chibios config files if the upgrade scripts did nothing to them.

* Attempt to fix timers.

* Timer simplification, 100k back working.

* Attempt to sort out 32-bit timer overflow arithmetic for 16-bit timers.

* Another attempt at fixing 16-bit timers.

* Disable LTO on ChibiOS builds.

* Change LTO to a message only.

* Actually use proper makefile syntax for printing messages.

* Collect ChibiOS and ChibiOS-Contrib versions during build.

* Use 64-bit timer internally to match ChibiOS.

* Simplified timer.

* Fix SPI-based WS2812 driver.

* LTO fixes, interrupt handlers were being removed by LTO.

* Update updater script to take into account all available mcuconf updaters (prep for future versions)

* Fix up ldscript search order.

* Fix up another batch of boards.

* Add breaking changes log entry.

* Add updated board/conf files

* Remove staging files.
noroadsleft pushed a commit to noroadsleft/qmk_firmware that referenced this pull request Feb 21, 2020
* First stab at getting ChibiOS upgraded.

* Handful of others now working again.

* More updates to boards.

* More conversions of boards, hopefully.

* Add fix for converter/siemens_tastatur getting PAL_USE_CALLBACKS reset during upgrade.

* Restore unmodified/unformatted chibios config files if the upgrade scripts did nothing to them.

* Attempt to fix timers.

* Timer simplification, 100k back working.

* Attempt to sort out 32-bit timer overflow arithmetic for 16-bit timers.

* Another attempt at fixing 16-bit timers.

* Disable LTO on ChibiOS builds.

* Change LTO to a message only.

* Actually use proper makefile syntax for printing messages.

* Collect ChibiOS and ChibiOS-Contrib versions during build.

* Use 64-bit timer internally to match ChibiOS.

* Simplified timer.

* Fix SPI-based WS2812 driver.

* LTO fixes, interrupt handlers were being removed by LTO.

* Update updater script to take into account all available mcuconf updaters (prep for future versions)

* Fix up ldscript search order.

* Fix up another batch of boards.

* Add breaking changes log entry.

* Add updated board/conf files

* Remove staging files.
noroadsleft pushed a commit that referenced this pull request Feb 27, 2020
* First stab at getting ChibiOS upgraded.

* Handful of others now working again.

* More updates to boards.

* More conversions of boards, hopefully.

* Add fix for converter/siemens_tastatur getting PAL_USE_CALLBACKS reset during upgrade.

* Restore unmodified/unformatted chibios config files if the upgrade scripts did nothing to them.

* Attempt to fix timers.

* Timer simplification, 100k back working.

* Attempt to sort out 32-bit timer overflow arithmetic for 16-bit timers.

* Another attempt at fixing 16-bit timers.

* Disable LTO on ChibiOS builds.

* Change LTO to a message only.

* Actually use proper makefile syntax for printing messages.

* Collect ChibiOS and ChibiOS-Contrib versions during build.

* Use 64-bit timer internally to match ChibiOS.

* Simplified timer.

* Fix SPI-based WS2812 driver.

* LTO fixes, interrupt handlers were being removed by LTO.

* Update updater script to take into account all available mcuconf updaters (prep for future versions)

* Fix up ldscript search order.

* Fix up another batch of boards.

* Add breaking changes log entry.

* Add updated board/conf files

* Remove staging files.
@tzarc tzarc deleted the chibios-upgrade branch February 29, 2020 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking_change Changes that need to wait for a version increment core enhancement needs testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants