zephyr: win32 host

This commit is contained in:
Mike Sinkovsky
2018-02-28 16:11:28 +05:00
committed by alexander-gorshenev
parent 8e08bbf6bd
commit 8d7d0907fc
5 changed files with 111 additions and 2 deletions
+6
View File
@@ -34,3 +34,9 @@ dependencies.osx-zephyr_stm32f4_disco = \
gcc-arm-none-eabi-7-2017-q4-major-mac \
clang-llvm-5.0.0-darwin-macos \
target-sysroot-2-wasm
targetToolchain.mingw-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi
dependencies.mingw-zephyr_stm32f4_disco = \
msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64 \
gcc-arm-none-eabi-7-2017-q4-major-win32 \
target-sysroot-2-wasm
+3 -1
View File
@@ -15,5 +15,7 @@ set_source_files_properties(program.o PROPERTIES EXTERNAL_OBJECT true GENERATED
add_custom_command(
OUTPUT program.o
COMMAND cp kotlin/program.o program.o
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/kotlin/program.o
${CMAKE_BINARY_DIR}/program.o
)
+55
View File
@@ -0,0 +1,55 @@
@echo off
setlocal
set BOARD=stm32f4_disco
set ZEPHYR_BASE=%userprofile%\zephyr
set TOOLCHAIN=gcc-arm-none-eabi-7-2017-q4-major-win32
set DIR=%~dp0
set KONAN_USER_DIR=%userprofile%/.konan
set KONAN_DEPS=%KONAN_USER_DIR%/dependencies
set GCC_ARM=%KONAN_DEPS%/%TOOLCHAIN%
set ZEPHYR_TOOLCHAIN_VARIANT=gccarmemb
set GCCARMEMB_TOOLCHAIN_PATH=%GCC_ARM%
if defined KONAN_HOME (
set "PATH=%KONAN_HOME%\bin;%PATH%"
) else (
set "PATH=%DIR%..\..\dist\bin;%DIR%..\..\bin;%PATH%"
)
if not exist build\ (mkdir build)
cd build
if not exist CMakeCache.txt (cmake -GNinja -DBOARD=%BOARD% .. || exit /b)
:: We need generated headers to be consumed by `cinterop`,
:: so we preconfigure the project with `make zephyr`.
ninja zephyr
call %DIR%\c_interop\platforms\%BOARD%.bat
del program.o
mkdir %DIR%\build\kotlin
call konanc %DIR%/src/main.kt ^
-target zephyr_%BOARD% ^
-r %DIR%/c_interop/platforms/build ^
-l %BOARD% ^
-opt -g -o %DIR%/build/kotlin/program || exit /b
ninja || exit /b
:: ninja flash
::
:: For our STM32 boards the OpenOCD unable to flash the binary,
:: so we go with the following alternative utility:
echo.
echo Now run 'ninja flash' to flash the .bin to the card.
echo.
echo Or, if that doesn't work, like, for example if you have an stm32f4-disco,
echo run the following command:
echo st-flash --reset write build/zephyr/zephyr.bin 0x08000000
echo.
@@ -0,0 +1,46 @@
:: Copyright 2010-2017 JetBrains s.r.o.
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: 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.
:: This is board specific.
if "%BOARD%" == "" (
echo This script is to be included by build.bat
exit /b
)
:: TODO: we need a robust automated way to ask Zephyr for
:: all these $ZEPHYR_BASE based paths and the proper defines.
:: TODO: The D flag in `-copt -Dxxx` sequence is interpreted to be a jvm property,
:: so we workaround the using -Xclang.
call cinterop -def %DIR%/c_interop/platforms/%BOARD%.def ^
-pkg platform.zephyr.%BOARD% ^
-copt "-Xclang -DSTM32F407xx" ^
-copt -I%ZEPHYR_BASE%/kernel/include ^
-copt -I%ZEPHYR_BASE%/arch/arm/include ^
-copt -I%ZEPHYR_BASE%/arch/arm/soc/st_stm32/stm32f4 ^
-copt -I%ZEPHYR_BASE%/arch/arm/soc/st_stm32/stm32f4/include ^
-copt -I%ZEPHYR_BASE%/arch/arm/soc/st_stm32/include ^
-copt -I%ZEPHYR_BASE%/boards/arm/%BOARD% ^
-copt -I%ZEPHYR_BASE%/include ^
-copt -I%ZEPHYR_BASE%/include/drivers ^
-copt -I%ZEPHYR_BASE%/ext/hal/cmsis/Include ^
-copt -I%ZEPHYR_BASE%/ext/hal/st/stm32cube/stm32f4xx/soc ^
-copt -I%ZEPHYR_BASE%/ext/hal/st/stm32cube/stm32f4xx/drivers/include ^
-copt -I%ZEPHYR_BASE%/ext/hal/st/stm32cube/stm32f4xx/drivers/include/Legacy ^
-copt -I%ZEPHYR_BASE%/drivers ^
-copt -I%DIR%/build/zephyr/include/generated ^
-copt -I%DIR%/build/zephyr/include/generated/syscalls ^
-o %DIR%/c_interop/platforms/build/%BOARD% ^
-target zephyr_%BOARD% || exit /b
@@ -164,7 +164,7 @@ open class HostManager(protected val distribution: Distribution = Distribution()
KonanTarget.MINGW -> listOf(
KonanTarget.MINGW,
KonanTarget.WASM32
)
) + zephyrSubtargets
KonanTarget.MACBOOK -> listOf(
KonanTarget.MACBOOK,
KonanTarget.IPHONE,