pico-serprog: enable building for multiple pico chips
rp2040 and rp2530 platforms can't share a cmake build directory. we could just delete the build directory after every compilation, but that would be really wasteful (every tool would need to be recomiled every time. instead create new build directories as new plaforms are found and symlink them to the point where the build directory used to be. to find out which platform we're compiling for, we crudely parse the board headers file. there surely would be better ways to do this, but this hack works with all the boards in pico-sdk 2.1.0. Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>master
parent
ccc2b4d589
commit
e2f8cc7f3e
|
@ -11,7 +11,14 @@ mkserprog()
|
|||
basename -as .h "$serdir/"*.h > "$TMPDIR/ser" || $err "!mk $1 $TMPDIR"
|
||||
|
||||
while read -r sertarget; do
|
||||
[ "$1" = "rp2040" ] && x_ cmake -DPICO_BOARD="$sertarget" \
|
||||
[ "$1" = "rp2040" ] &&
|
||||
x_ rm -rf "$sersrc/build" \
|
||||
&& (pt=$(x_ grep "pico_cmake_set" \
|
||||
"$picosdk/src/boards/include/boards/$sertarget.h" \
|
||||
| grep "PICO_PLATFORM" | cut -d= -f2 | tr -d [:blank:])
|
||||
mkdir -p "$sersrc/build_$pt"
|
||||
ln -srf "$sersrc/build_$pt/" "$sersrc/build") \
|
||||
&& x_ cmake -DPICO_BOARD="$sertarget" \
|
||||
-DPICO_SDK_PATH="$picosdk" -B "$sersrc/build" "$sersrc" \
|
||||
&& x_ cmake --build "$sersrc/build"
|
||||
[ "$1" = "stm32" ] && x_ make -C "$sersrc" \
|
||||
|
|
Loading…
Reference in New Issue