Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ CREATE_TEMPLATE_ARGS+=--user "src/main.{cpp,c,cc}" --user "include/main.{hpp,h,h
CREATE_TEMPLATE_ARGS+=--target v5
CREATE_TEMPLATE_ARGS+=--output bin/monolith.bin --cold_output bin/cold.package.bin --hot_output bin/hot.package.bin --cold_addr 58720256 --hot_addr 125829120

template:: patch_sdk_headers clean-template library
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure this was a mistake? It has a semantically different meaning now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeh, its just a kernel thing. If it overload it will duplicate a libpros.a in the project root directory.

Copy link
Contributor

@djava djava Dec 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the template rule in common.mk is no longer used then, since it's being overridden in user project Makefile? Can it be removed, or is it used to build the kernel? If so, should it be in the kernel's Makefile?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only being used by users. There's no template rule in the distributed makefile, only in common.mk.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so the kernel build uses this template rule here, and user project builds use the one in common.mk? Then shouldn't the one in common.mk be moved to template-Makefile? If it's not used by both, it shouldnt be in common.mk, right?

template: patch_sdk_headers clean-template library
$(VV)mkdir -p $(TEMPLATE_DIR)
@echo "Moving template files to $(TEMPLATE_DIR)"
$Dif [ $(shell uname -s) == "Darwin" ]; then \
Expand Down
12 changes: 10 additions & 2 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ LIBRARIES+=$(wildcard $(FWDIR)/*.a)
EXCLUDE_COLD_LIBRARIES+=$(FWDIR)/libc.a $(FWDIR)/libm.a
COLD_LIBRARIES=$(filter-out $(EXCLUDE_COLD_LIBRARIES), $(LIBRARIES))
wlprefix=-Wl,$(subst $(SPACE),$(COMMA),$1)
LNK_FLAGS=--gc-sections --start-group $(strip $(LIBRARIES)) -lgcc -lstdc++ --end-group -T$(FWDIR)/v5-common.ld --no-warn-rwx-segments

LVGL_LIB_FLAGS=
ifneq (,$(wildcard ./firmware/liblvgl.a))
LVGL_LIB_FLAGS=--whole-archive ./firmware/liblvgl.a --no-whole-archive
LIBRARIES:=$(filter-out ./firmware/liblvgl.a, $(LIBRARIES))
endif

LNK_FLAGS=--gc-sections --start-group $(strip $(LVGL_LIB_FLAGS) $(LIBRARIES)) -lgcc -lstdc++ --end-group -T$(FWDIR)/v5-common.ld --no-warn-rwx-segments


ASMFLAGS=$(MFLAGS) $(WARNFLAGS)
CFLAGS=$(MFLAGS) $(CPPFLAGS) $(WARNFLAGS) $(GCCFLAGS) --std=$(C_STANDARD)
Expand Down Expand Up @@ -213,7 +221,7 @@ $(LIBAR): $(call GETALLOBJ,$(EXCLUDE_SRC_FROM_LIB)) $(EXTRA_LIB_DEPS)
library: $(LIBAR)

.PHONY: template
template:: clean-template $(LIBAR)
template: clean-template $(LIBAR)
$Dpros c create-template . $(LIBNAME) $(VERSION) $(foreach file,$(TEMPLATE_FILES) $(LIBAR),--system "$(file)") --target v5 $(CREATE_TEMPLATE_FLAGS)
endif

Expand Down