f624800b84
I was forced to manually do update the following files, because otherwise they would be ignored according .gitignore settings. Probably they should be deleted from repo. Interop/.idea/compiler.xml Interop/.idea/gradle.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml Interop/.idea/modules.xml Interop/.idea/modules/Indexer/Indexer.iml Interop/.idea/modules/Runtime/Runtime.iml Interop/.idea/modules/StubGenerator/StubGenerator.iml backend.native/backend.native.iml backend.native/bc.frontend/bc.frontend.iml backend.native/cli.bc/cli.bc.iml backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt backend.native/tests/link/lib/foo.kt backend.native/tests/link/lib/foo2.kt backend.native/tests/teamcity-test.property
72 lines
1.8 KiB
Bash
Executable File
72 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
BOARD=stm32f4_disco
|
|
export ZEPHYR_BASE="PLEASE_SET_ZEPHYR_BASE"
|
|
# By default `modules` directory is installed alongside ZEPHYR_BASE
|
|
export ZEPHYR_MODULES_DIR="PLEASE_SET_ZEPHYR_MODULES_TOO"
|
|
|
|
if [ "$ZEPHYR_BASE" == "PLEASE_SET_ZEPHYR_BASE" ] ; then
|
|
echo "Please set ZEPHYR_BASE in this build.sh."
|
|
exit 1
|
|
fi
|
|
|
|
export KONAN_DATA_DIR=$HOME/.konan
|
|
export KONAN_DEPS=$KONAN_DATA_DIR/dependencies
|
|
|
|
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
if [ -z "$KONAN_HOME" ]; then
|
|
PATH="$DIR/../../dist/bin:$DIR/../../bin:$PATH"
|
|
else
|
|
PATH="$KONAN_HOME/bin:$PATH"
|
|
fi
|
|
|
|
if [ x$TARGET == x ]; then
|
|
case "$OSTYPE" in
|
|
darwin*) TOOLCHAIN=gcc-arm-none-eabi-7-2017-q4-major-mac ;;
|
|
linux*) TOOLCHAIN=gcc-arm-none-eabi-7-2017-q4-major-linux ;;
|
|
*) echo "unknown: $OSTYPE" && exit 1;;
|
|
esac
|
|
fi
|
|
|
|
GNU_ARM="$KONAN_DEPS/$TOOLCHAIN"
|
|
|
|
rm -rf $DIR/build || exit 1
|
|
mkdir -p $DIR/build && cd $DIR/build
|
|
|
|
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
|
|
export GNUARMEMB_TOOLCHAIN_PATH=$GNU_ARM
|
|
|
|
[ -f CMakeCache.txt ] || cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBOARD=$BOARD .. || exit 1
|
|
|
|
# We need generated headers to be consumed by `cinterop`,
|
|
# so we preconfigure the project with `make zephyr`.
|
|
make zephyr
|
|
|
|
. $DIR/c_interop/platforms/$BOARD.sh
|
|
|
|
rm -f program.o
|
|
|
|
mkdir -p $DIR/build/kotlin
|
|
|
|
konanc $DIR/src/main.kt \
|
|
-target zephyr_$BOARD \
|
|
-r $DIR/c_interop/platforms/build \
|
|
-l $BOARD \
|
|
-opt -g -o $DIR/build/kotlin/program || exit 1
|
|
|
|
make || exit 1
|
|
|
|
# make flash
|
|
#
|
|
# For our STM32 boards the OpenOCD unable to flash the binary,
|
|
# so we go with the following alternative utility:
|
|
|
|
echo
|
|
echo "Now run 'make 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
|