2023-08-06 18:14:49 +02:00
#!/bin/bash
option=$1
2023-08-19 08:24:59 +02:00
upload(){
cargo build -p $option --release && cp ./target/arduboy/release/lib$option.a ./arduboy-rust/Wrapper-Project/lib/libgame.a && cd arduboy-rust/Wrapper-Project/ && pio run -v -t upload && cp ./.pio/build/arduboy/firmware.hex ./build/$option.hex && pio run -t clean && rm lib/libgame.a && cd ../../
}
2023-08-06 18:14:49 +02:00
if [ -z "$option" ]
then
2023-08-19 08:24:59 +02:00
cargo build -p game --release && cp ./target/arduboy/release/libgame.a ./arduboy-rust/Wrapper-Project/lib/libgame.a && cd arduboy-rust/Wrapper-Project/ && pio run -v -t upload && cp ./.pio/build/arduboy/firmware.hex ./build/game.hex && pio run -t clean && rm lib/libgame.a && cd ../../
2023-08-16 14:46:00 +02:00
elif [ "$option" = "doc" ]
then
2023-08-19 08:24:59 +02:00
cargo doc -p arduboy-rust && rm -r ./docs/doc/ && cp -r ./target/arduboy/doc ./docs/
2023-08-06 18:14:49 +02:00
elif [ "$option" = "snake" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-06 18:14:49 +02:00
elif [ "$option" = "pong" ]
then
2023-08-19 08:24:59 +02:00
upload
elif [ "$option" = "drboy" ]
then
upload
2023-08-06 18:14:49 +02:00
elif [ "$option" = "rustacean" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-06 18:14:49 +02:00
elif [ "$option" = "tone" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-06 18:14:49 +02:00
elif [ "$option" = "eeprom" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-14 16:05:11 +02:00
elif [ "$option" = "eeprom-byte" ]
then
2023-08-19 08:24:59 +02:00
cargo build -p eeprom-byte --release && cp ./target/arduboy/release/libeeprom_byte.a ./arduboy-rust/Wrapper-Project/lib/libgame.a && cd arduboy-rust/Wrapper-Project/ && pio run -v -t upload && cp ./.pio/build/arduboy/firmware.hex ./build/eeprom-byte.hex && pio run -t clean && rm lib/libgame.a && cd ../../
2023-08-07 18:17:52 +02:00
elif [ "$option" = "progmem" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-06 18:14:49 +02:00
elif [ "$option" = "demo2" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-06 18:14:49 +02:00
elif [ "$option" = "demo3" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-06 18:14:49 +02:00
elif [ "$option" = "demo4" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-06 18:14:49 +02:00
elif [ "$option" = "demo5" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-06 18:14:49 +02:00
elif [ "$option" = "demo6" ]
then
2023-08-19 08:24:59 +02:00
upload
2023-08-06 18:14:49 +02:00
else
echo Usage: for uploading your game \|./run.sh
echo Usage: for uploading an example game \| ./run.sh \<Example Game\>
fi