Skip to content

Add NUC126 support (continues #341) - #454

Merged
fpoussin merged 7 commits into
ChibiOS:chibios-21.11.xfrom
doombadroid:nuc126-support
Oct 4, 2026
Merged

fpoussin merged 7 commits into
ChibiOS:chibios-21.11.xfrom
doombadroid:nuc126-support

Conversation

@doombadroid

Copy link
Copy Markdown

This picks up #341 by @FlamingCupcake, which stalled in 2022, and takes it to a mergeable state. Their commit is included unchanged and keeps their authorship; the fixes are separate commits on top, rebased onto the current chibios-21.11.x.

Tested on hardware: a NUC1261SG4AE (peripheral-identical to the NUC126 parts) in a Ducky One 3 keyboard running QMK on this HAL (keyboard port): USB HID (keyboard incl. NKRO, consumer/system keys, console), PAL, ST (system tick) and crystal-less HIRC48 clocking. The NUTINY-SDK-NUC126 demos are build-tested only; I don't have that board.

Commits on top of #341

  • hal_lld_get_clock_point() stub: hal.h on chibios-21.11.x needs it (same stub as the NUC123 port).
  • usb_memcpy: .type usb_memcpy, %function, without which newer binutils refuse to link. Same fix USBv1 got in Fix compilation issue with newer binutils #423.
  • USB PHY power-up: USBD_ATTR bit 9 (PWRDN, active low) was never set, so the device never appeared on the bus. The vendor BSP writes 0x7D0, and the NUC123 port sets the same bit.
  • HIRC48 as HCLK and USB clock source (PLL off, NUC126_HSI48_ENABLED), replacing the #error. The PLL/crystal path is unchanged. Crystal-less USB still needs HIRC48 auto-trim against SOF (SYS->IRCTCTL1); board code does that for now.
  • testhal: halconf.h updated to HAL config 9.1 (the 8.0 configs no longer build). Driver selection unchanged.
  • CI: builds testhal/NUMICRO/NUC126, as requested in Add NUC126 support #341.

Build check: tools/chbuild.sh testhal/NUMICRO/NUC126 against ChibiOS stable_21.11.x, set up the way the workflow does it: 3 builds ok, 0 failed (arm-none-eabi-gcc 14.3).

Not included: #341's lgtm.yml change (LGTM.com shut down in 2022), and the NUC123 testhal projects, which fail on current ChibiOS (ccportab.h missing, old HAL config version); those are left for a separate PR. Note that the build workflow has been failing on chibios-21.11.x (last push run, 2026-04-08), so the new step may not be reached until that is fixed.

Happy to rework anything, or to close this if @FlamingCupcake would rather update #341.

🤖 Generated with Claude Code

FlamingCupcake and others added 7 commits October 4, 2026 10:27
hal.h on chibios-21.11.x calls hal_lld_get_clock_point(); without it the
NUC126 port no longer builds. Use the same static stub as the NUC123 port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Newer binutils refuse to link the Thumb call to the untyped usb_memcpy
symbol. Same fix as USBv1 got in ChibiOS#423 (2fb815d), placed the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
USBD_ATTR bit 9 (PWRDN, transceiver power, active low) is not named in
the NUC126 header, so usb_lld_start() left the PHY powered down: ATTR
read back 0x190 and the host never saw the device. The vendor BSP writes
ATTR = 0x7D0, and the NUC123 port sets the same bit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With NUC126_PLL_ENABLED FALSE and NUC126_HSI48_ENABLED TRUE, run HCLK
straight from HIRC48 (48 MHz) and clock USB from HIRC48
(CLKSEL3.USBDSEL = 0) instead of failing with "HSI48 not yet supported
for use with USB". Crystal-less boards need this. The PLL/crystal path
is unchanged.

Spec-accurate crystal-less USB also needs HIRC48 auto-trim against USB
SOF (SYS->IRCTCTL1); board code does that for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hal.h on chibios-21.11.x now requires _CHIBIOS_HAL_CONF_VER_9_1_, so the
2022 demo configs (8.0) stopped building with "obsolete or unknown
configuration file". Regenerate both from ChibiOS's halconf.h template,
keeping the original driver selection (PAL; PAL + USB for USB_HID), the
serial buffer size and the halconf_community.h include. chconf.h (RT 7.0)
is still current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
As requested in ChibiOS#341. NUC126 only: the NUC123 testhal projects predate
the current makefiles and configs (ccportab.h / HAL config errors) and
are left for a separate change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@doombadroid doombadroid mentioned this pull request Oct 4, 2026
@fpoussin
fpoussin merged commit 37c06f9 into ChibiOS:chibios-21.11.x Oct 4, 2026
1 check failed
@fpoussin

fpoussin commented Oct 4, 2026

Copy link
Copy Markdown
Member

Thank you very much!

@kovmir

kovmir commented Oct 5, 2026

Copy link
Copy Markdown

Freaking THANK YOU!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants