Skip to content

Commit a1c1d42

Browse files
authored
Update Zephyr target to 2.7.0 (jerryscript-project#4838)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]
1 parent d69ac0e commit a1c1d42

File tree

9 files changed

+551
-327
lines changed

9 files changed

+551
-327
lines changed

.github/workflows/gh-actions.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ jobs:
259259
- run: make -f ./targets/mbedos5/Makefile.travis install
260260
- run: make -f ./targets/mbedos5/Makefile.travis script
261261

262-
Zephyr_Qemu_x86_Build_Test:
262+
Zephyr_STM32F4_Build_Test:
263263
runs-on: ubuntu-latest
264264
steps:
265265
- uses: actions/checkout@v2

targets/zephyr/CMakeLists.txt

+24-27
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,35 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
cmake_minimum_required(VERSION 3.8)
1514

16-
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
15+
cmake_minimum_required(VERSION 3.20.0)
16+
17+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1718
project(NONE)
1819

19-
target_sources(app PRIVATE src/main-zephyr.c src/jerry-port.c src/getline-zephyr.c)
20+
set(JERRY_BASE ${CMAKE_SOURCE_DIR}/../..)
21+
22+
# Build JerryScript
23+
execute_process(COMMAND ${JERRY_BASE}/tools/build.py
24+
--clean
25+
--lto=OFF
26+
--jerry-cmdline=OFF
27+
--jerry-math=ON
28+
--amalgam=ON
29+
--mem-heap=70
30+
--profile=es.next
31+
--compile-flag=--sysroot=${ZEPHYR_BASE}
32+
--toolchain=${JERRY_BASE}/cmake/toolchain_mcu_stm32f4.cmake)
2033

34+
# Define library targets
2135
add_library(jerry-core STATIC IMPORTED)
2236
add_library(jerry-ext STATIC IMPORTED)
23-
set_target_properties(jerry-core PROPERTIES IMPORTED_LOCATION
24-
${CMAKE_CURRENT_BINARY_DIR}/../obj/lib/libjerry-core.a)
25-
set_target_properties(jerry-core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
26-
${CMAKE_CURRENT_SOURCE_DIR}/../../jerry-core/include)
27-
set_target_properties(jerry-ext PROPERTIES IMPORTED_LOCATION
28-
${CMAKE_CURRENT_BINARY_DIR}/../obj/lib/libjerry-ext.a)
29-
set_target_properties(jerry-ext PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
30-
${CMAKE_CURRENT_SOURCE_DIR}/../../jerry-ext/include)
31-
target_link_libraries(app PUBLIC jerry-core jerry-ext)
3237

33-
zephyr_get_include_directories_for_lang_as_string(C includes)
34-
zephyr_get_system_include_directories_for_lang_as_string(C system_includes)
35-
zephyr_get_compile_definitions_for_lang_as_string(C definitions)
36-
zephyr_get_compile_options_for_lang_as_string(C options)
37-
38-
add_custom_target(
39-
outputexports
40-
COMMAND echo CC="${CMAKE_C_COMPILER}"
41-
COMMAND echo Z_CFLAGS=${system_includes} ${includes} ${definitions} ${options}
42-
COMMAND echo NOSTDINC_FLAGS=${system_includes}
43-
COMMAND echo ZEPHYRINCLUDE=${includes}
44-
COMMAND echo KBUILD_CFLAGS=${definitions} ${options}
45-
VERBATIM
46-
USES_TERMINAL
47-
)
38+
# Define include directories and archives
39+
set_target_properties(jerry-core PROPERTIES IMPORTED_LOCATION ${JERRY_BASE}/build/lib/libjerry-core.a)
40+
set_target_properties(jerry-core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${JERRY_BASE}/jerry-core/include)
41+
set_target_properties(jerry-ext PROPERTIES IMPORTED_LOCATION ${JERRY_BASE}/build/lib/libjerry-ext.a)
42+
set_target_properties(jerry-ext PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${JERRY_BASE}/jerry-ext/include)
4843

44+
target_sources(app PRIVATE src/main-zephyr.c src/getline-zephyr.c src/jerry-port.c src/jerry-module.c)
45+
target_link_libraries(app PUBLIC jerry-core jerry-ext)

targets/zephyr/Makefile.travis

+15-10
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ all:
2323

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

2828
# Install Zephyr SDK.
29-
install-zephyr-sdk:
30-
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
31-
sh ../zephyr-sdk-0.13.0-linux-x86_64-setup.run -- -y -d $(CURDIR)/../zephyr-sdk-0.13.0
29+
install-zephyr-toolchain:
30+
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
31+
sh ../zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run -- -y -d $(CURDIR)/../zephyr-toolchain-0.13.2
3232

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

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

4949

5050
## Targets for building Zephyr with JerryScript.
5151

52+
# Initialize west meta-tool
53+
init-west:
54+
west init -l $(CURDIR)/../zephyr
55+
west update hal_stm32 cmsis
56+
west zephyr-export
57+
5258
# Build the firmware (Zephyr with JerryScript).
5359
SHELL=bash
54-
script:
60+
script: init-west
5561
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr && \
56-
export ZEPHYR_SDK_INSTALL_DIR=$(CURDIR)/../zephyr-sdk-0.13.0 && \
57-
source ../zephyr/zephyr-env.sh && \
58-
$(MAKE) -f ./targets/zephyr/Makefile.zephyr BOARD=qemu_x86
62+
export ZEPHYR_SDK_INSTALL_DIR=$(CURDIR)/../zephyr-toolchain-0.13.2 && \
63+
west build -d $(CURDIR)/../build -p auto -b stm32f4_disco targets/zephyr/ -- -G'Unix Makefiles'

targets/zephyr/Makefile.zephyr

-170
This file was deleted.

0 commit comments

Comments
 (0)