| OLD | NEW |
| 1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
| 2 # Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 2 # Copyright (c) 2015, 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 # Update the generated source and template files from STMCubeMX. Right | 6 # Update the generated source and template files from STMCubeMX. Right |
| 7 # not the source file is disco_fletch.tar.gz - a tar of the generated | 7 # not the source file is disco_dartino.tar.gz - a tar of the generated |
| 8 # project from a Windows machine. | 8 # project from a Windows machine. |
| 9 | 9 |
| 10 set -e | 10 set -e |
| 11 | 11 |
| 12 tar xf disco_fletch.tar.gz | 12 tar xf disco_dartino.tar.gz |
| 13 | 13 |
| 14 for SRC in disco_fletch/Inc/* | 14 for SRC in disco_dartino/Inc/* |
| 15 do | 15 do |
| 16 BASENAME=$(basename "$SRC") | 16 BASENAME=$(basename "$SRC") |
| 17 if test "$BASENAME" != "FreeRTOSConfig.h" | 17 if test "$BASENAME" != "FreeRTOSConfig.h" |
| 18 then | 18 then |
| 19 echo "$SRC" | 19 echo "$SRC" |
| 20 DEST=generated/Inc/$BASENAME | 20 DEST=generated/Inc/$BASENAME |
| 21 cp "$SRC" "$DEST" | 21 cp "$SRC" "$DEST" |
| 22 dos2unix -q $DEST | 22 dos2unix -q $DEST |
| 23 sed -i 's/[ \t]*$//' "$DEST" | 23 sed -i 's/[ \t]*$//' "$DEST" |
| 24 fi | 24 fi |
| 25 done | 25 done |
| 26 | 26 |
| 27 for SRC in disco_fletch/Src/* $SRC_FILES | 27 for SRC in disco_dartino/Src/* $SRC_FILES |
| 28 do | 28 do |
| 29 BASENAME=$(basename "$SRC") | 29 BASENAME=$(basename "$SRC") |
| 30 if test "$BASENAME" != "freertos.c" | 30 if test "$BASENAME" != "freertos.c" |
| 31 then | 31 then |
| 32 echo "$SRC" | 32 echo "$SRC" |
| 33 DEST=generated/Src/$BASENAME | 33 DEST=generated/Src/$BASENAME |
| 34 cp "$SRC" "$DEST" | 34 cp "$SRC" "$DEST" |
| 35 dos2unix -q "$DEST" | 35 dos2unix -q "$DEST" |
| 36 sed -i 's/[ \t]*$//' "$DEST" | 36 sed -i 's/[ \t]*$//' "$DEST" |
| 37 fi | 37 fi |
| 38 done | 38 done |
| 39 | 39 |
| 40 # Modify generated main.c to expose the MX_ initialization functions | 40 # Modify generated main.c to expose the MX_ initialization functions |
| 41 # and not implement main. | 41 # and not implement main. |
| 42 sed -i 's/static void MX_/void MX_/' generated/Src/main.c | 42 sed -i 's/static void MX_/void MX_/' generated/Src/main.c |
| 43 sed -i 's/int main/int _not_using_this_main/' generated/Src/main.c | 43 sed -i 's/int main/int _not_using_this_main/' generated/Src/main.c |
| 44 mv generated/Src/main.c generated/Src/mx_init.c | 44 mv generated/Src/main.c generated/Src/mx_init.c |
| 45 | 45 |
| 46 SRC="disco_fletch/SW4STM32/disco_fletch Configuration/STM32F746NGHx_FLASH.ld" | 46 SRC="disco_dartino/SW4STM32/disco_dartino Configuration/STM32F746NGHx_FLASH.ld" |
| 47 echo "$SRC" | 47 echo "$SRC" |
| 48 cp "$SRC" generated/SW4STM32/configuration/STM32F746NGHx_FLASH.ld | 48 cp "$SRC" generated/SW4STM32/configuration/STM32F746NGHx_FLASH.ld |
| 49 dos2unix -q generated/SW4STM32/configuration/STM32F746NGHx_FLASH.ld | 49 dos2unix -q generated/SW4STM32/configuration/STM32F746NGHx_FLASH.ld |
| 50 | 50 |
| 51 SRC="disco_fletch/Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/gcc/startup
_stm32f746xx.s" | 51 SRC="disco_dartino/Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/gcc/startu
p_stm32f746xx.s" |
| 52 echo "$SRC" | 52 echo "$SRC" |
| 53 cp "$SRC" template/startup_stm32f746xx.s | 53 cp "$SRC" template/startup_stm32f746xx.s |
| 54 dos2unix -q template/startup_stm32f746xx.s | 54 dos2unix -q template/startup_stm32f746xx.s |
| 55 | 55 |
| 56 # Don't copy the disco_fletch/Drivers/CMSIS/Device/ST/STM32F7xx/Source/ | 56 # Don't copy the disco_dartino/Drivers/CMSIS/Device/ST/STM32F7xx/Source/ |
| 57 # Templates/system_stm32f7xx.c file, as the one provided by | 57 # Templates/system_stm32f7xx.c file, as the one provided by |
| 58 # STM32CubeMX is the wrong one. It is the one for the EVAL2 board | 58 # STM32CubeMX is the wrong one. It is the one for the EVAL2 board |
| 59 # and not the Discovery board. | 59 # and not the Discovery board. |
| 60 | 60 |
| 61 cp disco_fletch/disco_fletch.ioc disco_fletch.ioc | 61 cp disco_dartino/disco_dartino.ioc disco_dartino.ioc |
| 62 dos2unix -q disco_fletch.ioc | 62 dos2unix -q disco_dartino.ioc |
| 63 | 63 |
| 64 rm -rf disco_fletch | 64 rm -rf disco_dartino |
| OLD | NEW |