mbed-scli test program

Dependencies:   Scheduler

Makefile

Committer:
mimi3
Date:
2017-03-05
Revision:
10:72b75743f231
Parent:
9:d5b80cd43e82

File content as of revision 10:72b75743f231:

#
# Super light weight command line compile script using mbed-sdk sources.
# v0.9 # 2017/03 made by dinau
#

##########################
# Usage
##########################
# First, download the dependency libraries from web.
#	$ make lib
# Simple build with default settings.
#	$ make
# It can be changed to other target or toolchain on command line if necessary.
# 	$ make TARGET=NUCLEO_F411RE
# 	$ make TC=uARM
# Write *.bin file to target board.
# 	$ make f
# Clean only application object files
# 	$ make c
# Clean all object files and rebuild target.
# 	$ make ca
# Display mbed library revision
# 	$ make rev
#
# Example, it can be used any combination on command line.
# 	$ make c f TARGET=NUCLEO_L152RE TC=uARM
#


##########################
# Defalut setting.
# These are must be changed according to your environment.
##########################
TARGET		?= NUCLEO_F030R8
#TARGET		?= NUCLEO_L152RE
#TARGET		?= NUCLEO_F411RE

# GCC_ARM or uARM or ARM
TC			?= GCC_ARM

# Specify mbed flash drive
MBED_DRIVE	= /g

# Specify mbed root folder: [ "absolute path" or "relative path" ]
MBED_ROOT	= c:/mbed-os

# Specify [ "default" or "debug" or "small" ]
#PROFILE		= --profile ${MBED_ROOT}/tools/profiles/release.json
#PROFILE		= --profile ${MBED_ROOT}/tools/profiles/small.json

# Verbose display
ifeq (${v},1)
VERBOSE		= -v
endif

##########################
# Fixed setting.
##########################
# Specify "id". This is a fixed constant, don't change it.
PROG		= MBED_A1

#RTOS		= -rtos
MACROS		= "-D NDEBUG=1"
#CFLAGS		= "--cflags NDEBUG=1"
BUILD_DIR	= .build/${TARGET}/${TC}
COMFLAG		= --color -m ${TARGET} -t ${TC} ${VERBOSE}  ${PROFILE}
PROG_NAME	= -n ${PROG}

##########################
# Make target
##########################
all:
	@echo ${MBED_ROOT} > mbed-root.txt
	python ${MBED_ROOT}/tools/build.py -j4 ${COMFLAG} ${RTOS}
	python ${MBED_ROOT}/tools/make.py  ${COMFLAG} ${PROG_NAME} --build ${BUILD_DIR} --source .

.PHONY: c ca cm f lib lst list rev
# clean only local
c:
	rm -fr ${BUILD_DIR}

# clean objects of mbed lib 
cm:
	rm -fr ${MBED_ROOT}/BUILD/*
	rm -fr ${MBED_ROOT}/.build/*

# clean all and make
ca: cm all

# copy to mbed drive
f: all
	cp ${BUILD_DIR}/${notdir ${CURDIR}}.bin ${MBED_DRIVE}

# get dependency libraries from web site.
lib:
	@python mlib.py

# make assembler list file
lst: list
list:
	@arm-none-eabi-objdump -Sdh ${BUILD_DIR}/${notdir ${CURDIR}}.elf > ${TARGET}-${TC}.lst

# display mbed lib revision
rev:
	@grep "e MBED_LIBRARY_VERSION" ${MBED_ROOT}/mbed.h