From 1881d34dbcc9c1c703387e25609651058238a832 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 18 Jun 2024 01:20:40 +0100 Subject: [PATCH] roms: merge serprog build into one function Signed-off-by: Leah Rowe --- script/roms | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/script/roms b/script/roms index 3791535e..8fb2981e 100755 --- a/script/roms +++ b/script/roms @@ -64,34 +64,33 @@ mkserprog() if [ $# -gt 1 ]; then [ "$2" = "list" ] && serlist "$serprog_boards_dir" && return 0 - [ "$2" = "list" ] || build_${1}_rom "$2" + [ "$2" = "list" ] || mkserprogfw "$1" "$2" else serlist "$serprog_boards_dir" | \ while read -r board; do - build_${1}_rom "$board" + mkserprogfw "$1" "$board" done fi [ "$xbmk_release" = "y" ] && mkrom_tarball "bin/serprog_$1"; return 0 } -build_rp2040_rom() +mkserprogfw() { - x_ cmake -DPICO_BOARD="$1" -DPICO_SDK_PATH="$picosdk" \ - -B "$picosrc/build" "$picosrc" - x_ cmake --build "$picosrc/build" - x_ mv "$picosrc/build/pico_serprog.uf2" \ - "bin/serprog_rp2040/serprog_$1.uf2" - printf "output to bin/serprog_rp2040/serprog_%s.uf2\n" "$1" -} - -build_stm32_rom() -{ - x_ make -C "$stm32src" libopencm3-just-make BOARD=$1 - x_ make -C "$stm32src" BOARD=$1 - x_ mv "$stm32src/stm32-vserprog.hex" \ - "bin/serprog_stm32/serprog_$1.hex" - printf "output to bin/serprog_stm32/serprog_%s.hex\n" "$1" + if [ "$1" = "rp2040" ]; then + x_ cmake -DPICO_BOARD="$2" -DPICO_SDK_PATH="$picosdk" \ + -B "$picosrc/build" "$picosrc" + x_ cmake --build "$picosrc/build" + x_ mv "$picosrc/build/pico_serprog.uf2" \ + "bin/serprog_rp2040/serprog_$2.uf2" + printf "output to bin/serprog_rp2040/serprog_%s.uf2\n" "$2" + else + x_ make -C "$stm32src" libopencm3-just-make BOARD=$2 + x_ make -C "$stm32src" BOARD=$2 + x_ mv "$stm32src/stm32-vserprog.hex" \ + "bin/serprog_stm32/serprog_$2.hex" + printf "output to bin/serprog_stm32/serprog_%s.hex\n" "$2" + fi } serlist()