• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright JS Foundation and other contributors, http://js.foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15PARTICLE_FIRMWARE := $(CURDIR)/../particle/firmware
16
17JERRYDIR ?= $(CURDIR)
18JERRYHEAP  ?= 16
19
20BUILD_DIR  ?= $(JERRYDIR)/build/particle
21
22EXT_CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4
23EXT_CFLAGS += -Wno-error=format=
24
25.PHONY: jerrycore jerry-main flash clean
26
27PARTICLE_BUILD_CONFIG = \
28	 INCLUDE_DIRS=$(JERRYDIR)/jerry-core/include \
29	 LIBS=jerry-core \
30	 PLATFORM=photon \
31	 LIB_DIRS=$(BUILD_DIR)/lib \
32	 APPDIR=$(JERRYDIR)/targets/particle/source \
33	 TARGET_FILE=jerry_main \
34	 TARGET_DIR=$(BUILD_DIR) \
35	 LDFLAGS=--specs=nano.specs
36
37all: jerrycore jerry-main
38
39jerrycore:
40	mkdir -p $(BUILD_DIR)
41	cmake -B$(BUILD_DIR) -H./ \
42	 -DCMAKE_SYSTEM_NAME=MCU \
43	 -DCMAKE_SYSTEM_PROCESSOR=armv7l \
44	 -DCMAKE_C_COMPILER=arm-none-eabi-gcc \
45	 -DCMAKE_C_COMPILER_WORKS=TRUE \
46	 -DENABLE_LTO=ON \
47	 -DENABLE_ALL_IN_ONE=OFF \
48	 -DJERRY_LIBM=OFF \
49	 -DJERRY_CMDLINE=OFF \
50	 -DJERRY_PROFILE=minimal \
51	 -DENABLE_STRIP=OFF \
52	 -DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
53	 -DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP)
54
55	make -C$(BUILD_DIR) jerry-core
56
57jerry-main: jerrycore
58	$(PARTICLE_BUILD_CONFIG) make -C$(PARTICLE_FIRMWARE) -f $(PARTICLE_FIRMWARE)/makefile
59
60flash:
61	$(PARTICLE_BUILD_CONFIG) make -C$(PARTICLE_FIRMWARE)/main -f $(PARTICLE_FIRMWARE)/main/makefile program-dfu
62
63clean:
64	$(PARTICLE_BUILD_CONFIG) make -C$(PARTICLE_FIRMWARE) -f $(PARTICLE_FIRMWARE)/makefile clean
65	rm -rf $(BUILD_DIR)
66