123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- #########################
- # IAR Makefile for STM8 #
- #########################
- # Âçÿë èç ïðîåêòà atomthreads è ïåðåèíà÷èë.
- PROJECT=VAPC
- # Location of build tools and atomthreads sources
- EWSTM8_DIR=C:\IAR\Embedded Workbench 7.3\stm8
- EWSTM8_BIN=C:/IAR/Embedded\ Workbench\ 7.3/stm8/bin
- CC=$(EWSTM8_BIN)/iccstm8
- ASM=$(EWSTM8_BIN)/iasmstm8
- LINK=$(EWSTM8_BIN)/ilinkstm8
- HEX=$(EWSTM8_BIN)/ielftool
- FLASHTOOL=C:/STMicroelectronics/st_toolset/stvp/STVP_CmdLine.exe
- FLASHOPT=-Device=STM8L051x3
- APP_SRC = src
- LIB_SRC = lib
- # Sources pats
- vpath %.c $(APP_SRC)
- vpath %.c $(LIB_SRC)
- vpath %.c StdPerphDrv/src
- # Include paths
- INCLUDES = -I inc
- INCLUDES += -I lib
- INCLUDES += -I StdPerphDrv/inc
- # CPU part number
- PART = STM8L05X_LD_VL
- ICF = lnkstm8l051f3.icf
- LIB_MODEL = dlstm8ssn.h
- # Directory for built objects
- OUT_DIR = Out
- OBJ_DIR = $(OUT_DIR)/Obj
- LIST_DIR = $(OUT_DIR)/List
- # Models
- CODE_MODEL = small
- DATA_MODEL = medium
- # Application object files
- APP_OBJECTS = $(notdir $(patsubst %.c,%.o,$(wildcard $(APP_SRC)/*.c)))
- # Librarys object files
- LIB_OBJECTS = $(notdir $(patsubst %.c,%.o,$(wildcard $(LIB_SRC)/*.c)))
- # STM8S Peripheral driver object files
- PERIPH_OBJECTS = stm8l15x_adc.o
- #PERIPH_OBJECTS += stm8l15x_aes.o
- #PERIPH_OBJECTS += stm8l15x_beep.o
- PERIPH_OBJECTS += stm8l15x_clk.o
- #PERIPH_OBJECTS += stm8l15x_comp.o
- #PERIPH_OBJECTS += stm8l15x_dac.o
- PERIPH_OBJECTS += stm8l15x_dma.o
- PERIPH_OBJECTS += stm8l15x_exti.o
- #PERIPH_OBJECTS += stm8l15x_flash.o
- PERIPH_OBJECTS += stm8l15x_gpio.o
- #PERIPH_OBJECTS += stm8l15x_i2c.o
- #PERIPH_OBJECTS += stm8l15x_irtim.o
- PERIPH_OBJECTS += stm8l15x_itc.o
- #PERIPH_OBJECTS += stm8l15x_iwdg.o
- #PERIPH_OBJECTS += stm8l15x_lcd.o
- #PERIPH_OBJECTS += stm8l15x_pwr.o
- #PERIPH_OBJECTS += stm8l15x_rst.o
- PERIPH_OBJECTS += stm8l15x_rtc.o
- PERIPH_OBJECTS += stm8l15x_spi.o
- PERIPH_OBJECTS += stm8l15x_syscfg.o
- PERIPH_OBJECTS += stm8l15x_tim1.o
- PERIPH_OBJECTS += stm8l15x_tim2.o
- PERIPH_OBJECTS += stm8l15x_tim3.o
- PERIPH_OBJECTS += stm8l15x_tim4.o
- #PERIPH_OBJECTS += stm8l15x_tim5.o
- PERIPH_OBJECTS += stm8l15x_usart.o
- #PERIPH_OBJECTS += stm8l15x_wfe.o
- #PERIPH_OBJECTS += stm8l15x_wwdg.o
- # Collection of built objects (excluding test applications)
- ALL_OBJECTS = $(APP_OBJECTS) $(LIB_OBJECTS) $(PERIPH_OBJECTS)
- BUILT_OBJECTS = $(patsubst %,$(OUT_DIR)/%,$(ALL_OBJECTS))
- # Target application filenames (.elf) for each test object
- PROJ_ELF = $(PROJECT).elf
- PROJ_S19 = $(PROJECT).s19
- PROJ_HEX = $(PROJECT).hex
- # Search build/output directory for dependencies
- vpath %.o .\$(OBJ_DIR)
- vpath %.elf .\$(OUT_DIR)
- vpath %.hex .\$(OUT_DIR)
- # Compiler/Assembler flags
- CFLAGS = -e -Oh -D USE_STDPERIPH_DRIVER -D USE_RTOS
- CFLAGS += --code_model $(CODE_MODEL) --data_model $(DATA_MODEL)
- CFLAGS += --dlib_config "$(EWSTM8_DIR)\lib\$(LIB_MODEL)"
- CFLAGS += -D NDEBUG -D $(PART)
- CFLAGS += -lCN $(LIST_DIR) -lBN $(LIST_DIR)
- CFLAGS += --diag_suppress Pa050
- DBG_CFLAGS = -e -Ol --no_cse --no_unroll --no_inline --no_code_motion --no_tbaa
- DBG_CFLAGS += --no_cross_call --debug --code_model $(CODE_MODEL) --data_model $(DATA_MODEL)
- DBG_CFLAGS += --dlib_config "$(EWSTM8_DIR)\lib\$(LIB_MODEL)" -D $(PART)
- DBG_CFLAGS += -lC $(LIST_DIR) -lB $(LIST_DIR)
- DBG_CFLAGS += --diag_suppress Pa050
- ASMFLAGS = -M'<>' -ld $(OUT_DIR)\list --diag_suppress Pa050
- ASMFLAGS += --code_model small --data_model small
- DBG_ASMFLAGS = -M'<>' -r -ld $(OUT_DIR)\list --diag_suppress Pa050
- DBG_ASMFLAGS += --code_model $(CODE_MODEL) --data_model $(DATA_MODEL)
- LINKFLAGS = --redirect _Printf=_PrintfTinyNoMb
- LINKFLAGS += --redirect _Scanf=_ScanfSmallNoMb
- LINKFLAGS += --config "$(EWSTM8_DIR)\config\$(ICF)"
- LINKFLAGS += --config_def _CSTACK_SIZE=0x100
- LINKFLAGS += --config_def _HEAP_SIZE=0x000
- LINKFLAGS += --map $(OUT_DIR)
- LINKFLAGS += --entry __iar_program_start
- LINKFLAGS += --merge_duplicate_sections
- LINKFLAGS += --strip
- LINKFLAGS += -f "$(EWSTM8_DIR)\config\math_small.xcl"
- DBG_LINKFLAGS = --redirect _Printf=_PrintfTinyNoMb --redirect _Scanf=_ScanfSmallNoMb
- DBG_LINKFLAGS += --config "$(EWSTM8_DIR)\config\$(ICF)" --config_def
- DBG_LINKFLAGS += _CSTACK_SIZE=0x100 --config_def _HEAP_SIZE=0x000
- DBG_LINKFLAGS += --entry __iar_program_start
- #################
- # Build targets #
- #################
- # All
- all: $(OUT_DIR) $(PROJ_S19) $(PROJ_HEX)
- Release: all
- flash: all
- # Make build/output directory
- $(OUT_DIR):
- mkdir $(OUT_DIR)
- @mkdir $(OBJ_DIR)
- @mkdir $(LIST_DIR)
- # Test HEX files (one application build for each test)
- $(PROJ_S19): %.s19: $(PROJ_ELF)
- @echo
- @echo Building $@
- @$(HEX) $(OUT_DIR)/$(notdir $<) $(OUT_DIR)/$@ --srec --silent
- $(PROJ_HEX): %.hex: $(PROJ_ELF)
- @echo Building $@
- @$(HEX) $(OUT_DIR)/$(notdir $<) $(OUT_DIR)/$@ --ihex --silent
- # Test ELF files (one application build for each test)
- $(PROJ_ELF): %.elf: $(ALL_OBJECTS)
- @echo
- @echo Linking $@
- @$(LINK) $(OBJ_DIR)/*.o $(LINKFLAGS) -o $(OUT_DIR)/$@
- # All C objects builder
- $(ALL_OBJECTS): %.o: %.c
- @echo
- @echo Compiling $@
- @$(CC) $< $(CFLAGS) $(INCLUDES) -o $(OBJ_DIR)
- # Clean
- clean:
- rm -f *.o *.elf *.map *.hex *.bin *.lst *.stm8 *.s19 *.out *.s *.lst
- rm -rf $(LIST_DIR)
- rm -rf $(OBJ_DIR)
- rm -rf $(OUT_DIR)
- # Flash
- flash:
- @$(FLASHTOOL) $(FLASHOPT) -FileProg=$(OUT_DIR)\\$(PROJ_HEX)
|