diff options
Diffstat (limited to 'platforms')
73 files changed, 2156 insertions, 191 deletions
diff --git a/platforms/arm_atsam/bootloader.mk b/platforms/arm_atsam/bootloader.mk index 1ec42edeb6..7e503bdca9 100644 --- a/platforms/arm_atsam/bootloader.mk +++ b/platforms/arm_atsam/bootloader.mk @@ -27,6 +27,8 @@ # the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see # which functions may be overridden. +FIRMWARE_FORMAT?=bin + ifeq ($(strip $(BOOTLOADER)), custom) OPT_DEFS += -DBOOTLOADER_CUSTOM BOOTLOADER_TYPE = custom diff --git a/platforms/atomic_util.h b/platforms/atomic_util.h index 2c95302a13..21286d72eb 100644 --- a/platforms/atomic_util.h +++ b/platforms/atomic_util.h @@ -24,9 +24,13 @@ # define ATOMIC_BLOCK _Static_assert(0, "ATOMIC_BLOCK not implemented") # define ATOMIC_BLOCK_RESTORESTATE _Static_assert(0, "ATOMIC_BLOCK_RESTORESTATE not implemented") # define ATOMIC_BLOCK_FORCEON _Static_assert(0, "ATOMIC_BLOCK_FORCEON not implemented") +# define ATOMIC_FORCEON _Static_assert(0, "ATOMIC_FORCEON not implemented") +# define ATOMIC_RESTORESTATE _Static_assert(0, "ATOMIC_RESTORESTATE not implemented") # endif #else /* do nothing atomic macro */ -# define ATOMIC_BLOCK for (uint8_t __ToDo = 1; __ToDo; __ToDo = 0) -# define ATOMIC_BLOCK_RESTORESTATE ATOMIC_BLOCK -# define ATOMIC_BLOCK_FORCEON ATOMIC_BLOCK +# define ATOMIC_BLOCK(t) for (uint8_t __ToDo = 1; __ToDo; __ToDo = 0) +# define ATOMIC_FORCEON +# define ATOMIC_RESTORESTATE +# define ATOMIC_BLOCK_RESTORESTATE ATOMIC_BLOCK(ATOMIC_RESTORESTATE) +# define ATOMIC_BLOCK_FORCEON ATOMIC_BLOCK(ATOMIC_FORCEON) #endif diff --git a/platforms/avr/bootloader.mk b/platforms/avr/bootloader.mk index 63fe635d96..36e3fd83db 100644 --- a/platforms/avr/bootloader.mk +++ b/platforms/avr/bootloader.mk @@ -37,6 +37,8 @@ # BOOTLOADER_SIZE can still be defined manually, but it's recommended # you add any possible configuration to this list +FIRMWARE_FORMAT?=hex + ifeq ($(strip $(BOOTLOADER)), custom) OPT_DEFS += -DBOOTLOADER_CUSTOM BOOTLOADER_TYPE = custom diff --git a/platforms/avr/drivers/audio_pwm_hardware.c b/platforms/avr/drivers/audio_pwm_hardware.c index 78776ee48a..2fc448ea58 100644 --- a/platforms/avr/drivers/audio_pwm_hardware.c +++ b/platforms/avr/drivers/audio_pwm_hardware.c @@ -217,7 +217,7 @@ void channel_2_stop(void) { } #endif -void audio_driver_initialize() { +void audio_driver_initialize(void) { #ifdef AUDIO1_PIN_SET channel_1_stop(); setPinOutput(AUDIO1_PIN); @@ -258,7 +258,7 @@ void audio_driver_initialize() { #endif } -void audio_driver_stop() { +void audio_driver_stop(void) { #ifdef AUDIO1_PIN_SET channel_1_stop(); #endif diff --git a/platforms/avr/mcu_selection.mk b/platforms/avr/mcu_selection.mk new file mode 100644 index 0000000000..c49818fbfb --- /dev/null +++ b/platforms/avr/mcu_selection.mk @@ -0,0 +1,95 @@ +ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647 at90usb1286 at90usb1287)) + PROTOCOL = LUFA + + # Processor frequency. + # This will define a symbol, F_CPU, in all source code files equal to the + # processor frequency in Hz. You can then use this symbol in your source code to + # calculate timings. Do NOT tack on a 'UL' at the end, this will be done + # automatically to create a 32-bit value in your source code. + # + # This will be an integer division of F_USB below, as it is sourced by + # F_USB after it has run through any CPU prescalers. Note that this value + # does not *change* the processor frequency - it should merely be updated to + # reflect the processor speed set externally so that the code can use accurate + # software delays. + F_CPU ?= 16000000 + + # LUFA specific + # + # Target architecture (see library "Board Types" documentation). + ARCH = AVR8 + + # Input clock frequency. + # This will define a symbol, F_USB, in all source code files equal to the + # input clock frequency (before any prescaling is performed) in Hz. This value may + # differ from F_CPU if prescaling is used on the latter, and is required as the + # raw input clock is fed directly to the PLL sections of the AVR for high speed + # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' + # at the end, this will be done automatically to create a 32-bit value in your + # source code. + # + # If no clock division is performed on the input clock inside the AVR (via the + # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. + F_USB ?= $(F_CPU) + + # Interrupt driven control endpoint task + ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes)) + OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + endif + ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2)) + NO_I2C = yes + endif +endif + +ifneq (,$(filter $(MCU),atmega32a)) + # MCU name for avrdude + AVRDUDE_MCU = m32 + + PROTOCOL = VUSB + + # Processor frequency. + # This will define a symbol, F_CPU, in all source code files equal to the + # processor frequency in Hz. You can then use this symbol in your source code to + # calculate timings. Do NOT tack on a 'UL' at the end, this will be done + # automatically to create a 32-bit value in your source code. + F_CPU ?= 12000000 +endif + +ifneq (,$(filter $(MCU),atmega328p)) + # MCU name for avrdude + AVRDUDE_MCU = m328p + + PROTOCOL = VUSB + + # Processor frequency. + # This will define a symbol, F_CPU, in all source code files equal to the + # processor frequency in Hz. You can then use this symbol in your source code to + # calculate timings. Do NOT tack on a 'UL' at the end, this will be done + # automatically to create a 32-bit value in your source code. + F_CPU ?= 16000000 +endif + +ifneq (,$(filter $(MCU),atmega328)) + # MCU name for avrdude + AVRDUDE_MCU = m328 + + PROTOCOL = VUSB + + # Processor frequency. + # This will define a symbol, F_CPU, in all source code files equal to the + # processor frequency in Hz. You can then use this symbol in your source code to + # calculate timings. Do NOT tack on a 'UL' at the end, this will be done + # automatically to create a 32-bit value in your source code. + F_CPU ?= 16000000 +endif + +ifneq (,$(filter $(MCU),attiny85)) + PROTOCOL = VUSB + + # Processor frequency. + # This will define a symbol, F_CPU, in all source code files equal to the + # processor frequency in Hz. You can then use this symbol in your source code to + # calculate timings. Do NOT tack on a 'UL' at the end, this will be done + # automatically to create a 32-bit value in your source code. + F_CPU ?= 16500000 +endif diff --git a/platforms/chibios/atomic_util.h b/platforms/chibios/atomic_util.h index 8975045153..234d7fd9f5 100644 --- a/platforms/chibios/atomic_util.h +++ b/platforms/chibios/atomic_util.h @@ -30,8 +30,19 @@ static __inline__ void __interrupt_enable__(const uint8_t *__s) { (void)__s; } -#define ATOMIC_BLOCK(type) for (type, __ToDo = __interrupt_disable__(); __ToDo; __ToDo = 0) -#define ATOMIC_FORCEON uint8_t sreg_save __attribute__((__cleanup__(__interrupt_enable__))) = 0 +static __inline__ syssts_t __interrupt_lock__(void) { + return chSysGetStatusAndLockX(); +} + +static __inline__ void __interrupt_unlock__(const syssts_t *__s) { + chSysRestoreStatusX(*__s); + + __asm__ volatile("" ::: "memory"); +} + +#define ATOMIC_BLOCK(type) for (type, __ToDo = 1; __ToDo; __ToDo = 0) +#define ATOMIC_FORCEON uint8_t status_save __attribute__((__cleanup__(__interrupt_enable__))) = __interrupt_disable__() +#define ATOMIC_RESTORESTATE syssts_t status_save __attribute__((__cleanup__(__interrupt_unlock__))) = __interrupt_lock__() -#define ATOMIC_BLOCK_RESTORESTATE _Static_assert(0, "ATOMIC_BLOCK_RESTORESTATE not implemented") +#define ATOMIC_BLOCK_RESTORESTATE ATOMIC_BLOCK(ATOMIC_RESTORESTATE) #define ATOMIC_BLOCK_FORCEON ATOMIC_BLOCK(ATOMIC_FORCEON) diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h index 78dcbac05c..772204ae5d 100644 --- a/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h @@ -15,7 +15,7 @@ */ #pragma once -#include_next "board.h" +#include_next <board.h> // Force B9 as input to align with qmk defaults #undef VAL_GPIOB_MODER diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/board.h b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/board.h index 30af6b0c86..81c80b2773 100644 --- a/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/board.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/board.h @@ -15,6 +15,6 @@ */ #pragma once -#include_next "board.h" +#include_next <board.h> #undef STM32_HSE_BYPASS diff --git a/platforms/chibios/boards/BONSAI_C4/configs/board.h b/platforms/chibios/boards/BONSAI_C4/configs/board.h index f1ee51c91f..372b9bb8bc 100644 --- a/platforms/chibios/boards/BONSAI_C4/configs/board.h +++ b/platforms/chibios/boards/BONSAI_C4/configs/board.h @@ -15,6 +15,6 @@ */ #pragma once -#include_next "board.h" +#include_next <board.h> #undef STM32_HSE_BYPASS
\ No newline at end of file diff --git a/platforms/chibios/boards/BONSAI_C4/configs/mcuconf.h b/platforms/chibios/boards/BONSAI_C4/configs/mcuconf.h index 2f9e627c7e..b381aed4fd 100644 --- a/platforms/chibios/boards/BONSAI_C4/configs/mcuconf.h +++ b/platforms/chibios/boards/BONSAI_C4/configs/mcuconf.h @@ -1,9 +1,12 @@ /* ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -246,4 +249,4 @@ */ #define STM32_WDG_USE_IWDG FALSE -#endif /* MCUCONF_H */
\ No newline at end of file +#endif /* MCUCONF_H */ diff --git a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/board.h b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/board.h index b4363595d0..f0e9595896 100644 --- a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/board.h +++ b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/board.h @@ -3,7 +3,7 @@ #pragma once -#include_next "board.h" +#include_next <board.h> #undef BOARD_RP_PICO_RP2040 #define BOARD_GENERIC_PROMICRO_RP2040 diff --git a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/config.h b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/config.h index 7fe9b654e1..9209e99e76 100644 --- a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/config.h +++ b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/config.h @@ -8,7 +8,7 @@ *========================**/ #if !defined(I2C_DRIVER) -# define I2C_DRIVER I2CD2 +# define I2C_DRIVER I2CD1 #endif #if !defined(I2C1_SDA_PIN) diff --git a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h index 5c0859901e..ab293c0b40 100644 --- a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h @@ -46,6 +46,7 @@ #define RP_IRQ_TIMER_ALARM1_PRIORITY 2 #define RP_IRQ_TIMER_ALARM2_PRIORITY 2 #define RP_IRQ_TIMER_ALARM3_PRIORITY 2 +#define RP_IRQ_ADC1_PRIORITY 3 #define RP_IRQ_UART0_PRIORITY 3 #define RP_IRQ_UART1_PRIORITY 3 #define RP_IRQ_SPI0_PRIORITY 2 @@ -57,7 +58,7 @@ /* * ADC driver system settings. */ -#define RP_ADC_USE_ADC1 FALSE +#define RP_ADC_USE_ADC1 TRUE /* * SIO driver system settings. diff --git a/platforms/chibios/boards/GENERIC_RP_RP2040/configs/board.h b/platforms/chibios/boards/GENERIC_RP_RP2040/configs/board.h index 052050c944..89f4f0d61c 100644 --- a/platforms/chibios/boards/GENERIC_RP_RP2040/configs/board.h +++ b/ |