initial commit

This commit is contained in:
Imants Pulkstenis
2019-11-12 23:43:53 +02:00
parent e1e104b1f7
commit 2b8c639fa2
211 changed files with 24264 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
#===============================================================
#Makefile for building MSP Code Examples in command line
#environement using the GCC Open Source Compiler for MSP430
#===============================================================
# Require DEVICE to be specified
ifndef DEVICE
$(info Please specify a device, e.g. DEVICE=MSP430F5529)
$(error unspecified device)
endif
# Require EXAMPLE to be specified
ifndef EXAMPLE
$(info Please specify an example, e.g. EXAMPLE=MSP430F55xx_adc_01)
$(error unspecified example)
endif
###################### Windows OS ######################
ifeq ($(OS),Windows_NT)
################## GCC Root Variable ###################
GCC_DIR ?= '$(HOMEDRIVE)$(HOMEPATH)/ti/gcc'
GCC_MSP_INC_DIR ?= $(GCC_DIR)/include
LDDIR := $(GCC_MSP_INC_DIR)/$(DEVICE)
RM := rd /s /q
################### Linux or Mac OS ####################
else
################## GCC Root Variable ###################
GCC_DIR ?= ~/ti/gcc
GCC_MSP_INC_DIR ?= $(GCC_DIR)/include
LDDIR := $(GCC_MSP_INC_DIR)/$(shell echo $(DEVICE) | tr A-Z a-z)
RM := rm -rf
endif
######################################
GCC_BIN_DIR ?= $(GCC_DIR)/bin
GCC_INC_DIR ?= $(GCC_DIR)/msp430-elf/include
######################################
CC := $(GCC_BIN_DIR)/msp430-elf-gcc
GDB := $(GCC_BIN_DIR)/msp430-elf-gdb
######################################
CFLAGS := -Os -D__$(DEVICE)__ -mmcu=$(DEVICE) -g -ffunction-sections -fdata-sections -DDEPRECATED
LDFLAGS := -T $(LDDIR).ld -L $(GCC_MSP_INC_DIR) -mmcu=$(DEVICE) -g -Wl,--gc-sections
INCLUDES := -I $(GCC_MSP_INC_DIR) -I $(GCC_INC_DIR)
######################################
SRC := ../C/$(EXAMPLE).c
EXOBJECT := $(EXAMPLE)/$(EXAMPLE).o
EXOUTPUT := $(EXAMPLE)/$(EXAMPLE).out
######################################
all: $(EXOUTPUT)
$(EXAMPLE):
@mkdir $(EXAMPLE)
$(EXOBJECT): ${SRC}
@echo ============================================
@echo Compiling $(EXAMPLE).c
$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
$(EXOUTPUT): $(EXAMPLE) $(EXOBJECT)
@echo ============================================
@echo Linking objects and generating output binary
$(CC) $(LDFLAGS) $(EXOBJECT) -o $@
debug: all
$(GDB) $(EXAMPLE)/$(EXAMPLE).out
clean:
@$(RM) $(EXAMPLE)
+45
View File
@@ -0,0 +1,45 @@
===============================================================
Makefile for building MSP Code Examples in command line
environement using the GCC Open Source Compiler for MSP430
Refer to MSP430 GCC User's Guide
http://www.ti.com/lit/pdf/slau646
Download GCC standalone package:
http://www.ti.com/tool/msp430-gcc-opensource
===============================================================
Makefile usage:
make DEVICE=<deviceName> EXAMPLE=<exampleName>
e.g. DEVICE=MSP430F5529 EXAMPLE=MSP430F55xx_adc_01
Debug with GDB:
make debug DEVICE=<deviceName> EXAMPLE=<exampleName>
* Before connecting to target, GDB Agent needs to be running.
* Refer to MSP430 GCC User's Guide for how to use GDB:
http://www.ti.com/lit/pdf/slau646
===============================================================
This Makefile assumes GCC standalong package is installed at the
default directory. To specify a different GCC install path, use:
make DEVICE=<deviceName> EXAMPLE=<exampleName> \
GCC_DIR=<path_To_Standalone_GCC_Root>
If using GCC installed inside Code Composer Studio, specify both
the GCC root and the MSP430 include path,
make DEVICE=<deviceName> EXAMPLE=<exampleName> \
GCC_DIR=<path_To_CCS/ccsv6/tools/compiler/gcc_msp430_version> \
GCC_MSP_INC_DIR=<path_To_CCS/ccsv6/ccs_base/msp430/include_gcc>
===============================================================