Add support for hardware and board initialisation overrides. (#8330)
* Add support for hardware and board initialisation overrides. * qmk cformat. * Add some documentation. * Docs clarity. * Make early_hardware_init_pre a no-op for now, until migrations occur. * Doco update * Make distinction between keyboard and ChibiOS board in docs * Doc anchors. * Update tmk_core/protocol/chibios/main.c Co-Authored-By: Joel Challis <git@zvecr.com> * Rework bootloader entry to be off by default, allow opting-in. Co-authored-by: Joel Challis <git@zvecr.com>
This commit is contained in:
		
							parent
							
								
									17bda000f3
								
							
						
					
					
						commit
						05e9ff6554
					
				
					 5 changed files with 111 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue