CC = arm-none-eabi-gcc # The location of the C compiler # ARMGCC_ROOT is used by some makefiles that need to know where the compiler # is installed. ARMGCC_BIN := ${shell which ${CC}} ifeq (${shell test -h ${ARMGCC_BIN} && echo "true" || echo "false"}, true) ARMGCC_ROOT := ${shell dirname ${shell readlink ${ARMGCC_BIN}}}/.. else ARMGCC_ROOT := ${shell dirname ${ARMGCC_BIN}}/.. endif OBJECTS = main.o system.o startup.o syscalls.o NAME = lab CFLAGS = -I.. -I../inc \ -D__MSP432P401R__ \ -DDeviceFamily_MSP432P401x \ -mcpu=cortex-m4 \ -march=armv7e-m \ -mthumb \ -std=c99 \ -mfloat-abi=hard \ -mfpu=fpv4-sp-d16 \ -ffunction-sections \ -fdata-sections \ -gstrict-dwarf \ -Wall \ -I$(ARMGCC_ROOT)/arm-none-eabi/include/newlib-nano \ -I$(ARMGCC_ROOT)/arm-none-eabi/include LFLAGS = -Wl,-T,../config.lds \ -Wl,-Map,$(NAME).map \ -march=armv7e-m \ -mthumb \ -mfloat-abi=hard \ -mfpu=fpv4-sp-d16 \ -static \ -Wl,--gc-sections \ -lgcc \ -lc \ -lm \ -lnosys \ --specs=nano.specs all: $(NAME).out @echo "SUCCESS: Compilation completed successfully." main.o: main.c @$(CC) $(CFLAGS) -g $< -c -o $@ system.o: ../system.c @$(CC) $(CFLAGS) $< -c -o $@ startup.o: ../startup.c @$(CC) $(CFLAGS) $< -c -o $@ syscalls.o: ../syscalls.c @$(CC) $(CFLAGS) $< -c -o $@ $(NAME).out: $(OBJECTS) @$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out clean: # Redirecting both the stderr and stdout to /dev/null @rm -f $(OBJECTS) > /dev/null 2>&1 @rm -f $(NAME).out > /dev/null 2>&1 @rm -f $(NAME).map > /dev/null 2>&1