From 4d7717b1f474080eae8f9798e4ff329ef3576f15 Mon Sep 17 00:00:00 2001 From: Rahix <rahix@rahix.de> Date: Sat, 15 Jun 2019 19:22:56 +0200 Subject: [PATCH] build: Build .bin files as well Signed-off-by: Rahix <rahix@rahix.de> --- bootloader/build_image.sh | 9 +++++++++ bootloader/meson.build | 3 +++ hw-tests/bmatest/meson.build | 10 +++++++++- hw-tests/bmetest/meson.build | 10 +++++++++- hw-tests/ecgtest/meson.build | 10 +++++++++- hw-tests/hello-freertos/meson.build | 10 +++++++++- hw-tests/hello-world/meson.build | 10 +++++++++- hw-tests/imutest/meson.build | 10 +++++++++- hw-tests/ips/meson.build | 10 +++++++++- 9 files changed, 75 insertions(+), 7 deletions(-) create mode 100755 bootloader/build_image.sh diff --git a/bootloader/build_image.sh b/bootloader/build_image.sh new file mode 100755 index 00000000..6d3e53ef --- /dev/null +++ b/bootloader/build_image.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +PYTHON="$1" +ELF="$2" +BIN="$3" + +arm-none-eabi-objcopy -O binary "$ELF" "$BIN" +"$PYTHON" "$(dirname "$0")/crc_patch.py" "$BIN" diff --git a/bootloader/meson.build b/bootloader/meson.build index 04a4f73c..d97a2217 100644 --- a/bootloader/meson.build +++ b/bootloader/meson.build @@ -17,3 +17,6 @@ executable( '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', ], ) + +# build_image.sh +build_image = [files('./build_image.sh'), python3] diff --git a/hw-tests/bmatest/meson.build b/hw-tests/bmatest/meson.build index 0f3899a2..9559f67d 100644 --- a/hw-tests/bmatest/meson.build +++ b/hw-tests/bmatest/meson.build @@ -1,6 +1,6 @@ name = 'bmatest' -executable( +elf = executable( name + '.elf', 'main.c', dependencies: [libcard10, max32665_startup], @@ -9,3 +9,11 @@ executable( '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', ], ) + +custom_target( + name + '.bin', + build_by_default: true, + output: name + '.bin', + input: elf, + command: [build_image, '@INPUT@', '@OUTPUT0@'], +) diff --git a/hw-tests/bmetest/meson.build b/hw-tests/bmetest/meson.build index ed1e72b9..86e15050 100644 --- a/hw-tests/bmetest/meson.build +++ b/hw-tests/bmetest/meson.build @@ -1,6 +1,6 @@ name = 'bmetest' -executable( +elf = executable( name + '.elf', 'main.c', dependencies: [libcard10, max32665_startup], @@ -9,3 +9,11 @@ executable( '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', ], ) + +custom_target( + name + '.bin', + build_by_default: true, + output: name + '.bin', + input: elf, + command: [build_image, '@INPUT@', '@OUTPUT0@'], +) diff --git a/hw-tests/ecgtest/meson.build b/hw-tests/ecgtest/meson.build index 7e4f32d0..9b2f80f3 100644 --- a/hw-tests/ecgtest/meson.build +++ b/hw-tests/ecgtest/meson.build @@ -1,6 +1,6 @@ name = 'ecgtest' -executable( +elf = executable( name + '.elf', 'main.c', dependencies: [libcard10, max32665_startup], @@ -9,3 +9,11 @@ executable( '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', ], ) + +custom_target( + name + '.bin', + build_by_default: true, + output: name + '.bin', + input: elf, + command: [build_image, '@INPUT@', '@OUTPUT0@'], +) diff --git a/hw-tests/hello-freertos/meson.build b/hw-tests/hello-freertos/meson.build index fae1dbd2..457a6768 100644 --- a/hw-tests/hello-freertos/meson.build +++ b/hw-tests/hello-freertos/meson.build @@ -16,7 +16,7 @@ sources = files( 'main.c', ) -executable( +elf = executable( name + '.elf', sources, include_directories: freertos_sdk_includes, @@ -27,3 +27,11 @@ executable( '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', ], ) + +custom_target( + name + '.bin', + build_by_default: true, + output: name + '.bin', + input: elf, + command: [build_image, '@INPUT@', '@OUTPUT0@'], +) diff --git a/hw-tests/hello-world/meson.build b/hw-tests/hello-world/meson.build index 7519ca62..2c687cb0 100644 --- a/hw-tests/hello-world/meson.build +++ b/hw-tests/hello-world/meson.build @@ -1,6 +1,6 @@ name = 'hello-world' -executable( +elf = executable( name + '.elf', 'main.c', dependencies: [libcard10, max32665_startup], @@ -9,3 +9,11 @@ executable( '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', ], ) + +custom_target( + name + '.bin', + build_by_default: true, + output: name + '.bin', + input: elf, + command: [build_image, '@INPUT@', '@OUTPUT0@'], +) diff --git a/hw-tests/imutest/meson.build b/hw-tests/imutest/meson.build index 18825ee6..d87e43d0 100644 --- a/hw-tests/imutest/meson.build +++ b/hw-tests/imutest/meson.build @@ -1,6 +1,6 @@ name = 'imutest' -executable( +elf = executable( name + '.elf', 'main.c', dependencies: [libcard10, max32665_startup], @@ -9,3 +9,11 @@ executable( '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', ], ) + +custom_target( + name + '.bin', + build_by_default: true, + output: name + '.bin', + input: elf, + command: [build_image, '@INPUT@', '@OUTPUT0@'], +) diff --git a/hw-tests/ips/meson.build b/hw-tests/ips/meson.build index 10ff3cf7..d4c782f4 100644 --- a/hw-tests/ips/meson.build +++ b/hw-tests/ips/meson.build @@ -1,6 +1,6 @@ name = 'ips' -executable( +elf = executable( name + '.elf', 'main.c', 'image/image.c', @@ -11,3 +11,11 @@ executable( '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', ], ) + +custom_target( + name + '.bin', + build_by_default: true, + output: name + '.bin', + input: elf, + command: [build_image, '@INPUT@', '@OUTPUT0@'], +) -- GitLab