common.mk: add binary header rule

This commit is contained in:
Zack Buhman 2023-07-23 17:58:30 +00:00
parent 5f515a20d4
commit 0c7c2e663a

View File

@ -28,6 +28,17 @@ define BUILD_BINARY_O
$< $@
endef
as_obj_binary = _binary_$(subst .,_,$(subst /,_,$(basename $(1))))
define BUILD_BINARY_H
@echo $@
@echo '#pragma once' > $@
@echo '#include <stdint.h>' >> $@
@echo 'extern uint32_t $(call as_obj_binary,$@)_start __asm("$(call as_obj_binary,$@)_start");' >> $@
@echo 'extern uint32_t $(call as_obj_binary,$@)_end __asm("$(call as_obj_binary,$@)_end");' >> $@
@echo 'extern uint32_t $(call as_obj_binary,$@)_size __asm("$(call as_obj_binary,$@)_size");' >> $@
endef
%.o: %.s
$(AS) $(AARCH) $(AFLAGS) $(DEBUG) $< -o $@