mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
targets/arduino_101: Refactor to better support other Zephyr targets.
This adds support for ARM/Thumb2 (Cortex-M) architecture, tested with BOARD=qemu_cortex_m3 (i.e. QEMU with Cortex-M emulation). Should also ease porting to other architectures supported by Zephyr. This uses method of passing external libraries and link options into a Zephyr application using ALL_LIBS and LDFLAGS_zephyr make variables, as suggested by the Zephyr developers: https://gerrit.zephyrproject.org/r/#/c/2476/ , and makes sure to append to them, instead of assigning, to not overwrite important target-specific options set by the Zephyr core. JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
This commit is contained in:
parent
1c43e5b02b
commit
78186445a4
@ -51,6 +51,11 @@ KBUILD_VERBOSE = $(V)
|
||||
|
||||
APP = main-zephyr.c
|
||||
|
||||
ALL_LIBS += $(USER_LIBS)
|
||||
export ALL_LIBS
|
||||
LDFLAGS_zephyr += $(USER_LIB_INCLUDE_DIR)
|
||||
export LDFLAGS_zephyr
|
||||
|
||||
include ${ZEPHYR_BASE}/Makefile.inc
|
||||
|
||||
.PHONY = showconfig
|
||||
|
||||
@ -61,13 +61,19 @@ EXT_CFLAGS += -ffunction-sections -fno-inline-functions
|
||||
|
||||
ifeq ($(BOARD),qemu_x86)
|
||||
CONFIG_TOOLCHAIN_VARIANT = x86
|
||||
CPU = x86
|
||||
EXT_CFLAGS += -march=pentium
|
||||
EXT_CFLAGS += -mpreferred-stack-boundary=2 -mno-sse
|
||||
else ifeq ($(BOARD),qemu_cortex_m3)
|
||||
CONFIG_TOOLCHAIN_VARIANT = arm
|
||||
CPU = arm7-m
|
||||
EXT_CFLAGS += -march=armv7-m -mthumb -mcpu=cortex-m3 -mabi=aapcs
|
||||
else
|
||||
CONFIG_TOOLCHAIN_VARIANT = iamcu
|
||||
CPU = lakemont
|
||||
EXT_CFLAGS += -march=lakemont -mtune=lakemont -miamcu -msoft-float
|
||||
endif
|
||||
|
||||
EXT_CFLAGS += -mpreferred-stack-boundary=2 -mno-sse
|
||||
endif
|
||||
|
||||
EXT_CFLAGS += -Wall -Wno-format-zero-length -Wno-pointer-sign
|
||||
EXT_CFLAGS += -Werror=format -Werror=implicit-int -Wno-unused-but-set-variable
|
||||
@ -89,12 +95,12 @@ EXTERNAL_LIB = $(INTERM)/lib$(TYPE).external$(VARIETY)-entry.a
|
||||
ZEPHYR_BIN = $(OUTPUT)/zephyr/zephyr.strip
|
||||
|
||||
PREFIX = $(TYPE)$(VARIETY)
|
||||
LIBS = $(TYPE).external$(VARIETY)-entry $(PREFIX).jerry-core $(PREFIX).jerry-libm.lib $(TOOLCHAIN_LIBS) c
|
||||
LIBS = $(TYPE).external$(VARIETY)-entry $(PREFIX).jerry-core $(PREFIX).jerry-libm.lib
|
||||
|
||||
# TODO @sergioamr Change how we link the library to USER_LDFLAGS
|
||||
# https://gerrit.zephyrproject.org/r/#/c/2048/
|
||||
|
||||
BUILD_CONFIG = O="$(OUTPUT)/zephyr" V=$(V) TOOLCHAIN_LIBS="$(LIBS)" LIB_INCLUDE_DIR="$(LIB_INCLUDE_DIR)"
|
||||
BUILD_CONFIG = O="$(OUTPUT)/zephyr" V=$(V) USER_LIBS="$(LIBS)" USER_LIB_INCLUDE_DIR="-L $(CURDIR)/$(OUTPUT)"
|
||||
|
||||
.PHONY: all
|
||||
all: jerry zephyr
|
||||
@ -112,7 +118,7 @@ endif
|
||||
-DCMAKE_VERBOSE_MAKEFILE=$(V) \
|
||||
-DEXTERNAL_CMAKE_C_COMPILER=$(CC) \
|
||||
-DEXTERNAL_CMAKE_C_COMPILER_ID=GNU \
|
||||
-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=x86 \
|
||||
-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=$(CPU) \
|
||||
-DEXTERNAL_MEM_HEAP_SIZE_KB=$(JERRYHEAP) \
|
||||
-DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
|
||||
-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=lakemont \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user