diff options
| -rw-r--r-- | platforms/chibios/platform.mk | 19 | ||||
| -rw-r--r-- | platforms/chibios/syscall-fallbacks.c | 1 | ||||
| -rwxr-xr-x | util/install/debian.sh | 14 |
3 files changed, 22 insertions, 12 deletions
diff --git a/platforms/chibios/platform.mk b/platforms/chibios/platform.mk index 6b298732c..1c8d43007 100644 --- a/platforms/chibios/platform.mk +++ b/platforms/chibios/platform.mk | |||
| @@ -316,7 +316,7 @@ endif | |||
| 316 | # | 316 | # |
| 317 | 317 | ||
| 318 | # Use defined stack sizes of the main thread in linker scripts | 318 | # Use defined stack sizes of the main thread in linker scripts |
| 319 | LDSYMBOLS =--defsym=__process_stack_size__=$(USE_PROCESS_STACKSIZE),--defsym=__main_stack_size__=$(USE_EXCEPTIONS_STACKSIZE) | 319 | SHARED_LDSYMBOLS = -Wl,--defsym=__process_stack_size__=$(USE_PROCESS_STACKSIZE),--defsym=__main_stack_size__=$(USE_EXCEPTIONS_STACKSIZE) |
| 320 | 320 | ||
| 321 | # Shared Compiler flags for all toolchains | 321 | # Shared Compiler flags for all toolchains |
| 322 | SHARED_CFLAGS = -fomit-frame-pointer \ | 322 | SHARED_CFLAGS = -fomit-frame-pointer \ |
| @@ -327,7 +327,6 @@ SHARED_CFLAGS = -fomit-frame-pointer \ | |||
| 327 | 327 | ||
| 328 | # Shared Linker flags for all toolchains | 328 | # Shared Linker flags for all toolchains |
| 329 | SHARED_LDFLAGS = -T $(LDSCRIPT) \ | 329 | SHARED_LDFLAGS = -T $(LDSCRIPT) \ |
| 330 | -Wl,$(LDSYMBOLS) \ | ||
| 331 | -Wl,--gc-sections \ | 330 | -Wl,--gc-sections \ |
| 332 | -nostartfiles | 331 | -nostartfiles |
| 333 | 332 | ||
| @@ -346,14 +345,18 @@ ifeq ($(strip $(MCU)), risc-v) | |||
| 346 | endif | 345 | endif |
| 347 | endif | 346 | endif |
| 348 | 347 | ||
| 349 | # Default to compiling with picolibc for RISC-V targets if available, | 348 | # Default to compiling with picolibc for RISC-V targets if available, which |
| 350 | # which is available by default on current (bullseye) debian based systems. | 349 | # is available by default on distributions based on Debian 11+. |
| 351 | ifeq ($(shell $(TOOLCHAIN)gcc --specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) | 350 | ifeq ($(shell $(TOOLCHAIN)gcc --specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) |
| 352 | # Toolchain specific Compiler flags | 351 | # Toolchain specific Compiler flags Note that we still link with our own |
| 353 | # Note that we still link with our own linker script | 352 | # linker script by providing it via the -T flag in SHARED_LDFLAGS. |
| 354 | # by providing it via the -T flag above. | ||
| 355 | TOOLCHAIN_CFLAGS = --specs=picolibc.specs | 353 | TOOLCHAIN_CFLAGS = --specs=picolibc.specs |
| 356 | 354 | ||
| 355 | # picolibc internally uses __heap_start and __heap_end instead of the | ||
| 356 | # defacto chibios linker script standard __heap_base__ and __heap_end__ | ||
| 357 | # therefore we introduce these symbols as an alias. | ||
| 358 | TOOLCHAIN_LDSYMBOLS = -Wl,--defsym=__heap_start=__heap_base__,--defsym=__heap_end=__heap_end__ | ||
| 359 | |||
| 357 | # Tell QMK that we are compiling with picolibc. | 360 | # Tell QMK that we are compiling with picolibc. |
| 358 | OPT_DEFS += -DUSE_PICOLIBC | 361 | OPT_DEFS += -DUSE_PICOLIBC |
| 359 | endif | 362 | endif |
| @@ -404,7 +407,7 @@ CFLAGS += $(SHARED_CFLAGS) $(TOOLCHAIN_CFLAGS) | |||
| 404 | CXXFLAGS += $(CFLAGS) $(SHARED_CXXFLAGS) $(TOOLCHAIN_CXXFLAGS) -fno-rtti | 407 | CXXFLAGS += $(CFLAGS) $(SHARED_CXXFLAGS) $(TOOLCHAIN_CXXFLAGS) -fno-rtti |
| 405 | 408 | ||
| 406 | # Linker flags | 409 | # Linker flags |
| 407 | LDFLAGS += $(SHARED_LDFLAGS) $(TOOLCHAIN_LDFLAGS) $(MCUFLAGS) | 410 | LDFLAGS += $(SHARED_LDFLAGS) $(SHARED_LDSYMBOLS) $(TOOLCHAIN_LDFLAGS) $(TOOLCHAIN_LDSYMBOLS) $(MCUFLAGS) |
| 408 | 411 | ||
| 409 | # Tell QMK that we are hosting it on ChibiOS. | 412 | # Tell QMK that we are hosting it on ChibiOS. |
| 410 | OPT_DEFS += -DPROTOCOL_CHIBIOS | 413 | OPT_DEFS += -DPROTOCOL_CHIBIOS |
diff --git a/platforms/chibios/syscall-fallbacks.c b/platforms/chibios/syscall-fallbacks.c index 4569879c7..7150a4632 100644 --- a/platforms/chibios/syscall-fallbacks.c +++ b/platforms/chibios/syscall-fallbacks.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | * the _reent struct has to be defined. */ | 22 | * the _reent struct has to be defined. */ |
| 23 | #if defined(USE_PICOLIBC) | 23 | #if defined(USE_PICOLIBC) |
| 24 | struct _reent; | 24 | struct _reent; |
| 25 | struct timeval; | ||
| 25 | #endif | 26 | #endif |
| 26 | 27 | ||
| 27 | #pragma GCC diagnostic ignored "-Wmissing-prototypes" | 28 | #pragma GCC diagnostic ignored "-Wmissing-prototypes" |
diff --git a/util/install/debian.sh b/util/install/debian.sh index 2a188334b..3e02919bd 100755 --- a/util/install/debian.sh +++ b/util/install/debian.sh | |||
| @@ -11,12 +11,18 @@ _qmk_install_prepare() { | |||
| 11 | _qmk_install() { | 11 | _qmk_install() { |
| 12 | echo "Installing dependencies" | 12 | echo "Installing dependencies" |
| 13 | 13 | ||
| 14 | sudo apt-get -yq install \ | 14 | sudo apt-get --quiet --yes install \ |
| 15 | build-essential clang-format diffutils gcc git unzip wget zip \ | 15 | build-essential clang-format diffutils gcc git unzip wget zip \ |
| 16 | python3-pip binutils-avr gcc-avr avr-libc binutils-arm-none-eabi \ | 16 | python3-pip binutils-avr gcc-avr avr-libc binutils-arm-none-eabi \ |
| 17 | gcc-arm-none-eabi libnewlib-arm-none-eabi avrdude dfu-programmer \ | 17 | gcc-arm-none-eabi libnewlib-arm-none-eabi avrdude dfu-programmer \ |
| 18 | dfu-util teensy-loader-cli libhidapi-hidraw0 libusb-dev \ | 18 | dfu-util teensy-loader-cli libhidapi-hidraw0 libusb-dev |
| 19 | picolibc-riscv64-unknown-elf gcc-riscv64-unknown-elf binutils-riscv64-unknown-elf | ||
| 20 | 19 | ||
| 21 | python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt | 20 | # RISC-V toolchains with picolibc support are only available for distributions based on Debian 11+. |
| 21 | if sudo apt-get install --simulate --quiet --yes picolibc-riscv64-unknown-elf gcc-riscv64-unknown-elf binutils-riscv64-unknown-elf > /dev/null 2>&1; then | ||
| 22 | sudo apt-get --quiet --yes install picolibc-riscv64-unknown-elf \ | ||
| 23 | gcc-riscv64-unknown-elf \ | ||
| 24 | binutils-riscv64-unknown-elf | ||
| 25 | fi | ||
| 26 | |||
| 27 | python3 -m pip install --user -r "$QMK_FIRMWARE_DIR"/requirements.txt | ||
| 22 | } | 28 | } |
