Last active
April 29, 2021 01:48
-
-
Save hyphop/e0f61b9368b22c9dc806171af3346e2b to your computer and use it in GitHub Desktop.
upgrade_mcu.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# one-line usage | |
# /bin/bash -c "$(curl -jkL https://gist.githubusercontent.com/hyphop/e0f61b9368b22c9dc806171af3346e2b/raw/777fce5586d8921e719f382f8ac3b1da55cb2204/upgrade_mcu.sh)" | |
echo "[i] Tone Board MCU upgrade (online script) - PRESS ANY KEY or Escape by Ctrl+C" | |
read l | |
cd ~ | |
mkdir tone_upgrade | |
cd tone_upgrade | |
case $(uname) in | |
Darwin) # MacOS | |
#install homebrew for mac os | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew install git libusb make automake mk-configure install-sh libtool pkg-config wget | |
echo 'export PATH="/usr/local/opt/m4/bin:$PATH"' >> ~/.zshrc | |
git clone https://github.com/libusb/libusb.git | |
cd libusb | |
./autogen.sh | |
./configure | |
make | |
make install | |
cd .. | |
;; | |
pkg-config --libs libusb-1.0 | |
*) # Linux | |
sudo apt-get update | |
sudo apt-get install build-essential libusb-1.0-0-dev git | |
;; | |
esac | |
git clone https://github.com/vdudouyt/stm8flash.git | |
make -C stm8flash | |
wget https://dl.khadas.com/Hardware/Tone2/MCU/Tone2_Pro_MCU_Firmware_210417.zip | |
unzip *.zip | |
echo "[i] please connect your ST-Link(programmator) paired with Tone Board and PRESS ANY KEY" | |
read l | |
./stm8flash/stm8flash -cstlinkv2 "-pstm8s003?3" -s flash \ | |
-w Tone2_Pro_MCU_Firmware_210417/Tone2_Pro_MCU_BOOT_APP_210417.hex && echo "[i] OK" | |
echo "[i] DONE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment