Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Projekt-Name
- PROJECT = ledblink
- # Projekt-Dateien
- # Liste alle Quellcode Dateien deines Projektes hier auf
- SRC = ./Source/main.c
- SRC += ./Source/interrupt.c
- SRC += ./Source/startup.c
- # Bibliothek
- # Alle benötigten Quellcode-Dateien der Library hier aktivieren/deaktivieren
- #SRC += ./Library/src/stm32f10x_adc.c
- #SRC += ./Library/src/stm32f10x_bkp.c
- #SRC += ./Library/src/stm32f10x_can.c
- #SRC += ./Library/src/stm32f10x_crc.c
- #SRC += ./Library/src/stm32f10x_dac.c
- #SRC += ./Library/src/stm32f10x_dbgmcu.c
- #SRC += ./Library/src/stm32f10x_dma.c
- #SRC += ./Library/src/stm32f10x_exti.c
- SRC += ./Library/src/stm32f10x_flash.c
- #SRC += ./Library/src/stm32f10x_fsmc.c
- SRC += ./Library/src/stm32f10x_gpio.c
- #SRC += ./Library/src/stm32f10x_i2c.c
- #SRC += ./Library/src/stm32f10x_iwdg.c
- SRC += ./Library/src/stm32f10x_lib.c
- SRC += ./Library/src/stm32f10x_nvic.c
- #SRC += ./Library/src/stm32f10x_pwr.c
- SRC += ./Library/src/stm32f10x_rcc.c
- #SRC += ./Library/src/stm32f10x_rtc.c
- #SRC += ./Library/src/stm32f10x_sdio.c
- #SRC += ./Library/src/stm32f10x_spi.c
- #SRC += ./Library/src/stm32f10x_systick.c
- SRC += ./Library/src/stm32f10x_tim.c
- #SRC += ./Library/src/stm32f10x_usart.c
- #SRC += ./Library/src/stm32f10x_wwdg.c
- # User Include-Verzeichnisse
- UINCDIR =
- # Compiler Stuff
- # (Binaries der Toolchain)
- TRGT = arm-none-eabi-
- CC = $(TRGT)gcc
- CP = $(TRGT)objcopy
- AS = $(TRGT)gcc -x assembler-with-cpp
- SIZE = $(TRGT)size
- BIN = $(CP) -O binary
- # Andere Tools (OpenOCD zum Flashen und Debuggen)
- OPENOCD = /usr/bin/openocd
- # Optimierung
- OPT = -O0
- #OPT = -O2 -falgin-functions=16 -fno-inline -fomit-frame-pointer
- # Debug Symbole
- DEBUG = -gdwarf-2
- # # # # # # # # # # # # # # # # # # # # #
- # DONT CHANGE ANYTHING BELOW HERE
- # # # # # # # # # # # # # # # # # # # # #
- # STM32 Macro File
- # (wird immer benötigt)
- ASRC = ./Source/cortexm3_macro.s
- # Default Include-Verzeichnisse
- DINCDIR = ./
- DINCDIR += ./Source/
- DINCDIR += ./Library/inc
- # Liste aller .o-Dateien erstellen
- OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
- # Include-Pfad Liste erstellen
- INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
- # Build Flags
- # Eigenhändig aus den Build-Logs der HiTOP IDE kopiert
- ASFLAGS = -mcpu=cortex-m3 -mthumb -mfpu=vfp
- CPFLAGS = -mcpu=cortex-m3 -mthumb -mfpu=vfp $(DEBUG) $(OPT) -Wall -fsigned-char -mlittle-endian
- LDFLAGS = -T./Settings/main.ld -t -static -nostartfiles -lc -lgcc -lm
- # # # # # # # # # # # # # # # # # # # # #
- # Make-Rules
- # # # # # # # # # # # # # # # # # # # # #
- all: $(OBJS) $(PROJECT).elf $(PROJECT).bin
- # .c zu .o
- %.o : %.c
- $(CC) -c $(CPFLAGS) -I . $(INCDIR) -o $@ $<
- # .s zu .o
- %.o : %.s
- $(AS) -c $(ASFLAGS) $< -o $@
- # .elf aus .o linken
- %elf: $(OBJS)
- $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
- # flash.bin aus .elf erstellen
- %bin: %elf
- $(BIN) $< $@
- size:
- $(SIZE) $(PROJECT).elf
- flash:
- cp \$(PROJECT).bin flash.bin
- $(OPENOCD) -f ./Settings/flash.cfg
- # Cleanup
- clean:
- -rm -f $(OBJS)
- -rm -f $(SRC:.c=.c.bak)
- -rm -f $(SRC:.c=.lst)
- -rm -f $(ASRC:.s=.s.bak)
- -rm -f $(ASRC:.s=.lst)
- -rm -f $(PROJECT).elf
- -rm -f $(PROJECT).bin
- -rm -f flash.bin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement