diff options
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/avr.mk | 14 | ||||
-rw-r--r-- | tmk_core/common.mk | 2 | ||||
-rw-r--r-- | tmk_core/common/action.c | 2 | ||||
-rw-r--r-- | tmk_core/common/action.h | 10 | ||||
-rw-r--r-- | tmk_core/common/action_tapping.c | 8 | ||||
-rw-r--r-- | tmk_core/common/action_tapping.h | 2 | ||||
-rw-r--r-- | tmk_core/common/keycode.h | 2 | ||||
-rw-r--r-- | tmk_core/common/timer.h | 2 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/init_hooks.h | 5 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/main.c | 38 | ||||
-rw-r--r-- | tmk_core/protocol/lufa.mk | 1 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/adafruit_ble.cpp | 162 | ||||
-rw-r--r-- | tmk_core/protocol/ps2_mouse.c | 15 | ||||
-rw-r--r-- | tmk_core/rules.mk | 18 |
14 files changed, 128 insertions, 153 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index a8d01a9e8c..f5c1257712 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -105,13 +105,6 @@ endef teensy: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware $(call EXEC_TEENSY) -BATCHISP ?= batchisp - -flip: $(BUILD_DIR)/$(TARGET).hex check-size - $(BATCHISP) -hardware usb -device $(MCU) -operation erase f - $(BATCHISP) -hardware usb -device $(MCU) -operation loadbuffer $(BUILD_DIR)/$(TARGET).hex program - $(BATCHISP) -hardware usb -device $(MCU) -operation start reset 0 - DFU_PROGRAMMER ?= dfu-programmer GREP ?= grep @@ -146,13 +139,6 @@ dfu-start: $(DFU_PROGRAMMER) $(MCU) reset $(DFU_PROGRAMMER) $(MCU) start -flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep - $(COPY) $(BUILD_DIR)/$(TARGET).eep $(BUILD_DIR)/$(TARGET)eep.hex - $(BATCHISP) -hardware usb -device $(MCU) -operation memory EEPROM erase - $(BATCHISP) -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(BUILD_DIR)/$(TARGET)eep.hex program - $(BATCHISP) -hardware usb -device $(MCU) -operation start reset 0 - $(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex - dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\ $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep;\ diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 4d4272d26e..3d0b83a01c 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -162,8 +162,6 @@ ifeq ($(strip $(LINK_TIME_OPTIMIZATION_ENABLE)), yes) endif EXTRAFLAGS += -flto TMK_COMMON_DEFS += -DLINK_TIME_OPTIMIZATION_ENABLE - TMK_COMMON_DEFS += -DNO_ACTION_MACRO - TMK_COMMON_DEFS += -DNO_ACTION_FUNCTION endif # Search Path diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 74db245c12..27c0abe6fa 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -324,7 +324,7 @@ void process_action(keyrecord_t *record, action_t action) { # if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY) if ( # ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY - !get_ignore_mod_tap_interrupt(get_event_keycode(record->event)) && + !get_ignore_mod_tap_interrupt(get_event_keycode(record->event, false)) && # endif record->tap.interrupted) { dprint("mods_tap: tap: cancel: add_mods\n"); diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h index dd22023f9b..c82c9c81be 100644 --- a/tmk_core/common/action.h +++ b/tmk_core/common/action.h @@ -28,6 +28,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. extern "C" { #endif +/* Disable macro and function features when LTO is enabled, since they break */ +#ifdef LINK_TIME_OPTIMIZATION_ENABLE +# ifndef NO_ACTION_MACRO +# define NO_ACTION_MACRO +# endif +# ifndef NO_ACTION_FUNCTION +# define NO_ACTION_FUNCTION +# endif +#endif + /* tapping count and state */ typedef struct { bool interrupted : 1; diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index acce3ee515..34f08d8904 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c @@ -22,7 +22,7 @@ __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode) { return TAPPING_TERM; } # ifdef TAPPING_TERM_PER_KEY -# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_event_keycode(tapping_key.event))) +# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_event_keycode(tapping_key.event, false))) # else # define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM) # endif @@ -122,10 +122,10 @@ bool process_tapping(keyrecord_t *keyp) { # if defined(TAPPING_TERM_PER_KEY) || (TAPPING_TERM >= 500) || defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY) else if ( # ifdef TAPPING_TERM_PER_KEY - (get_tapping_term(get_event_keycode(tapping_key.event)) >= 500) && + (get_tapping_term(get_event_keycode(tapping_key.event, false)) >= 500) && # endif # ifdef PERMISSIVE_HOLD_PER_KEY - !get_permissive_hold(get_event_keycode(tapping_key.event), keyp) && + !get_permissive_hold(get_event_keycode(tapping_key.event, false), keyp) && # endif IS_RELEASED(event) && waiting_buffer_typed(event)) { debug("Tapping: End. No tap. Interfered by typing key\n"); @@ -246,7 +246,7 @@ bool process_tapping(keyrecord_t *keyp) { # if !defined(TAPPING_FORCE_HOLD) || defined(TAPPING_FORCE_HOLD_PER_KEY) if ( # ifdef TAPPING_FORCE_HOLD_PER_KEY - !get_tapping_force_hold(get_event_keycode(tapping_key.event), keyp) && + !get_tapping_force_hold(get_event_keycode(tapping_key.event, false), keyp) && # endif !tapping_key.tap.interrupted && tapping_key.tap.count > 0) { // sequential tap. diff --git a/tmk_core/common/action_tapping.h b/tmk_core/common/action_tapping.h index 509d5eabd8..5eaef1c5f0 100644 --- a/tmk_core/common/action_tapping.h +++ b/tmk_core/common/action_tapping.h @@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define WAITING_BUFFER_SIZE 8 #ifndef NO_ACTION_TAPPING -uint16_t get_event_keycode(keyevent_t event); +uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache); uint16_t get_tapping_term(uint16_t keycode); void action_tapping_process(keyrecord_t record); #endif diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index e1059fadf0..5c8ba8fe60 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -152,11 +152,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Modifiers */ #define KC_LCTL KC_LCTRL #define KC_LSFT KC_LSHIFT +#define KC_LOPT KC_LALT #define KC_LCMD KC_LGUI #define KC_LWIN KC_LGUI #define KC_RCTL KC_RCTRL #define KC_RSFT KC_RSHIFT #define KC_ALGR KC_RALT +#define KC_ROPT KC_RALT #define KC_RCMD KC_RGUI #define KC_RWIN KC_RGUI diff --git a/tmk_core/common/timer.h b/tmk_core/common/timer.h index bbaae109d0..52bc1cc671 100644 --- a/tmk_core/common/timer.h +++ b/tmk_core/common/timer.h @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # include "avr/timer_avr.h" #endif -#define TIMER_DIFF(a, b, max) ((a) >= (b) ? (a) - (b) : (max) - (b) + (a)) +#define TIMER_DIFF(a, b, max) ((max == UINT8_MAX) ? ((uint8_t)((a) - (b))) : ((max == UINT16_MAX) ? ((uint16_t)((a) - (b))) : ((max == UINT32_MAX) ? ((uint32_t)((a) - (b))) : ((a) >= (b) ? (a) - (b) : (max) + 1 - (b) + (a))))) #define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX) #define TIMER_DIFF_16(a, b) TIMER_DIFF(a, b, UINT16_MAX) #define TIMER_DIFF_32(a, b) TIMER_DIFF(a, b, UINT32_MAX) diff --git a/tmk_core/protocol/chibios/init_hooks.h b/tmk_core/protocol/chibios/init_hooks.h new file mode 100644 index 0000000000..fffced913a --- /dev/null +++ b/tmk_core/protocol/chibios/init_hooks.h @@ -0,0 +1,5 @@ +#pragma once + +// Override the initialisation functions inside the ChibiOS board.c files +#define __early_init __chibios_override___early_init +#define boardInit __chibios_override_boardInit diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 6479fd09df..61665eb6f4 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -33,6 +33,11 @@ #include "debug.h" #include "printf.h" +#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP +// Change this to be TRUE once we've migrated keyboards to the new init system +# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP FALSE +#endif + #ifdef SLEEP_LED_ENABLE # include "sleep_led.h" #endif @@ -101,6 +106,39 @@ void midi_ep_task(void); // } // } +/* Early initialisation + */ +__attribute__((weak)) void early_hardware_init_pre(void) { +#if EARLY_INIT_PERFORM_BOOTLOADER_JUMP + void enter_bootloader_mode_if_requested(void); + enter_bootloader_mode_if_requested(); +#endif // EARLY_INIT_PERFORM_BOOTLOADER_JUMP +} + +__attribute__((weak)) void early_hardware_init_post(void) {} + +__attribute__((weak)) void board_init(void) {} + +// This overrides what's normally in ChibiOS board definitions +void __early_init(void) { + early_hardware_init_pre(); + + // This is the renamed equivalent of __early_init in the board.c file + void __chibios_override___early_init(void); + __chibios_override___early_init(); + + early_hardware_init_post(); +} + +// This overrides what's normally in ChibiOS board definitions +void boardInit(void) { + // This is the renamed equivalent of boardInit in the board.c file + void __chibios_override_boardInit(void); + __chibios_override_boardInit(); + + board_init(); +} + /* Main thread */ int main(void) { diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk index d7d1d9ffcc..d87802992e 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa.mk @@ -29,6 +29,7 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) endif ifeq ($(strip $(BLUETOOTH)), AdafruitBLE) + LUFA_SRC += spi_master.c LUFA_SRC += analog.c LUFA_SRC += $(LUFA_DIR)/adafruit_ble.cpp endif diff --git a/tmk_core/protocol/lufa/adafruit_ble.cpp b/tmk_core/protocol/lufa/adafruit_ble.cpp index 7b3ffdef7a..b07407f387 100644 --- a/tmk_core/protocol/lufa/adafruit_ble.cpp +++ b/tmk_core/protocol/lufa/adafruit_ble.cpp @@ -1,15 +1,15 @@ #include "adafruit_ble.h" + #include <stdio.h> #include <stdlib.h> #include <alloca.h> -#include <util/delay.h> -#include <util/atomic.h> #include "debug.h" -#include "pincontrol.h" #include "timer.h" #include "action_util.h" #include "ringbuffer.hpp" #include <string.h> +#include "spi_master.h" +#include "wait.h" #include "analog.h" // These are the pin assignments for the 32u4 boards. @@ -27,6 +27,12 @@ # define AdafruitBleIRQPin E6 #endif +#ifndef AdafruitBleSpiClockSpeed +# define AdafruitBleSpiClockSpeed 4000000UL // SCK frequency +#endif + +#define SCK_DIVISOR (F_CPU / AdafruitBleSpiClockSpeed) + #define SAMPLE_BATTERY #define ConnectionUpdateInterval 1000 /* milliseconds */ @@ -130,10 +136,6 @@ enum ble_system_event_bits { BleSystemMidiRx = 10, }; -// The SDEP.md file says 2MHz but the web page and the sample driver -// both use 4MHz -#define SpiBusSpeed 4000000 - #define SdepTimeout 150 /* milliseconds */ #define SdepShortTimeout 10 /* milliseconds */ #define SdepBackOff 25 /* microseconds */ @@ -142,116 +144,32 @@ enum ble_system_event_bits { static bool at_command(const char *cmd, char *resp, uint16_t resplen, bool verbose, uint16_t timeout = SdepTimeout); static bool at_command_P(const char *cmd, char *resp, uint16_t resplen, bool verbose = false); -struct SPI_Settings { - uint8_t spcr, spsr; -}; - -static struct SPI_Settings spi; - -// Initialize 4Mhz MSBFIRST MODE0 -void SPI_init(struct SPI_Settings *spi) { - spi->spcr = _BV(SPE) | _BV(MSTR); -#if F_CPU == 8000000 - // For MCUs running at 8MHz (such as Feather 32U4, or 3.3V Pro Micros) we set the SPI doublespeed bit - spi->spsr = _BV(SPI2X); -#endif - - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { - // Ensure that SS is OUTPUT High - digitalWrite(B0, PinLevelHigh); - pinMode(B0, PinDirectionOutput); - - SPCR |= _BV(MSTR); - SPCR |= _BV(SPE); - pinMode(B1 /* SCK */, PinDirectionOutput); - pinMode(B2 /* MOSI */, PinDirectionOutput); - } -} - -static inline void SPI_begin(struct SPI_Settings *spi) { - SPCR = spi->spcr; - SPSR = spi->spsr; -} - -static inline uint8_t SPI_TransferByte(uint8_t data) { - SPDR = data; - asm volatile("nop"); - while (!(SPSR & _BV(SPIF))) { - ; // wait - } - return SPDR; -} - -static inline void spi_send_bytes(const uint8_t *buf, uint8_t len) { - if (len == 0) return; - const uint8_t *end = buf + len; - while (buf < end) { - SPDR = *buf; - while (!(SPSR & _BV(SPIF))) { - ; // wait - } - ++buf; - } -} - -static inline uint16_t spi_read_byte(void) { return SPI_TransferByte(0x00 /* dummy */); } - -static inline void spi_recv_bytes(uint8_t *buf, uint8_t len) { - const uint8_t *end = buf + len; - if (len == 0) return; - while (buf < end) { - SPDR = 0; // write a dummy to initiate read - while (!(SPSR & _BV(SPIF))) { - ; // wait - } - *buf = SPDR; - ++buf; - } -} - -#if 0 -static void dump_pkt(const struct sdep_msg *msg) { - print("pkt: type="); - print_hex8(msg->type); - print(" cmd="); - print_hex8(msg->cmd_high); - print_hex8(msg->cmd_low); - print(" len="); - print_hex8(msg->len); - print(" more="); - print_hex8(msg->more); - print("\n"); -} -#endif - // Send a single SDEP packet static bool sdep_send_pkt(const struct sdep_msg *msg, uint16_t timeout) { - SPI_begin(&spi); - - digitalWrite(AdafruitBleCSPin, PinLevelLow); + spi_start(AdafruitBleCSPin, false, 0, SCK_DIVISOR); uint16_t timerStart = timer_read(); bool success = false; bool ready = false; do { - ready = SPI_TransferByte(msg->type) != SdepSlaveNotReady; + ready = spi_write(msg->type) != SdepSlaveNotReady; if (ready) { break; } // Release it and let it initialize - digitalWrite(AdafruitBleCSPin, PinLevelHigh); - _delay_us(SdepBackOff); - digitalWrite(AdafruitBleCSPin, PinLevelLow); + spi_stop(); + wait_us(SdepBackOff); + spi_start(AdafruitBleCSPin, false, 0, SCK_DIVISOR); } while (timer_elapsed(timerStart) < timeout); if (ready) { // Slave is ready; send the rest of the packet - spi_send_bytes(&msg->cmd_low, sizeof(*msg) - (1 + sizeof(msg->payload)) + msg->len); + spi_transmit(&msg->cmd_low, sizeof(*msg) - (1 + sizeof(msg->payload)) + msg->len); success = true; } - digitalWrite(AdafruitBleCSPin, PinLevelHigh); + spi_stop(); return success; } @@ -275,41 +193,39 @@ static bool sdep_recv_pkt(struct sdep_msg *msg, uint16_t timeout) { bool ready = false; do { - ready = digitalRead(AdafruitBleIRQPin); + ready = readPin(AdafruitBleIRQPin); if (ready) { break; } - _delay_us(1); + wait_us(1); } while (timer_elapsed(timerStart) < timeout); if (ready) { - SPI_begin(&spi); - - digitalWrite(AdafruitBleCSPin, PinLevelLow); + spi_start(AdafruitBleCSPin, false, 0, SCK_DIVISOR); do { // Read the command type, waiting for the data to be ready - msg->type = spi_read_byte(); + msg->type = spi_read(); if (msg->type == SdepSlaveNotReady || msg->type == SdepSlaveOverflow) { // Release it and let it initialize - digitalWrite(AdafruitBleCSPin, PinLevelHigh); - _delay_us(SdepBackOff); - digitalWrite(AdafruitBleCSPin, PinLevelLow); + spi_stop(); + wait_us(SdepBackOff); + spi_start(AdafruitBleCSPin, false, 0, SCK_DIVISOR); continue; } // Read the rest of the header - spi_recv_bytes(&msg->cmd_low, sizeof(*msg) - (1 + sizeof(msg->payload))); + spi_receive(&msg->cmd_low, sizeof(*msg) - (1 + sizeof(msg->payload))); // and get the payload if there is any if (msg->len <= SdepMaxPayload) { - spi_recv_bytes(msg->payload, msg->len); + spi_receive(msg->payload, msg->len); } success = true; break; } while (timer_elapsed(timerStart) < timeout); - digitalWrite(AdafruitBleCSPin, PinLevelHigh); + spi_stop(); } return success; } @@ -320,7 +236,7 @@ static void resp_buf_read_one(bool greedy) { return; } - if (digitalRead(AdafruitBleIRQPin)) { + if (readPin(AdafruitBleIRQPin)) { struct sdep_msg msg; again: @@ -331,7 +247,7 @@ static void resp_buf_read_one(bool greedy) { dprintf("recv latency %dms\n", TIMER_DIFF_16(timer_read(), last_send)); } - if (greedy && resp_buf.peek(last_send) && digitalRead(AdafruitBleIRQPin)) { + if (greedy && resp_buf.peek(last_send) && readPin(AdafruitBleIRQPin)) { goto again; } } @@ -361,7 +277,7 @@ static void send_buf_send_one(uint16_t timeout = SdepTimeout) { dprintf("send_buf_send_one: have %d remaining\n", (int)send_buf.size()); } else { dprint("failed to send, will retry\n"); - _delay_ms(SdepTimeout); + wait_ms(SdepTimeout); resp_buf_read_one(true); } } @@ -382,20 +298,18 @@ static bool ble_init(void) { state.configured = false; state.is_connected = false; - pinMode(AdafruitBleIRQPin, PinDirectionInput); - pinMode(AdafruitBleCSPin, PinDirectionOutput); - digitalWrite(AdafruitBleCSPin, PinLevelHigh); + setPinInput(AdafruitBleIRQPin); - SPI_init(&spi); + spi_init(); // Perform a hardware reset - pinMode(AdafruitBleResetPin, PinDirectionOutput); - digitalWrite(AdafruitBleResetPin, PinLevelHigh); - digitalWrite(AdafruitBleResetPin, PinLevelLow); - _delay_ms(10); - digitalWrite(AdafruitBleResetPin, PinLevelHigh); + setPinOutput(AdafruitBleResetPin); + writePinHigh(AdafruitBleResetPin); + writePinLow(AdafruitBleResetPin); + wait_ms(10); + writePinHigh(AdafruitBleResetPin); - _delay_ms(1000); // Give it a second to initialize + wait_ms(1000); // Give it a second to initialize state.initialized = true; return state.initialized; @@ -596,7 +510,7 @@ void adafruit_ble_task(void) { resp_buf_read_one(true); send_buf_send_one(SdepShortTimeout); - if (resp_buf.empty() && (state.event_flags & UsingEvents) && digitalRead(AdafruitBleIRQPin)) { + if (resp_buf.empty() && (state.event_flags & UsingEvents) && readPin(AdafruitBleIRQPin)) { // Must be an event update if (at_command_P(PSTR("AT+EVENTSTATUS"), resbuf, sizeof(resbuf))) { uint32_t mask = strtoul(resbuf, NULL, 16); diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c index aa3a307ebf..a0e52bc7c3 100644 --- a/tmk_core/protocol/ps2_mouse.c +++ b/tmk_core/protocol/ps2_mouse.c @@ -157,6 +157,21 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) // invert coordinate of y to conform to USB HID mouse mouse_report->y = -mouse_report->y; #endif + +#ifdef PS2_MOUSE_ROTATE + int8_t x = mouse_report->x; + int8_t y = mouse_report->y; +# if PS2_MOUSE_ROTATE == 90 + mouse_report->x = y; + mouse_report->y = -x; +# elif PS2_MOUSE_ROTATE == 180 + mouse_report->x = -x; + mouse_report->y = -y; +# elif PS2_MOUSE_ROTATE == 270 + mouse_report->x = -y; + mouse_report->y = x; +# endif +#endif } static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report) { diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index c1474a5c24..f45fd37929 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -223,6 +223,12 @@ $(foreach LOBJ, $(NO_LTO_OBJ), $(eval $(call NO_LTO,$(LOBJ)))) MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@) +# For a ChibiOS build, ensure that the board files have the hook overrides injected +define BOARDSRC_INJECT_HOOKS +$(KEYBOARD_OUTPUT)/$(patsubst %.c,%.o,$(patsubst ./%,%,$1)): INIT_HOOK_CFLAGS += -include $(TOP_DIR)/tmk_core/protocol/chibios/init_hooks.h +endef +$(foreach LOBJ, $(BOARDSRC), $(eval $(call BOARDSRC_INJECT_HOOKS,$(LOBJ)))) + # Add QMK specific flags DFU_SUFFIX ?= dfu-suffix DFU_SUFFIX_ARGS ?= @@ -306,27 +312,27 @@ ifdef $1_CONFIG $1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG)) endif $1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) -$1_CXXFLAGS= $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) -$1_ASFLAGS= $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) +$1_CXXFLAGS = $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) +$1_ASFLAGS = $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) # Compile: create object files from C source files. $1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN) @mkdir -p $$(@D) @$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD) - $$(eval CMD := $$(CC) -c $$($1_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) + $$(eval CMD := $$(CC) -c $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) @$$(BUILD_CMD) # Compile: create object files from C++ source files. $1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN) @mkdir -p $$(@D) @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD) - $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) + $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) @$$(BUILD_CMD) $1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN) @mkdir -p $$(@D) @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD) - $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) + $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) @$$(BUILD_CMD) # Assemble: create object files from assembler source files. @@ -433,7 +439,7 @@ $(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null))) .PHONY : all finish sizebefore sizeafter qmkversion \ gccversion build elf hex eep lss sym coff extcoff \ clean clean_list debug gdb-config show_path \ -program teensy dfu flip dfu-ee flip-ee dfu-start \ +program teensy dfu dfu-ee dfu-start \ flash dfu-split-left dfu-split-right \ avrdude-split-left avrdude-split-right \ avrdude-loop usbasp |