Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/chibios
Copy link
Member

Choose a reason for hiding this comment

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

Any changes on chibiOS libraries need to go upstream. We don't accept any changes to our repos directly.

Copy link
Member

@tzarc tzarc Feb 14, 2026

Choose a reason for hiding this comment

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

@keith-packard had already raised a corresponding PR against our fork before I'd disabled PRs on the repo.

The usual upstreaming process for ChibiOS changes is to post on https://forum.chibios.org -- they still do everything manually through Subversion.

Submodule chibios updated 1 files
+14 −0 os/various/syscalls.c
15 changes: 10 additions & 5 deletions lib/python/qmk/cli/doctor/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,21 @@ def _check_arm_gcc_installation():
temp_in = Path(temp_dir) / 'test.c'
temp_out = Path(temp_dir) / 'test.elf'

temp_in.write_text('#include <newlib.h>\nint main() { return __NEWLIB__ * __NEWLIB_MINOR__ * __NEWLIB_PATCHLEVEL__; }', encoding='utf-8')
temp_in.write_text('#include <stdlib.h>\nint main(void) { return EXIT_SUCCESS; }', encoding='utf-8')

args = ['arm-none-eabi-gcc', '-mcpu=cortex-m0', '-mthumb', '-mno-thumb-interwork', '--specs=nosys.specs', '--specs=nano.specs', '-x', 'c', '-o', str(temp_out), str(temp_in)]
result = cli.run(args, stdout=None, stderr=None)
if result.returncode == 0:
cli.log.info('Successfully compiled using arm-none-eabi-gcc')
cli.log.info('Successfully compiled using arm-none-eabi-gcc with newlib')
else:
cli.log.error(f'Failed to compile a simple program with arm-none-eabi-gcc, return code {result.returncode}')
cli.log.error(f'Command: {" ".join(args)}')
return CheckStatus.ERROR
args = ['arm-none-eabi-gcc', '-x', 'c', '-o', str(temp_out), str(temp_in)]
result = cli.run(args, stdout=None, stderr=None)
if result.returncode == 0:
cli.log.info('Successfully compiled using arm-none-eabi-gcc with picolibc')
else:
cli.log.error(f'Failed to compile a simple program with arm-none-eabi-gcc, return code {result.returncode}')
cli.log.error(f'Command: {" ".join(args)}')
return CheckStatus.ERROR

args = ['arm-none-eabi-size', str(temp_out)]
result = cli.run(args, stdout=None, stderr=None)
Expand Down
19 changes: 17 additions & 2 deletions platforms/chibios/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,23 @@ else
TOOLCHAIN ?= arm-none-eabi-

# Toolchain specific Linker flags
TOOLCHAIN_LDFLAGS = -Wl,--no-wchar-size-warning \
--specs=nano.specs
TOOLCHAIN_LDFLAGS = -Wl,--no-wchar-size-warning

# Default to compiling with picolibc for ARM targets if available, which
# is available by default on distributions based on Debian 11+.
ifeq ($(shell $(TOOLCHAIN)gcc --specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
# Toolchain specific Compiler flags Note that we still link with our own
# linker script by providing it via the -T flag in SHARED_LDFLAGS.
TOOLCHAIN_CFLAGS = --specs=picolibc.specs

# picolibc internally uses __heap_start and __heap_end instead of the
# defacto chibios linker script standard __heap_base__ and __heap_end__
# therefore we introduce these symbols as an alias.
TOOLCHAIN_LDSYMBOLS = -Wl,--defsym=__heap_start=__heap_base__,--defsym=__heap_end=__heap_end__

# Tell QMK that we are compiling with picolibc.
OPT_DEFS += -DUSE_PICOLIBC
endif

# MCU architecture flags
MCUFLAGS = -mcpu=$(MCU) \
Expand Down
2 changes: 2 additions & 0 deletions platforms/chibios/syscall-fallbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <sys/stat.h>
#include <sys/types.h>

#ifndef __PICOLIBC__
/* To compile the ChibiOS syscall stubs with picolibc
* the _reent struct has to be defined. */
#if defined(USE_PICOLIBC)
Expand Down Expand Up @@ -113,3 +114,4 @@ __attribute__((weak, used)) void __cxa_pure_virtual(void) {
}

#pragma GCC diagnostic pop
#endif