initial commit
This commit is contained in:
		
						commit
						7df819dfee
					
				
					 13 changed files with 1558 additions and 0 deletions
				
			
		
							
								
								
									
										175
									
								
								myapps/blinky/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										175
									
								
								myapps/blinky/Makefile
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,175 @@ | |||
| ######################################
 | ||||
| # target
 | ||||
| ######################################
 | ||||
| TARGET = blinky | ||||
| 
 | ||||
| 
 | ||||
| ######################################
 | ||||
| # building variables
 | ||||
| ######################################
 | ||||
| # debug build?
 | ||||
| DEBUG = 1 | ||||
| # optimization for size
 | ||||
| OPT = -Os | ||||
| 
 | ||||
| 
 | ||||
| #######################################
 | ||||
| # paths
 | ||||
| #######################################
 | ||||
| # Build path
 | ||||
| BUILD_DIR = build | ||||
| 
 | ||||
| ######################################
 | ||||
| # source
 | ||||
| ######################################
 | ||||
| # C sources
 | ||||
| include emlib.mk | ||||
| C_SOURCES += \
 | ||||
| ../../platform/Device/SiliconLabs/EFR32BG22/Source/system_efr32bg22.c \ | ||||
| src/main.c | ||||
| 
 | ||||
| 
 | ||||
| # ASM sources
 | ||||
| LDLIBS1 =  \
 | ||||
| ../../platform/Device/SiliconLabs/EFR32BG22/Source/GCC/startup_efr32bg22.S | ||||
| 
 | ||||
| #######################################
 | ||||
| # binaries
 | ||||
| #######################################
 | ||||
| PREFIX = arm-none-eabi- | ||||
| 
 | ||||
| CC = $(PREFIX)gcc | ||||
| CP = $(PREFIX)objcopy | ||||
| SZ = $(PREFIX)size | ||||
| 
 | ||||
| HEX = $(CP) -O ihex | ||||
| BIN = $(CP) -O binary -S | ||||
| 
 | ||||
| #######################################
 | ||||
| # CFLAGS
 | ||||
| #######################################
 | ||||
| # cpu
 | ||||
| CPU = \
 | ||||
|  -mcpu=cortex-m33 \
 | ||||
|  -mthumb \
 | ||||
|  -mfpu=fpv5-sp-d16 \
 | ||||
|  -mfloat-abi=hard \
 | ||||
|  -std=c99 \
 | ||||
|  -Wall \
 | ||||
|  -Wextra \
 | ||||
|  -fdata-sections \
 | ||||
|  -ffunction-sections \
 | ||||
|  -fomit-frame-pointer \
 | ||||
|  -imacros sl_gcc_preinclude.h \
 | ||||
|  -mcmse | ||||
| 
 | ||||
| DEFINES = -DEFR32BG22C224F512GM32 | ||||
| 
 | ||||
| # fpu
 | ||||
| FPU =  | ||||
| 
 | ||||
| # float-abi
 | ||||
| FLOAT-ABI = | ||||
| 
 | ||||
| # mcu
 | ||||
| MCU = $(CPU) $(FPU) $(FLOAT-ABI) | ||||
| 
 | ||||
| # C includes
 | ||||
| C_INCLUDES =  \
 | ||||
|  -I include -I../../platform/CMSIS/Core/Include \
 | ||||
|  -I../../platform/Device/SiliconLabs/EFR32BG22/Include \
 | ||||
|  -I../../platform/common/inc \
 | ||||
|  -I ../../platform/common/toolchain/inc \
 | ||||
|  -I ../../platform/emlib/inc | ||||
| 
 | ||||
| # compile gcc flags
 | ||||
| CFLAGS = $(MCU) $(C_INCLUDES) $(OPT) $(DEFINES) | ||||
| 
 | ||||
| ifeq ($(DEBUG), 1) | ||||
| CFLAGS += -g | ||||
| endif | ||||
| 
 | ||||
| 
 | ||||
| # Generate dependency information <<<<<<<<<<<<<<<<<<<<<<< check
 | ||||
| CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" | ||||
| 
 | ||||
| 
 | ||||
| #######################################
 | ||||
| # LDFLAGS
 | ||||
| #######################################
 | ||||
| # link script
 | ||||
| LDSCRIPT = ../../platform/Device/SiliconLabs/EFR32BG22/Source/GCC/efr32bg22.ld | ||||
| 
 | ||||
| # libraries
 | ||||
| GROUP_START =-Wl,--start-group | ||||
| GROUP_END =-Wl,--end-group | ||||
| 
 | ||||
| PROJECT_LIBS = \
 | ||||
|  -lgcc \
 | ||||
|  -lc \
 | ||||
|  -lm \
 | ||||
|  -lnosys | ||||
| 
 | ||||
| 
 | ||||
| LIBS = $(GROUP_START) $(PROJECT_LIBS) $(GROUP_END) | ||||
| LIBDIR =  | ||||
| LDFLAGS =  \
 | ||||
|  -mcpu=cortex-m33 \
 | ||||
|  -mthumb \
 | ||||
|  -mfpu=fpv5-sp-d16 \
 | ||||
|  -mfloat-abi=hard \
 | ||||
|  -T $(LDSCRIPT) \
 | ||||
|  --specs=nano.specs \
 | ||||
|  --specs=nosys.specs \
 | ||||
|  -Xlinker -Map=$(BUILD_DIR)/$(TARGET).map \
 | ||||
|  -Wl,--gc-sections \
 | ||||
|  $(LIBS) | ||||
| 
 | ||||
| # default action: build all
 | ||||
| all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin | ||||
| 
 | ||||
| 
 | ||||
| #######################################
 | ||||
| # build the application
 | ||||
| #######################################
 | ||||
| # list of objects
 | ||||
| OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) | ||||
| vpath %.c $(sort $(dir $(C_SOURCES))) | ||||
| 
 | ||||
| # list of ASM program objects
 | ||||
| OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.S=.o))) | ||||
| vpath %.S $(sort $(dir $(ASM_SOURCES))) | ||||
| 
 | ||||
| $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) | ||||
| 	$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ | ||||
| 
 | ||||
| #$(LUAOBJECTS) $(OBJECTS)
 | ||||
| $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile | ||||
| 	$(CC) $(OBJECTS) $(LDFLAGS) $(LDLIBS1) -o $@ | ||||
| 	$(SZ) $@ | ||||
| 
 | ||||
| $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) | ||||
| 	$(HEX) $< $@ | ||||
| 	 | ||||
| $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) | ||||
| 	$(BIN) $< $@	 | ||||
| 	 | ||||
| $(BUILD_DIR): | ||||
| 	mkdir $@		 | ||||
| 
 | ||||
| #######################################
 | ||||
| # Program
 | ||||
| #######################################
 | ||||
| 
 | ||||
| #######################################
 | ||||
| # clean up
 | ||||
| #######################################
 | ||||
| clean: | ||||
| 	-rm -fR $(BUILD_DIR) | ||||
|    | ||||
| #######################################
 | ||||
| # dependencies
 | ||||
| #######################################
 | ||||
| -include $(wildcard $(BUILD_DIR)/*.d) | ||||
| 
 | ||||
| # *** EOF ***
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue