Maxim Integrated's IoT development kit.
Dependencies: MAX30101 MAX30003 MAX113XX_Pixi MAX30205 max32630fthr USBDevice
Diff: Makefile
- Revision:
- 1:efe9cad8942f
- Child:
- 2:68ffd74e3b5c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile Tue Mar 13 14:52:59 2018 +0300
@@ -0,0 +1,235 @@
+#/******************************************************************************
+# * Copyright (C) 2018 Maxim Integrated Products, Inc., All rights Reserved.
+# *
+# * This software is protected by copyright laws of the United States and
+# * of foreign countries. This material may also be protected by patent laws
+# * and technology transfer regulations of the United States and of foreign
+# * countries. This software is furnished under a license agreement and/or a
+# * nondisclosure agreement and may only be used or reproduced in accordance
+# * with the terms of those agreements. Dissemination of this information to
+# * any party or parties not specified in the license agreement and/or
+# * nondisclosure agreement is expressly prohibited.
+# *
+# * The above copyright notice and this permission notice shall be included
+# * in all copies or substantial portions of the Software.
+# *
+# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
+# * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# * OTHER DEALINGS IN THE SOFTWARE.
+# *
+# * Except as contained in this notice, the name of Maxim Integrated
+# * Products, Inc. shall not be used except as stated in the Maxim Integrated
+# * Products, Inc. Branding Policy.
+# *
+# * The mere transfer of this software does not imply any licenses
+# * of trade secrets, proprietary technology, copyrights, patents,
+# * trademarks, maskwork rights, or any other form of intellectual
+# * property whatsoever. Maxim Integrated Products, Inc. retains all
+# * ownership rights.
+# ******************************************************************************
+# */
+
+PROJECT_PATH=$(realpath ./)
+PROJECT_NAME=$(shell basename $(realpath ./))
+PROJECT_BUILD_PATH=$(realpath BUILD/)
+PROJECT_TOOLS_PATH=$(realpath tools/)
+PROJECT_CONFIGS_PATH=$(realpath configs/)
+PROJECT_TOOLCHAIN=GCC_ARM
+PROJECT_SCM_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
+PROJECT_SCM_HASH=$(shell git rev-parse HEAD)
+-include .config
+
+EXTERNAL_SOURCES += mbed-os
+EXTERNAL_SOURCES += USBDevice
+PROJECT_SOURCES += $(wildcard *.cpp)
+PROJECT_SOURCES += $(wildcard *.h)
+
+## BEGIN PLATFORM ##
+ifeq ($(CONFIG_PLATFORM_MAX32600MBED), y)
+CONFIG_FLAGS += PLATFORM_MAX32600MBED
+CONFIG_PLATFORM_NAME=MAX32600MBED
+
+else ifeq ($(CONFIG_PLATFORM_MAX32625MBED), y)
+CONFIG_FLAGS += PLATFORM_MAX32625MBED
+CONFIG_PLATFORM_NAME=MAX32625MBED
+PROJECT_SOURCES += max32625mbed
+
+else ifeq ($(CONFIG_PLATFORM_MAX32630FTHR), y)
+CONFIG_FLAGS += PLATFORM_MAX32630FTHR
+CONFIG_PLATFORM_NAME=MAX32630FTHR
+EXTERNAL_SOURCES += max32630fthr
+
+else ifeq ($(CONFIG_PLATFORM_MAX32625PICO), y)
+CONFIG_FLAGS += PLATFORM_MAX32625PICO
+CONFIG_PLATFORM_NAME=MAX32625PICO
+
+else
+$(warning NO MAXIM PLATFORM SELECTED)
+endif
+CONFIG_FLAGS += MAXIM_PLATFORM_NAME=\"$(CONFIG_MAXIM_PLATFORM_NAME)\"
+## END PLATFORM ##
+
+## BEGIN Maxim IoT Platform ##
+ifeq ($(CONFIG_LIBRARY_MAX30205), y)
+CONFIG_FLAGS += LIB_MAX30205
+PROJECT_SOURCES += MAX30205
+endif
+
+ifeq ($(CONFIG_LIBRARY_MAX113XX_PIXI), y)
+CONFIG_FLAGS += LIB_MAX113XX_PIXI
+PROJECT_SOURCES += MAX113XX_Pixi
+endif
+
+ifeq ($(CONFIG_LIBRARY_MAX30003), y)
+CONFIG_FLAGS += LIB_MAX30003
+PROJECT_SOURCES += MAX30003
+endif
+
+ifeq ($(CONFIG_LIBRARY_MAX30101), y)
+CONFIG_FLAGS += LIB_MAX30101
+PROJECT_SOURCES += MAX30101
+endif
+## END Maxim IoT Platform ##
+
+## BEGIN MEMORY DEBUG ##
+ifeq ($(CONFIG_ENABLE_MEMORY_DEBUG), y)
+CONFIG_FLAGS += ENABLE_MEMORY_DEBUG
+endif
+
+ifeq ($(CONFIG_MBED_HEAP_STATS_ENABLED), y)
+CONFIG_FLAGS += MBED_HEAP_STATS_ENABLED
+endif
+
+ifeq ($(CONFIG_MBED_MEM_TRACING_ENABLED), y)
+CONFIG_FLAGS += MBED_MEM_TRACING_ENABLED
+endif
+
+ifeq ($(CONFIG_MBED_STACK_STATS_ENABLED), y)
+CONFIG_FLAGS += MBED_STACK_STATS_ENABLED
+endif
+## END MEMORY DEBUG ##
+
+ifeq ($(V), 1)
+BUILD_VERBOSE = -v
+endif
+
+SRC_ARGS += $(addprefix --source $(PROJECT_PATH)/, $(EXTERNAL_SOURCES))
+SRC_ARGS += $(addprefix --source $(PROJECT_PATH)/, $(PROJECT_SOURCES))
+CFG_ARGS = $(addprefix -D, $(CONFIG_FLAGS))
+
+$(info SELECTED_CONFIG=$(CONFIG_CONFIG_NAME))
+$(info CONFIG_PLATFORM_NAME=$(CONFIG_PLATFORM_NAME) CONFIG_MAXIM_PLATFORM_NAME=$(CONFIG_MAXIM_PLATFORM_NAME) CONFIG_FLAGS=$(CONFIG_FLAGS))
+$(info PROJECT_SOURCES=$(PROJECT_SOURCES))
+$(info EXTERNAL_SOURCES=$(EXTERNAL_SOURCES))
+$(info PROJECT_SCM=$(PROJECT_SCM_BRANCH) ($(PROJECT_SCM_HASH)))
+
+
+## BEGIN MAKEFILE RULES ##
+all: pre_build ## Build the project. This will also call checkout rule if it is not called before
+ @if [ -f $(CONFIG_CONFIG_NAME) ]; then \
+ printf "NO CONFIG SELECTED!\n"; \
+ exit 1; \
+ fi;
+ @if [ ! -f .checkout ]; then \
+ $(MAKE) checkout ; \
+ fi;
+ mbed compile -t $(PROJECT_TOOLCHAIN) -m $(CONFIG_PLATFORM_NAME) $(BUILD_VERBOSE) $(CFG_ARGS) $(SRC_ARGS)
+
+debug_build:
+ mbed compile -t $(PROJECT_TOOLCHAIN) -m $(CONFIG_PLATFORM_NAME) $(BUILD_VERBOSE) $(CFG_ARGS) $(SRC_ARGS) --profile $(PROJECT_PATH)/mbed-os/tools/profiles/debug.json
+
+clean_build:
+ mbed compile -t $(PROJECT_TOOLCHAIN) -m $(CONFIG_PLATFORM_NAME) -c $(BUILD_VERBOSE) $(CFG_ARGS) $(SRC_ARGS)
+
+clean: ## Clean the project
+ rm -rf $(PROJECT_BUILD_PATH)
+
+menuconfig: ## If you want to make changes on config file for your board
+ ${PROJECT_TOOLS_PATH}/windows_kconfig/kconfig-mconf.exe Kconfig
+
+run: ## If your mbed device is connected, this will run the project on the device
+ python ${PROJECT_TOOLS_PATH}/mbed_run.py ${PROJECT_BUILD_PATH}/${CONFIG_PLATFORM_NAME}/$(PROJECT_TOOLCHAIN)/mbed-os.bin
+
+checkout: ## Checkout necessary mbed libraries for your configuration.
+ @echo "Downloading libraries"
+ mbed deploy
+ @touch .$@
+
+selectconfig.%: ## Select available config. Avilable configs are under <project_dir>/configs directory
+ @if [ -f $(PROJECT_CONFIGS_PATH)/$(word 2,$(subst ., ,$@)).config ]; then \
+ cp $(PROJECT_CONFIGS_PATH)/$(word 2,$(subst ., ,$@)).config $(PROJECT_PATH)/.config; \
+ printf "\n$(word 2,$(subst ., ,$@)).config selected\n"; \
+ else \
+ printf "\nConfig [$(word 2,$(subst ., ,$@))] is not found!\n"; \
+ printf "Available configs are:\n\n"; \
+ ls $(PROJECT_CONFIGS_PATH) | cut -d "." -f 1; \
+ printf "\n"; \
+ fi;
+
+gnuarmeclipse: ## Create projects files for eclipse
+ mbed export --ide gnuarmeclipse -m $(CONFIG_PLATFORM_NAME)
+
+saveconfig: ## Save your current configuration to <project_dir>/configs directory
+ cp $(PROJECT_PATH)/.config $(PROJECT_CONFIGS_PATH)/$(CONFIG_CONFIG_NAME).config
+
+staticcheck: ## Consecutively run RATS-2.4, Cppcheck-1.78 and VisualCodeGrepper-2.1.0 static code analyzers
+ @printf "\n\nRATS-2.4 Staic Analyzer\n"
+ @printf "=========== BEGIN =============\n"
+ ${PROJECT_TOOLS_PATH}/Rats-2.4/rats.exe --quiet -w 3 --db ${PROJECT_TOOLS_PATH}/Rats-2.4/rats-c.xml $(PROJECT_SOURCES)
+ @printf "============ END ==============\n"
+ @printf "\n\nCppcheck-1.78 Static Analyzer\n"
+ @printf "=========== BEGIN =============\n"
+ ${PROJECT_TOOLS_PATH}/Cppcheck-1.78/cppcheck.exe -q --enable=all --force $(PROJECT_SOURCES)
+ @printf "============ END ==============\n"
+ @printf "\n\nVisualCodeGrepper-2.1.0 Static Analyzer\n"
+ @printf "=========== BEGIN =============\n"
+ @cd ${PROJECT_TOOLS_PATH}/VisualCodeGrepper-2.1.0; \
+ for src in $(PROJECT_SOURCES) ; do \
+ ${PROJECT_TOOLS_PATH}/VisualCodeGrepper-2.1.0/VisualCodeGrepper.exe -c -t $(PROJECT_PATH)/$$src -r $(PROJECT_PATH)/.tmp_VCG_step.txt ; \
+ echo "" >> $(PROJECT_PATH)/.tmp_VCG_result.txt ; \
+ echo "$$src:" >> $(PROJECT_PATH)/.tmp_VCG_result.txt ; \
+ cat $(PROJECT_PATH)/.tmp_VCG_step.txt >> $(PROJECT_PATH)/.tmp_VCG_result.txt ; \
+ rm -rf $(PROJECT_PATH)/.tmp_VCG_step.txt ;\
+ done ; \
+ cat $(PROJECT_PATH)/.tmp_VCG_result.txt ; \
+ rm -rf $(PROJECT_PATH)/.tmp_VCG_result.txt
+ @printf "============ END ==============\n"
+
+doxygen: ## Generate and open Doxygen API documentation
+ mkdir -p $(PROJECT_BUILD_PATH)
+ export PROJECT_SOURCES="$(PROJECT_SOURCES)"; \
+ export PROJECT_SCM_HASH="$(PROJECT_SCM_HASH)"; \
+ doxygen doxygen.conf
+ start $(PROJECT_BUILD_PATH)/doc/html/index.html
+
+astyle: ## Run Astyle source code formatter.
+ ${PROJECT_TOOLS_PATH}/AStyle_3.0.1_windows/bin/AStyle.exe --dry-run --options=${PROJECT_TOOLS_PATH}/AStyle_3.0.1_windows/file/custom.ini $(wildcard $(PROJECT_SOURCES)*.) $(wildcard $(PROJECT_SOURCES)/*) $(wildcard $(PROJECT_SOURCES)/*/*)
+
+pre_build:
+ @echo "#ifndef __BUILD_VERSION_H__" > build_version.h
+ @echo "#define __BUILD_VERSION_H__" >> build_version.h
+ @echo "#define BUILD_SOURCE_BRANCH \"$(PROJECT_SCM_BRANCH)\"" >> build_version.h
+ @echo "#define BUILD_SOURCE_HASH \"$(PROJECT_SCM_HASH)\"" >> build_version.h
+ @echo "#endif" >> build_version.h
+
+help: ## Display this help text
+ @echo 'usage: make [target] ...'
+ @echo ''
+ @echo 'targets:'
+ @echo 'all Build the project. This will also call checkout rule if it is not called before'
+ @echo 'astyle Run Astyle source code formatter'
+ @echo 'checkout Checkout necessary mbed libraries for your configuration'
+ @echo 'clean Clean the project'
+ @echo 'doxygen Generate and open Doxygen API documentation'
+ @echo 'gnuarmeclipse Create projects files for eclipse'
+ @echo 'help Display this help text'
+ @echo 'menuconfig If you want to make changes on config file for your board'
+ @echo 'run If your mbed device is connected, this will run the project on the device'
+ @echo 'saveconfig Save your current configuration to <project_dir>/configs directory'
+ @echo 'staticcheck Consecutively run RATS-2.4, Cppcheck-1.78 and VisualCodeGrepper-2.1.0 static code analyzers'
+
+## END MAKEFILE RULES ##