mbed-scli test program
Makefile@1:d5669b136382, 2017-02-26 (annotated)
- Committer:
- mimi3
- Date:
- Sun Feb 26 20:26:24 2017 +0900
- Revision:
- 1:d5669b136382
- Child:
- 3:60330a83318b
added: Makefile
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mimi3 | 1:d5669b136382 | 1 | # |
mimi3 | 1:d5669b136382 | 2 | # Super light weight command line compile script using mbed-sdk sources. |
mimi3 | 1:d5669b136382 | 3 | # v0.4 |
mimi3 | 1:d5669b136382 | 4 | # 2017/02 made by dinau |
mimi3 | 1:d5669b136382 | 5 | # |
mimi3 | 1:d5669b136382 | 6 | |
mimi3 | 1:d5669b136382 | 7 | ########################## |
mimi3 | 1:d5669b136382 | 8 | # Usage |
mimi3 | 1:d5669b136382 | 9 | ########################## |
mimi3 | 1:d5669b136382 | 10 | # First, download the dependency libraries from web. |
mimi3 | 1:d5669b136382 | 11 | # $ make lib |
mimi3 | 1:d5669b136382 | 12 | # Simple build with default settings. |
mimi3 | 1:d5669b136382 | 13 | # $ make |
mimi3 | 1:d5669b136382 | 14 | # It can be changed to other target or toolchain on command line if necessary. |
mimi3 | 1:d5669b136382 | 15 | # $ make TARGET=NUCLEO_F411RE |
mimi3 | 1:d5669b136382 | 16 | # $ make TC=uARM |
mimi3 | 1:d5669b136382 | 17 | # Write *.bin file to target board. |
mimi3 | 1:d5669b136382 | 18 | # $ make f |
mimi3 | 1:d5669b136382 | 19 | # Clean all object files and rebuild target. |
mimi3 | 1:d5669b136382 | 20 | # $ make c |
mimi3 | 1:d5669b136382 | 21 | # Example, it can be used any combination on command line. |
mimi3 | 1:d5669b136382 | 22 | # $ make c f TARGET=NUCLEO_L152RE TC=uARM |
mimi3 | 1:d5669b136382 | 23 | # |
mimi3 | 1:d5669b136382 | 24 | |
mimi3 | 1:d5669b136382 | 25 | |
mimi3 | 1:d5669b136382 | 26 | ########################## |
mimi3 | 1:d5669b136382 | 27 | # Defalut setting. |
mimi3 | 1:d5669b136382 | 28 | # These are must be changed according to your environment. |
mimi3 | 1:d5669b136382 | 29 | ########################## |
mimi3 | 1:d5669b136382 | 30 | TARGET ?= NUCLEO_F030R8 |
mimi3 | 1:d5669b136382 | 31 | #TARGET ?= NUCLEO_L152RE |
mimi3 | 1:d5669b136382 | 32 | |
mimi3 | 1:d5669b136382 | 33 | # GCC_ARM or uARM or ARM |
mimi3 | 1:d5669b136382 | 34 | TC ?= GCC_ARM |
mimi3 | 1:d5669b136382 | 35 | |
mimi3 | 1:d5669b136382 | 36 | # Specify mbed flash drive |
mimi3 | 1:d5669b136382 | 37 | MBED_DRIVE = /g |
mimi3 | 1:d5669b136382 | 38 | |
mimi3 | 1:d5669b136382 | 39 | # Specify mbed root folder: [ "absolute path" or "relative path" ] |
mimi3 | 1:d5669b136382 | 40 | MBED_ROOT = /d/mbed-os |
mimi3 | 1:d5669b136382 | 41 | |
mimi3 | 1:d5669b136382 | 42 | # Specify [ "default" or "debug" or "small" ] |
mimi3 | 1:d5669b136382 | 43 | PROFILE = --profile default |
mimi3 | 1:d5669b136382 | 44 | |
mimi3 | 1:d5669b136382 | 45 | # Verbose display |
mimi3 | 1:d5669b136382 | 46 | ifeq (${v},1) |
mimi3 | 1:d5669b136382 | 47 | VERBOSE = -v |
mimi3 | 1:d5669b136382 | 48 | endif |
mimi3 | 1:d5669b136382 | 49 | |
mimi3 | 1:d5669b136382 | 50 | ########################## |
mimi3 | 1:d5669b136382 | 51 | # Fixed setting. |
mimi3 | 1:d5669b136382 | 52 | ########################## |
mimi3 | 1:d5669b136382 | 53 | # Specify "id". This is a fixed constant, don't change it. |
mimi3 | 1:d5669b136382 | 54 | PROG = MBED_A1 |
mimi3 | 1:d5669b136382 | 55 | |
mimi3 | 1:d5669b136382 | 56 | #RTOS = -rtos |
mimi3 | 1:d5669b136382 | 57 | MACROS = "-D NDEBUG=1" |
mimi3 | 1:d5669b136382 | 58 | #CFLAGS = "--cflags NDEBUG=1" |
mimi3 | 1:d5669b136382 | 59 | BUILD_DIR = .build/${TARGET}/${TC} |
mimi3 | 1:d5669b136382 | 60 | COMFLAG = --color -m ${TARGET} -t ${TC} ${VERBOSE} ${PROFILE} |
mimi3 | 1:d5669b136382 | 61 | PROG_NAME = -n ${PROG} |
mimi3 | 1:d5669b136382 | 62 | |
mimi3 | 1:d5669b136382 | 63 | ########################## |
mimi3 | 1:d5669b136382 | 64 | # Make target |
mimi3 | 1:d5669b136382 | 65 | ########################## |
mimi3 | 1:d5669b136382 | 66 | all: |
mimi3 | 1:d5669b136382 | 67 | python ${MBED_ROOT}/tools/build.py -j4 ${COMFLAG} ${RTOS} |
mimi3 | 1:d5669b136382 | 68 | python ${MBED_ROOT}/tools/make.py ${COMFLAG} ${PROG_NAME} --build ${BUILD_DIR} --source . |
mimi3 | 1:d5669b136382 | 69 | |
mimi3 | 1:d5669b136382 | 70 | .PHONY: c f lib |
mimi3 | 1:d5669b136382 | 71 | # clean and make |
mimi3 | 1:d5669b136382 | 72 | c: |
mimi3 | 1:d5669b136382 | 73 | rm -fr ${BUILD_DIR} |
mimi3 | 1:d5669b136382 | 74 | python ${MBED_ROOT}/tools/build.py -j4 ${COMFLAG} ${RTOS} -c |
mimi3 | 1:d5669b136382 | 75 | python ${MBED_ROOT}/tools/make.py ${COMFLAG} ${PROG_NAME} --build ${BUILD_DIR} --source . -c |
mimi3 | 1:d5669b136382 | 76 | |
mimi3 | 1:d5669b136382 | 77 | # copy to mbed drive |
mimi3 | 1:d5669b136382 | 78 | f: all |
mimi3 | 1:d5669b136382 | 79 | cp ${BUILD_DIR}/${notdir ${CURDIR}}.bin ${MBED_DRIVE} |
mimi3 | 1:d5669b136382 | 80 | |
mimi3 | 1:d5669b136382 | 81 | # get dependency libraries from web site. |
mimi3 | 1:d5669b136382 | 82 | lib: |
mimi3 | 1:d5669b136382 | 83 | @python makelib.py |