Bug 254447

Summary: sysutils/py-qmk: current arm-none-eabi-gcc is not compatible, creates broken image
Product: Ports & Packages Reporter: Henry Hu <henry.hu.sh>
Component: Individual Port(s)Assignee: Mateusz Piotrowski <0mp>
Status: Closed FIXED    
Severity: Affects Only Me CC: henry.hu.sh
Priority: --- Flags: bugzilla: maintainer-feedback? (0mp)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 255454    
Bug Blocks:    

Description Henry Hu 2021-03-21 02:03:15 UTC
I've just got a BDN9 rev2 keyboard from Keebio, and tries to build a custom QMK firmware using py-qmk. It installs arm-none-eabi-gcc from ports, which is currently having version 8.4.0. The built image is broken, and the board can't boot.
I've tried to build on a Debian 10 (having arm-none-eabi-gcc 7.3.1), and it creates good image.

Either we should clone an older version of the arm-none-eabi-gcc port (such as 7.3.1) and put it into the ports tree, and make this port (py-qmk) depend on the older version, or figure out some other way. I don't expect QMK to be changed to be compatible with GCC 8.4 soon. Maybe we can wait for further updates to GCC and expect newer versions to produce good image, although there seems to be known issue with GCC 9 (https://github.com/qmk/qmk_firmware/issues/6719)
Comment 1 Mateusz Piotrowski freebsd_committer freebsd_triage 2021-03-24 08:30:10 UTC
Thanks for the report.

In that case we should create a new port arm-none-eabi-gcc 7 and use it for RUN_DEPENDS.
Comment 2 Mateusz Piotrowski freebsd_committer freebsd_triage 2021-03-24 08:31:33 UTC
However, when I run qmk doctor it does not complain about the arm-none-eabi-gcc version:

```
$ qmk doctor
Ψ QMK Doctor is checking your environment.
⚠ Unsupported OS detected: freebsd-14.0-current-amd64-64bit-elf
Ψ QMK home: /usr/home/0mp/qmk_firmware
Ψ All dependencies are installed.
Ψ Found arm-none-eabi-gcc version 8.4.0
Ψ Found avr-gcc version 9.1.0
⚠ We do not recommend avr-gcc newer than 8. Downgrading to 8.x is recommended.
Ψ Found avrdude version 6.3
Ψ Found dfu-util version 0.10
Ψ Found dfu-programmer version 0.7.2
Ψ Submodules are up to date.
Ψ QMK is ready to go, but minor problems were found
```

This may be something that should be reported upstream.
Comment 3 Henry Hu 2021-03-26 02:55:28 UTC
Yeah, qmk-doctor seems to be fine with it, so I'm not completely sure that it's the compiler version, or something else. Does it work for your board?
Comment 4 Mateusz Piotrowski freebsd_committer freebsd_triage 2021-04-15 13:28:50 UTC
(In reply to Henry Hu from comment #3)

It's hard to say. I'm using Crkbd and I can build firmware just fine. However, the keyboard happens to hang after some time. I am not sure if that's a software bug (potentially caused by the toolchain) or a hardware issue.
Comment 5 Mateusz Piotrowski freebsd_committer freebsd_triage 2021-04-17 17:58:57 UTC
(In reply to Mateusz Piotrowski from comment #4)

Now that I think about it, could you report the issue with arm-none-eabi-gcc 8.4.0 to the QMK project? They may be interested in it. Perhaphs they will start recommending version <= 7.
Comment 6 Mateusz Piotrowski freebsd_committer freebsd_triage 2021-04-28 13:14:25 UTC
According to the QMK issue you linked in the first post, GCC 10.2.0 may be able to compile working firmware.

You can test it if you want (the patch is here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255454).
Comment 7 Mateusz Piotrowski freebsd_committer freebsd_triage 2021-05-06 22:57:55 UTC
Please try to build your firmware with the latest avr-gcc. It works perfectly in my case.