From 0c95f6f8e512d88bd9ead6d6ae849d983ddcb167 Mon Sep 17 00:00:00 2001 From: Ronald Date: Sat, 31 Oct 2020 23:09:23 +0100 Subject: [PATCH 1/3] Optimize compilation and garbage-collect unused sections(functions) --- RaspberryPi_JetsonNano/c/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/RaspberryPi_JetsonNano/c/Makefile b/RaspberryPi_JetsonNano/c/Makefile index 2b6ad80..201509e 100644 --- a/RaspberryPi_JetsonNano/c/Makefile +++ b/RaspberryPi_JetsonNano/c/Makefile @@ -17,12 +17,13 @@ DEBUG = -D DEBUG USELIB_RPI = USE_WIRINGPI_LIB # USELIB_RPI = USE_DEV_LIB +LIB_RPI=-Wl,--gc-sections ifeq ($(USELIB_RPI), USE_BCM2835_LIB) - LIB_RPI = -lbcm2835 -lm + LIB_RPI += -lbcm2835 -lm else ifeq ($(USELIB_RPI), USE_WIRINGPI_LIB) - LIB_RPI = -lwiringPi -lm + LIB_RPI += -lwiringPi -lm else ifeq ($(USELIB_RPI), USE_DEV_LIB) - LIB_RPI = -lm + LIB_RPI += -lm endif DEBUG_RPI = -D $(USELIB_RPI) -D RPI @@ -42,7 +43,7 @@ JETSON: JETSON_DEV JETSON_epd TARGET = epd CC = gcc -MSG = -g -O0 -Wall +MSG = -g -O -ffunction-sections -fdata-sections -Wall CFLAGS += $(MSG) RPI_epd:${OBJ_O} From 65fe361639fa4891c1c3e13cafd5782bf26c5570 Mon Sep 17 00:00:00 2001 From: Ronald Date: Sat, 31 Oct 2020 23:13:47 +0100 Subject: [PATCH 2/3] Don't commit binaries --- RaspberryPi&JetsonNano/c/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 RaspberryPi&JetsonNano/c/.gitignore diff --git a/RaspberryPi&JetsonNano/c/.gitignore b/RaspberryPi&JetsonNano/c/.gitignore new file mode 100644 index 0000000..7f1cc0a --- /dev/null +++ b/RaspberryPi&JetsonNano/c/.gitignore @@ -0,0 +1,2 @@ +bin/ +epd From 001ebff6a09303049381fdad1ad9944c034f36e7 Mon Sep 17 00:00:00 2001 From: Ronald Date: Sun, 1 Nov 2020 00:16:03 +0100 Subject: [PATCH 3/3] automatically create the 'bin' object dir --- RaspberryPi_JetsonNano/c/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RaspberryPi_JetsonNano/c/Makefile b/RaspberryPi_JetsonNano/c/Makefile index 201509e..df7a6fe 100644 --- a/RaspberryPi_JetsonNano/c/Makefile +++ b/RaspberryPi_JetsonNano/c/Makefile @@ -54,6 +54,8 @@ JETSON_epd:${OBJ_O} echo $(@) $(CC) $(CFLAGS) $(OBJ_O) $(JETSON_DEV_C) -o $(TARGET) $(LIB_JETSONI) $(DEBUG) +$(shell mkdir -p $(DIR_BIN)) + ${DIR_BIN}/%.o:$(DIR_Examples)/%.c $(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_EPD) $(DEBUG)