OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 2 # Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE.md file. | 4 # BSD-style license that can be found in the LICENSE.md file. |
5 | 5 |
6 # Script to build a Dart application for the STM32F746G Discovery board. | 6 # Script to build a Dart application for the STM32F746G Discovery board. |
7 # | 7 # |
8 # In the Dartino SDK this is located in platforms/stm32f746g-discovery/bin. | 8 # In the Dartino SDK this is located in platforms/stm32f746g-discovery/bin. |
9 | 9 |
10 set -e | 10 set -e |
(...skipping 25 matching lines...) Expand all Loading... |
36 file="$(readlink "$file")" | 36 file="$(readlink "$file")" |
37 done | 37 done |
38 echo "$file" | 38 echo "$file" |
39 } | 39 } |
40 | 40 |
41 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 41 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
42 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 42 PROG_NAME="$(follow_links "$BASH_SOURCE")" |
43 | 43 |
44 ### TODO(sgjesse): Maybe source this part | 44 ### TODO(sgjesse): Maybe source this part |
45 | 45 |
46 # Handle the case where fletch-sdk/bin has been symlinked to. | 46 # Handle the case where dartino-sdk/bin has been symlinked to. |
47 SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | 47 SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
48 | 48 |
49 # Root of the Dartino SDK, that is, $SCRIPT_DIR/../../... | 49 # Root of the Dartino SDK, that is, $SCRIPT_DIR/../../... |
50 DARTINO_SDK_DIR=$SCRIPT_DIR | 50 DARTINO_SDK_DIR=$SCRIPT_DIR |
51 DARTINO_SDK_DIR="$(dirname "$DARTINO_SDK_DIR")" | 51 DARTINO_SDK_DIR="$(dirname "$DARTINO_SDK_DIR")" |
52 DARTINO_SDK_DIR="$(dirname "$DARTINO_SDK_DIR")" | 52 DARTINO_SDK_DIR="$(dirname "$DARTINO_SDK_DIR")" |
53 DARTINO_SDK_DIR="$(dirname "$DARTINO_SDK_DIR")" | 53 DARTINO_SDK_DIR="$(dirname "$DARTINO_SDK_DIR")" |
54 | 54 |
55 # Location of the GCC ARM embedded toolchain in the Fletch SDK. | 55 # Location of the GCC ARM embedded toolchain in the Dartino SDK. |
56 TOOLCHAIN_DIR="$DARTINO_SDK_DIR/tools/gcc-arm-embedded" | 56 TOOLCHAIN_DIR="$DARTINO_SDK_DIR/tools/gcc-arm-embedded" |
57 | 57 |
58 # Location of the Dartino executable. | 58 # Location of the Dartino executable. |
59 DARTINO="$DARTINO_SDK_DIR/bin/fletch" | 59 DARTINO="$DARTINO_SDK_DIR/bin/dartino" |
60 | 60 |
61 # Location of the static libraries to link with. | 61 # Location of the static libraries to link with. |
62 LIB_DIR="$DARTINO_SDK_DIR/platforms/stm32f746g-discovery/lib" | 62 LIB_DIR="$DARTINO_SDK_DIR/platforms/stm32f746g-discovery/lib" |
63 | 63 |
64 # The linker script to use. | 64 # The linker script to use. |
65 CONFIG_DIR="$DARTINO_SDK_DIR/platforms/stm32f746g-discovery/config" | 65 CONFIG_DIR="$DARTINO_SDK_DIR/platforms/stm32f746g-discovery/config" |
66 LINKER_SCRIPT="$CONFIG_DIR/stm32f746g-discovery.ld" | 66 LINKER_SCRIPT="$CONFIG_DIR/stm32f746g-discovery.ld" |
67 | 67 |
68 # TODO(sgjesse): Figure out the build dir to use. | 68 # TODO(sgjesse): Figure out the build dir to use. |
69 BUILD_DIR=. | 69 BUILD_DIR=. |
70 | 70 |
71 # If we are not in a Dartino SDK, assume a Dartino SDK Github checkout. | 71 # If we are not in a Dartino SDK, assume a Dartino SDK Github checkout. |
72 if [ ! -d "$TOOLCHAIN_DIR" ]; then | 72 if [ ! -d "$TOOLCHAIN_DIR" ]; then |
73 # Relative locations in Dartino SDK and Dartino SDK Github checkout | 73 # Relative locations in Dartino SDK and Dartino SDK Github checkout |
74 # are the same. | 74 # are the same. |
75 DARTINO_CHECKOUT_DIR=$DARTINO_SDK_DIR | 75 DARTINO_CHECKOUT_DIR=$DARTINO_SDK_DIR |
76 # Location of the GCC ARM embedded toolchain in a Dartino SDK Github | 76 # Location of the GCC ARM embedded toolchain in a Dartino SDK Github |
77 # checkout. | 77 # checkout. |
78 TOOLCHAIN_DIR="$DARTINO_CHECKOUT_DIR/third_party/gcc-arm-embedded/$OS/gcc-arm-
embedded" | 78 TOOLCHAIN_DIR="$DARTINO_CHECKOUT_DIR/third_party/gcc-arm-embedded/$OS/gcc-arm-
embedded" |
79 | 79 |
80 # Use release dartinu command in a Dartino SDK Github checkout. | 80 # Use release dartinu command in a Dartino SDK Github checkout. |
81 DARTINO="$DARTINO_CHECKOUT_DIR/out/ReleaseX64/fletch" | 81 DARTINO="$DARTINO_CHECKOUT_DIR/out/ReleaseX64/dartino" |
82 | 82 |
83 # Location of the static libraries to link with. | 83 # Location of the static libraries to link with. |
84 LIB_DIR="$DARTINO_CHECKOUT_DIR/out/ReleaseSTM" | 84 LIB_DIR="$DARTINO_CHECKOUT_DIR/out/ReleaseSTM" |
85 | 85 |
86 # The linker script to use. | 86 # The linker script to use. |
87 LINKER_SCRIPT="$DARTINO_CHECKOUT_DIR/platforms/stm/disco_fletch/generated/SW4S
TM32/configuration/STM32F746NGHx_FLASH.ld" | 87 LINKER_SCRIPT="$DARTINO_CHECKOUT_DIR/platforms/stm/disco_dartino/generated/SW4
STM32/configuration/STM32F746NGHx_FLASH.ld" |
88 | 88 |
89 BUILD_DIR="$DARTINO_CHECKOUT_DIR/out/DebugSTM" | 89 BUILD_DIR="$DARTINO_CHECKOUT_DIR/out/DebugSTM" |
90 fi | 90 fi |
91 | 91 |
92 ### TODO(sgjesse): End of maybe source this part | 92 ### TODO(sgjesse): End of maybe source this part |
93 | 93 |
94 # The static libraries to link with. | 94 # The static libraries to link with. |
95 LIB1="$LIB_DIR/libfletch_vm_library.a" | 95 LIB1="$LIB_DIR/libdartino_vm_library.a" |
96 LIB2="$LIB_DIR/libfletch_shared.a" | 96 LIB2="$LIB_DIR/libdartino_shared.a" |
97 LIB3="$LIB_DIR/libdouble_conversion.a" | 97 LIB3="$LIB_DIR/libdouble_conversion.a" |
98 LIB4="$LIB_DIR/libdisco_fletch.a" | 98 LIB4="$LIB_DIR/libdisco_dartino.a" |
99 | 99 |
100 # Paths to to gcc and objcopy. | 100 # Paths to to gcc and objcopy. |
101 TOOLCHAIN_PREFIX="$TOOLCHAIN_DIR/bin/arm-none-eabi-" | 101 TOOLCHAIN_PREFIX="$TOOLCHAIN_DIR/bin/arm-none-eabi-" |
102 CC="${TOOLCHAIN_PREFIX}gcc" | 102 CC="${TOOLCHAIN_PREFIX}gcc" |
103 OBJCOPY="${TOOLCHAIN_PREFIX}objcopy" | 103 OBJCOPY="${TOOLCHAIN_PREFIX}objcopy" |
104 SIZE="${TOOLCHAIN_PREFIX}size" | 104 SIZE="${TOOLCHAIN_PREFIX}size" |
105 | 105 |
106 echo "Compiling snapshot of $DART_FILE" | 106 echo "Compiling snapshot of $DART_FILE" |
107 "$DARTINO" export "$DART_FILE" to file snapshot | 107 "$DARTINO" export "$DART_FILE" to file snapshot |
108 | 108 |
(...skipping 27 matching lines...) Expand all Loading... |
136 "$LIB3" \ | 136 "$LIB3" \ |
137 "$LIB4" \ | 137 "$LIB4" \ |
138 -Wl,--end-group \ | 138 -Wl,--end-group \ |
139 -lstdc++ \ | 139 -lstdc++ \ |
140 -Wl,--no-whole-archive | 140 -Wl,--no-whole-archive |
141 | 141 |
142 "$OBJCOPY" -O binary "$BUILD_DIR/$BASE_NAME.elf" "$BUILD_DIR/$BASE_NAME.bin" | 142 "$OBJCOPY" -O binary "$BUILD_DIR/$BASE_NAME.elf" "$BUILD_DIR/$BASE_NAME.bin" |
143 "$SIZE" "$BUILD_DIR/$BASE_NAME.elf" | 143 "$SIZE" "$BUILD_DIR/$BASE_NAME.elf" |
144 | 144 |
145 echo "\nFinishing building flashable image: $BUILD_DIR/$BASE_NAME.bin" | 145 echo "\nFinishing building flashable image: $BUILD_DIR/$BASE_NAME.bin" |
OLD | NEW |