Skip to content

Commit

Permalink
Update Zephyr target to 2.7.0 (#4838)
Browse files Browse the repository at this point in the history
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]
  • Loading branch information
rtakacs authored Dec 2, 2021
1 parent d69ac0e commit a1c1d42
Show file tree
Hide file tree
Showing 9 changed files with 551 additions and 327 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ jobs:
- run: make -f ./targets/mbedos5/Makefile.travis install
- run: make -f ./targets/mbedos5/Makefile.travis script

Zephyr_Qemu_x86_Build_Test:
Zephyr_STM32F4_Build_Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
51 changes: 24 additions & 27 deletions targets/zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,35 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.8)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(NONE)

target_sources(app PRIVATE src/main-zephyr.c src/jerry-port.c src/getline-zephyr.c)
set(JERRY_BASE ${CMAKE_SOURCE_DIR}/../..)

# Build JerryScript
execute_process(COMMAND ${JERRY_BASE}/tools/build.py
--clean
--lto=OFF
--jerry-cmdline=OFF
--jerry-math=ON
--amalgam=ON
--mem-heap=70
--profile=es.next
--compile-flag=--sysroot=${ZEPHYR_BASE}
--toolchain=${JERRY_BASE}/cmake/toolchain_mcu_stm32f4.cmake)

# Define library targets
add_library(jerry-core STATIC IMPORTED)
add_library(jerry-ext STATIC IMPORTED)
set_target_properties(jerry-core PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_BINARY_DIR}/../obj/lib/libjerry-core.a)
set_target_properties(jerry-core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}/../../jerry-core/include)
set_target_properties(jerry-ext PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_BINARY_DIR}/../obj/lib/libjerry-ext.a)
set_target_properties(jerry-ext PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}/../../jerry-ext/include)
target_link_libraries(app PUBLIC jerry-core jerry-ext)

zephyr_get_include_directories_for_lang_as_string(C includes)
zephyr_get_system_include_directories_for_lang_as_string(C system_includes)
zephyr_get_compile_definitions_for_lang_as_string(C definitions)
zephyr_get_compile_options_for_lang_as_string(C options)

add_custom_target(
outputexports
COMMAND echo CC="${CMAKE_C_COMPILER}"
COMMAND echo Z_CFLAGS=${system_includes} ${includes} ${definitions} ${options}
COMMAND echo NOSTDINC_FLAGS=${system_includes}
COMMAND echo ZEPHYRINCLUDE=${includes}
COMMAND echo KBUILD_CFLAGS=${definitions} ${options}
VERBATIM
USES_TERMINAL
)
# Define include directories and archives
set_target_properties(jerry-core PROPERTIES IMPORTED_LOCATION ${JERRY_BASE}/build/lib/libjerry-core.a)
set_target_properties(jerry-core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${JERRY_BASE}/jerry-core/include)
set_target_properties(jerry-ext PROPERTIES IMPORTED_LOCATION ${JERRY_BASE}/build/lib/libjerry-ext.a)
set_target_properties(jerry-ext PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${JERRY_BASE}/jerry-ext/include)

target_sources(app PRIVATE src/main-zephyr.c src/getline-zephyr.c src/jerry-port.c src/jerry-module.c)
target_link_libraries(app PUBLIC jerry-core jerry-ext)
25 changes: 15 additions & 10 deletions targets/zephyr/Makefile.travis
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ all:

# Install tools via apt.
install-apt-get-deps:
sudo apt-get install -q -y gperf dfu-util device-tree-compiler
sudo apt-get install -q -y gperf dfu-util device-tree-compiler gcc-arm-none-eabi

# Install Zephyr SDK.
install-zephyr-sdk:
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.13.0/zephyr-sdk-0.13.0-linux-x86_64-setup.run -O ../zephyr-sdk-0.13.0-linux-x86_64-setup.run
sh ../zephyr-sdk-0.13.0-linux-x86_64-setup.run -- -y -d $(CURDIR)/../zephyr-sdk-0.13.0
install-zephyr-toolchain:
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.13.2/zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run -O ../zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run
sh ../zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run -- -y -d $(CURDIR)/../zephyr-toolchain-0.13.2

# Fetch Zephyr Project repository and install python dependencies.
install-zephyr:
git clone https://github.com/zephyrproject-rtos/zephyr.git ../zephyr -b v2.5-branch
git clone https://github.com/zephyrproject-rtos/zephyr.git ../zephyr -b v2.7.0
pip3 install -U pip
pip3 install -U setuptools
pip3 install -r ../zephyr/scripts/requirements.txt
Expand All @@ -43,16 +43,21 @@ install-cmake:
cmake --version

# Perform all the necessary (JerryScript-independent) installation steps.
install-noapt: install-zephyr-sdk install-zephyr install-cmake
install-noapt: install-zephyr-toolchain install-zephyr install-cmake
install: install-apt-get-deps install-noapt


## Targets for building Zephyr with JerryScript.

# Initialize west meta-tool
init-west:
west init -l $(CURDIR)/../zephyr
west update hal_stm32 cmsis
west zephyr-export

# Build the firmware (Zephyr with JerryScript).
SHELL=bash
script:
script: init-west
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr && \
export ZEPHYR_SDK_INSTALL_DIR=$(CURDIR)/../zephyr-sdk-0.13.0 && \
source ../zephyr/zephyr-env.sh && \
$(MAKE) -f ./targets/zephyr/Makefile.zephyr BOARD=qemu_x86
export ZEPHYR_SDK_INSTALL_DIR=$(CURDIR)/../zephyr-toolchain-0.13.2 && \
west build -d $(CURDIR)/../build -p auto -b stm32f4_disco targets/zephyr/ -- -G'Unix Makefiles'
170 changes: 0 additions & 170 deletions targets/zephyr/Makefile.zephyr

This file was deleted.

Loading

0 comments on commit a1c1d42

Please sign in to comment.