diff options
| author | Alejandro Soto <alejandro@34project.org> | 2024-05-23 20:11:08 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2024-05-24 05:58:44 -0600 |
| commit | 2008c2d4b4a7b4d1373d0b04db8ef775bb4b68ab (patch) | |
| tree | f63fb62da7a87df894cb82dc1382a1bdb6f0eb15 /mk | |
| parent | 812f3d4e9baf2e5aed0d56302707399a8abc8697 (diff) | |
mk: add bin2rel hook
Diffstat (limited to 'mk')
| -rw-r--r-- | mk/bin2rel.mk | 19 | ||||
| -rw-r--r-- | mk/top.mk | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/mk/bin2rel.mk b/mk/bin2rel.mk new file mode 100644 index 0000000..a627e54 --- /dev/null +++ b/mk/bin2rel.mk @@ -0,0 +1,19 @@ +bin2rel_src = $(call require_core_objs,$(1),bin2rel_src) +bin2rel_obj = $(call require_core_objs,$(1),bin2rel_obj) + +define hooks/bin2rel + define obj_rules + $$(call bin2rel_obj,$(1)): $$(call bin2rel_src,$(1)) $$(obj_deps) + $$(call run,BIN2REL,$$@) \ + cd $$(dir $$<) && \ + $$(core_info/$(1)/cross)ld -r -b binary -o $$(src)/$$@.data $$(notdir $$<) && \ + cd - && \ + $$(core_info/$(1)/cross)objcopy \ + --rename-section .data=.rodata,alloc,load,readonly,data,contents \ + --set-section-alignment .data=16 \ + $$@.data $$@ && \ + rm -f $$@.data + endef + + $$(eval $$(call add_obj_rules,$(1))) +endef @@ -26,6 +26,7 @@ endif $(foreach flag,$(subst $(comma),$(space),$(enable)),$(eval override enable_$(flag) := 1)) $(foreach flag,$(subst $(comma),$(space),$(disable)),$(eval override enable_$(flag) :=)) +include mk/bin2rel.mk include mk/build.mk include mk/cc.mk include mk/cocotb.mk |
