Created
December 22, 2022 03:01
-
-
Save typeless/01f43c150139ef3eaf52c44cdf9850d8 to your computer and use it in GitHub Desktop.
Tup Tupfile Tuprules.tup example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROOT = $(TUP_CWD) | |
BUILD = $(TUP_VARIANTDIR) | |
VENDOR_LIB_ROOT = $(ROOT)/thirdparty/mh1903 | |
PLATFORM_FLAGS += -march=armv7e-m+fp -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 | |
PLATFORM_FLAGS += -mno-thumb-interwork | |
CFLAGS += -g | |
CFLAGS += -Os | |
CFLAGS += -std=gnu11 -fplan9-extensions | |
CFLAGS += -Wall -Wextra -Werror -Wno-unused-parameter | |
CFLAGS += -fstack-protector-strong -fstack-usage | |
# FreeRTOSConfig.h | |
# portable.h: The path to the correct portmacro.h header file must be set in the compiler's include path | |
CPPFLAGS += -I$(TUP_CWD)/thirdparty/FreeRTOS/portable/GCC/ARM_CM4F | |
CPPFLAGS += -I$(TUP_CWD)/thirdparty/FreeRTOS/include | |
CPPFLAGS += -I$(ROOT) | |
CPPFLAGS += -I$(ROOT)/include | |
CFLAGS += -fsingle-precision-constant | |
CFLAGS += -ffunction-sections -fdata-sections | |
CFLAGS += -fno-common | |
CFLAGS += -ffreestanding | |
CFLAGS += -specs=nosys.specs -specs=nano.specs | |
CFLAGS += -fvisibility=hidden | |
LDFLAGS += -static | |
LDFLAGS += -L$(VENDOR_LIB_ROOT) | |
LDFLAGS += -Wl,--print-memory-usage | |
LDFLAGS += -Wl,--discard-locals -Wl,--strip-discarded | |
LDFLAGS += -Wl,--disable-multiple-abs-defs | |
LDFLAGS += -Wl,-L. -Wl,-L$(ROOT)/include/lds | |
MOD_LDFLAGS += -Wl,--gc-sections -Wl,--gc-keep-exported | |
BOOT_LDFLAGS += -Wl,--gc-sections -Wl,--gc-keep-exported | |
BOOT_LDLIBS += | |
import CC=gcc | |
import CROSS_COMPILE=arm-none-eabi- | |
import CHECK=0 | |
LDLIBS += -Bstatic -lgcc | |
!as = |> ^ AS %o^ $(CROSS_COMPILE)$(CC) $(PLATFORM_FLAGS) -fvisibility=hidden -ffreestanding -o %o -c %f |> | |
!cc = |> ^ CC %o^ $(CROSS_COMPILE)$(CC) $(PLATFORM_FLAGS) $(CFLAGS) $(CPPFLAGS) -o %o -c %f |> | %B.su | |
!lib_ld = |> ^ LD %o^ $(CROSS_COMPILE)$(CC) $(PLATFORM_FLAGS) $(LDFLAGS) -nostartfiles -nostdlib -Wl,-r -o %o %f |> | |
!mod_ld = |> ^ LD %o^ printf -- "-Wl,-R$(TUP_VARIANT_OUTPUTDIR)/%%s\n" $(mods-y) | xargs -x -t $(CROSS_COMPILE)$(CC) $(PLATFORM_FLAGS) $(LDFLAGS) $(MOD_LDFLAGS) -Wl,--check-sections -T mod.lds -Wl,-Map=$(TUP_VARIANT_OUTPUTDIR)/%d.map,--cref $(LDLIBS) -o %o %f $(LDLIBS) |> | %d.map | |
!boot_ld = |> ^ LD %o^ $(CROSS_COMPILE)$(CC) $(PLATFORM_FLAGS) $(LDFLAGS) $(BOOT_LDFLAGS) -o %o %f $(LDLIBS) $(BOOT_LDLIBS) |> | |
!out_bin = |> ^ GEN %o^ $(CROSS_COMPILE)objcopy -O binary %f %o |> | |
!out_hex = |> ^ GEN %o^ $(CROSS_COMPILE)objcopy -O ihex %f %o |> | |
!cppcheck = |> cppcheck --suppress=missingIncludeSystem --suppress=variableScope --cppcheck-build-dir=$(ROOT)/.cppcheck --library=$(ROOT)/std.cfg -q --std=c11 --enable=all -D_GNUC_ $(CPPFLAGS) %f --output-file=%o |> | ^$(ROOT)/.cppcheck |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment