kl05z-gcc/Makefile
2024-01-27 12:27:22 -05:00

22 lines
596 B
Makefile

CC=arm-none-eabi-gcc
ARCH_FLAGS=-mthumb -mcpu=cortex-m0plus
CFLAGS=$(ARCH_FLAGS) -Os -flto -ffunction-sections -fdata-sections
USE_NANO=--specs=nano.specs
USE_NOHOST=--specs=nosys.specs
STARTUP_DEFS=-D__STARTUP_COPY_MULTIPLE -D__STARTUP_CLEAR_BSS_MULTIPLE -D__START=main
SPECS=--specs=nano.specs --specs=nosys.specs
# Link for code size
GC=-Wl,--gc-sections
# Create map file
MAP=-Wl,-Map=main.map
LDSCRIPTS=-L. -T multi-ram.ld
main.axf: main.c sysinit.c startup_ARMCM0.S
$(CC) $^ $(CFLAGS) -fno-exceptions $(SPECS) $(STARTUP_DEFS) $(LDSCRIPTS) $(GC) $(MAP) -o $@
clean:
rm -f *.axf *.map