@@ -60,6 +60,39 @@ $(foreach arch,$(RISCV_ARCHS),$(eval $(call PRECOMPILED_NEWLIB_RULES,riscv,riscv
60
60
$(TOCK_NEWLIB_TARGETS ) :
61
61
cd $(TOCK_USERLAND_BASE_DIR ) /lib; ./fetch-newlib.sh $(patsubst libtock-newlib-% ,% ,$* )
62
62
63
+ # ###############################################################################
64
+ # Picolib Rules
65
+ #
66
+ # These pre-compiled archives were created using the libtock-c/picolib folder.
67
+ # ###############################################################################
68
+
69
+ # Rule to ensure that the picolib libraries for an architecture exist.
70
+ #
71
+ # Need to list all libraries which are possible targets to tell make that one
72
+ # invocation of this build rule will make all the target files.
73
+ #
74
+ # Arguments:
75
+ # - $(1): Family
76
+ # - $(2): Toolchain
77
+ # - $(3): Arch
78
+ define PRECOMPILED_PICOLIB_RULES
79
+
80
+ TOCK_PICOLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/%/$(1 ) /$(2 ) /lib/$(3 ) /libc.a
81
+ TOCK_PICOLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR ) /lib/%/$(1 ) /$(2 ) /lib/$(3 ) /libm.a
82
+
83
+ endef
84
+
85
+ TOCK_PICOLIB_TARGETS :=
86
+ $(foreach arch,$(ARM_ARCHS),$(eval $(call PRECOMPILED_PICOLIB_RULES,arm,arm-none-eabi,$(arch))))
87
+ $(foreach arch,$(RISCV_ARCHS),$(eval $(call PRECOMPILED_PICOLIB_RULES,riscv,riscv64-unknown-elf,$(arch))))
88
+
89
+ # Target to download and extract picolib.
90
+ #
91
+ # % will match something like "libtock-picolib-1.8.5" which we then strip down
92
+ # to just the version with some string manipulation.
93
+ $(TOCK_PICOLIB_TARGETS ) :
94
+ cd $(TOCK_USERLAND_BASE_DIR ) /lib; ./fetch-picolib.sh $(patsubst libtock-picolib-% ,% ,$* )
95
+
63
96
# ###############################################################################
64
97
# LIBC++ Rules
65
98
#
@@ -75,7 +108,7 @@ TOCK_CXXLIB_TARGETS += $$(TOCK_USERLAND_BASE_DIR)/lib/%/$(1)/$(2)/lib/$(3)/libsu
75
108
# So this is supremely frustrating. The issue boils down to limitations of
76
109
# pattern rules in make.
77
110
#
78
- # First: pattern rules are implicitly groups, and you aren't allowed to
111
+ # First: pattern rules are implicitly groups, and you aren't allowed to
79
112
# use the :g operator to merge groups. What this means in practice is that
80
113
# if you have many targets that are all generated by the same rule (i.e.,
81
114
# our unzip creates all the library archive targets), all of the targets
0 commit comments