add blinky proj
This commit is contained in:
parent
d42ba1aff6
commit
e75eef8b9e
18 changed files with 680 additions and 106 deletions
|
|
@ -1,107 +1,160 @@
|
|||
# For Linux
|
||||
RM = rm -f
|
||||
RMDIR = rm -rf
|
||||
DEVNULL = /dev/null
|
||||
ECHOBLANKLINE = echo
|
||||
|
||||
#----------------
|
||||
|
||||
SYSCONFIG_TOOL ?= /home/ajit/ti/sysconfig_1.26.2/sysconfig_cli.sh
|
||||
MSPM0_SDK_INSTALL_DIR ?= $(abspath ../../mspm0-sdk)
|
||||
|
||||
CC = "arm-none-eabi-gcc"
|
||||
LNK = "arm-none-eabi-gcc"
|
||||
|
||||
SYSCONFIG_GUI_TOOL = $(dir $(SYSCONFIG_TOOL))sysconfig_gui$(suffix $(SYSCONFIG_TOOL))
|
||||
SYSCFG_CMD_STUB = $(SYSCONFIG_TOOL) --compiler gcc --product $(MSPM0_SDK_INSTALL_DIR)/.metadata/product.json
|
||||
SYSCFG_GUI_CMD_STUB = $(SYSCONFIG_GUI_TOOL) --compiler gcc --product $(MSPM0_SDK_INSTALL_DIR)/.metadata/product.json
|
||||
SYSCFG_FILES := $(shell $(SYSCFG_CMD_STUB) --listGeneratedFiles --listReferencedFiles --output . empty.syscfg)
|
||||
|
||||
SYSCFG_C_FILES = $(filter %.c,$(SYSCFG_FILES))
|
||||
SYSCFG_H_FILES = $(filter %.h,$(SYSCFG_FILES))
|
||||
SYSCFG_OPT_FILES = $(filter %.opt,$(SYSCFG_FILES))
|
||||
|
||||
OBJECTS = empty.obj $(patsubst %.c,%.obj,$(notdir $(SYSCFG_C_FILES)))
|
||||
NAME = empty
|
||||
|
||||
CFLAGS += -I. \
|
||||
$(addprefix @,$(SYSCFG_OPT_FILES)) \
|
||||
-O2 \
|
||||
@device.opt \
|
||||
"-I$(MSPM0_SDK_INSTALL_DIR)/source/third_party/CMSIS/Core/Include" \
|
||||
"-I$(MSPM0_SDK_INSTALL_DIR)/source" \
|
||||
-mcpu=cortex-m0plus \
|
||||
-march=armv6-m \
|
||||
-mthumb \
|
||||
-std=c99 \
|
||||
-mfloat-abi=soft \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-g \
|
||||
-gstrict-dwarf \
|
||||
-Wall \
|
||||
--specs=nano.specs
|
||||
|
||||
LFLAGS += "-L$(MSPM0_SDK_INSTALL_DIR)/source/ti/driverlib/lib/gcc/m0p/mspm0g1x0x_g3x0x" \
|
||||
-nostartfiles \
|
||||
-Tdevice.lds.genlibs \
|
||||
-l:driverlib.a \
|
||||
-Wl,-T,device_linker.lds \
|
||||
"-Wl,-Map,$(NAME).map" \
|
||||
"-L$(MSPM0_SDK_INSTALL_DIR)/source" \
|
||||
-L.. \
|
||||
-march=armv6-m \
|
||||
-mthumb \
|
||||
-static \
|
||||
-Wl,--gc-sections \
|
||||
"-L/usr/lib/gcc/arm-none-eabi/14.2.1/thumb/nofp" \
|
||||
-lgcc \
|
||||
-lc \
|
||||
-lm \
|
||||
--specs=nano.specs \
|
||||
--specs=nosys.specs
|
||||
|
||||
all: $(NAME).out
|
||||
|
||||
.INTERMEDIATE: syscfg
|
||||
$(SYSCFG_FILES): syscfg
|
||||
@ echo generation complete
|
||||
|
||||
syscfg: empty.syscfg
|
||||
@ echo Generating configuration files...
|
||||
@ $(SYSCFG_CMD_STUB) --output $(@D) $<
|
||||
######################################
|
||||
# target
|
||||
######################################
|
||||
TARGET = mspm0_blinky
|
||||
#PART = STM32G030xx
|
||||
#PYOCD_TARGET = stm32g030f6px
|
||||
|
||||
|
||||
# Helpful hint that the user needs to use a standalone SysConfig installation
|
||||
$(SYSCONFIG_GUI_TOOL):
|
||||
$(error $(dir $(SYSCONFIG_TOOL)) does not contain the GUI framework \
|
||||
necessary to launch the SysConfig GUI. Please set SYSCONFIG_TOOL \
|
||||
(in your SDK's imports.mak) to a standalone SysConfig installation \
|
||||
rather than one inside CCS)
|
||||
######################################
|
||||
# building variables
|
||||
######################################
|
||||
# debug build?
|
||||
DEBUG = 1
|
||||
# optimization for size
|
||||
OPT = -Os
|
||||
|
||||
syscfg-gui: empty.syscfg $(SYSCONFIG_GUI_TOOL)
|
||||
@ echo Opening SysConfig GUI
|
||||
@ $(SYSCFG_GUI_CMD_STUB) $<
|
||||
|
||||
define C_RULE
|
||||
$(basename $(notdir $(1))).obj: $(1) $(SYSCFG_H_FILES)
|
||||
@ echo Building $$@
|
||||
@ $(CC) $(CFLAGS) $$< -c -o $$@
|
||||
endef
|
||||
#######################################
|
||||
# paths
|
||||
#######################################
|
||||
# Build path
|
||||
BUILD_DIR = build
|
||||
VND_DIR = ../../mspm0-sdk
|
||||
|
||||
$(foreach c_file,$(SYSCFG_C_FILES),$(eval $(call C_RULE,$(c_file))))
|
||||
######################################
|
||||
# source
|
||||
######################################
|
||||
# C sources
|
||||
C_SOURCES += \
|
||||
$(VND_DIR)/source/ti/devices/msp/m0p/startup_system_files/gcc/startup_mspm0g350x_gcc.c \
|
||||
ti_msp_dl_config.c \
|
||||
src/main.c
|
||||
|
||||
empty.obj: src/main.c $(SYSCFG_H_FILES)
|
||||
@ echo Building $@
|
||||
@ $(CC) $(CFLAGS) $< -c -o $@
|
||||
|
||||
$(NAME).out: $(OBJECTS)
|
||||
@ echo linking $@
|
||||
@ $(LNK) $(OBJECTS) $(LFLAGS) -o $(NAME).out
|
||||
# ASM sources
|
||||
#ASM_SOURCES =
|
||||
|
||||
|
||||
#######################################
|
||||
# binaries
|
||||
#######################################
|
||||
PREFIX = arm-none-eabi-
|
||||
|
||||
CC = $(PREFIX)gcc
|
||||
CP = $(PREFIX)objcopy
|
||||
#SZ = $(PREFIX)size
|
||||
|
||||
BIN = $(CP) -O binary -S
|
||||
|
||||
#######################################
|
||||
# CFLAGS
|
||||
#######################################
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
#DEBUG_FLAGS = -gdwarf-3
|
||||
DEBUG_FLAGS = -g -gstrict-dwarf
|
||||
endif
|
||||
|
||||
# cpu
|
||||
CPU = \
|
||||
-mcpu=cortex-m0plus \
|
||||
-march=armv6-m \
|
||||
-mthumb \
|
||||
-std=c99 \
|
||||
-mfloat-abi=soft \
|
||||
|
||||
DEFINES = -D__MSPM0G3507__
|
||||
|
||||
# fpu
|
||||
FPU =
|
||||
|
||||
# float-abi
|
||||
FLOAT-ABI =
|
||||
|
||||
# mcu
|
||||
MCU = $(CPU) $(FPU) $(FLOAT-ABI)
|
||||
|
||||
# C includes
|
||||
C_INCLUDES += \
|
||||
-I. \
|
||||
-Isrc/inc \
|
||||
-I$(VND_DIR)/source/third_party/CMSIS/Core/Include \
|
||||
-I$(VND_DIR)/source
|
||||
|
||||
# compile gcc flags
|
||||
ADDN_CFLAGS = \
|
||||
-Wall \
|
||||
-fdata-sections \
|
||||
-ffunction-sections
|
||||
|
||||
CFLAGS = $(MCU) $(ADDN_CFLAGS) $(C_INCLUDES) $(DEBUG_FLAGS) $(OPT) $(DEFINES)
|
||||
|
||||
|
||||
# Generate dependency information
|
||||
#CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
||||
|
||||
|
||||
#ASFLAGS = $(MCU) $(DEBUG_FLAGS) $(OPT) -Wa,--warn
|
||||
|
||||
#######################################
|
||||
# LDFLAGS
|
||||
#######################################
|
||||
# link script
|
||||
LDSCRIPT = device_linker.lds
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS = \
|
||||
$(MCU) \
|
||||
"-L$(VND_DIR)/source/ti/driverlib/lib/gcc/m0p/mspm0g1x0x_g3x0x" \
|
||||
-l:driverlib.a \
|
||||
-T $(LDSCRIPT) \
|
||||
-nostartfiles \
|
||||
-Wl,-Map=$(BUILD_DIR)/$(TARGET).map \
|
||||
-static \
|
||||
-Wl,--gc-sections \
|
||||
"-L/usr/lib/gcc/arm-none-eabi/14.2.1/thumb/nofp" \
|
||||
-lgcc -lc -lm \
|
||||
--specs=nano.specs \
|
||||
--specs=nosys.specs \
|
||||
-Wl,--print-memory-usage \
|
||||
-Wl,--no-warn-rwx-segments
|
||||
|
||||
# default action: build all
|
||||
all: $(BUILD_DIR)/$(TARGET).elf $(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) $< -o $@
|
||||
|
||||
#$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
||||
# $(CC) -c $(ASFLAGS) $< -o $@
|
||||
|
||||
#$(LUAOBJECTS) $(OBJECTS)
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
|
||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
$(BIN) $< $@
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $@
|
||||
|
||||
#######################################
|
||||
# clean up
|
||||
#######################################
|
||||
clean:
|
||||
@ echo Cleaning...
|
||||
@ $(RM) $(OBJECTS) > $(DEVNULL) 2>&1
|
||||
@ $(RM) $(NAME).out > $(DEVNULL) 2>&1
|
||||
@ $(RM) $(NAME).map > $(DEVNULL) 2>&1
|
||||
@ $(RM) $(SYSCFG_FILES)> $(DEVNULL) 2>&1
|
||||
-rm -fR $(BUILD_DIR)
|
||||
|
||||
# *** EOF ***
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue