Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added script to wirelessly transfer compiled firmware script #294

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions scripts/canflash/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
# CAN Flash

## How to run the cantransfer.sh script

### Check if there is a connection with the pi

Type ``ping [ip address]`` in terminal, where ip address is the ip address of the pi.

### Running the script

Run the script by using the command ``sh cantransfer.sh 'bin_files' 'pi_username' 'host' 'destination_path``.
saadatq marked this conversation as resolved.
Show resolved Hide resolved

Where the inputs are 'bin_files' 'pi_username' 'host' 'destination_path':

- Bin files is the path to where the compiled firmware .bin files are located.
- Pi_username is the username of the raspberry pi.
- Host is the ip address of the pi.
- Destination path is the folder in the pi where the bin files will be transferred to.

If there is no specific path to sent the file to the directory ``/home/pi_username/`` will work.
saadatq marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 20 additions & 0 deletions scripts/canflash/cantransfer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#Check if all arguments have been passed
if [ "$#" -lt 4 ]; then
echo "ERROR enter all arguments: sh cantransfer.sh 'bin_files' 'pi_username' 'host' 'destination_path'"
exit 1
fi

BIN_FILE=$1
PI_USERNAME=$2
HOST=$3
DESTINATION_PATH=$4

# Check if the bin folder exists
if [ ! -f "$BIN_FILE" ]; then
echo "ERROR: File $BIN_FILE not found"
exit 1
fi

# Perform file transfer
echo "Transferring $BIN_FILE to $PI_USERNAME@$HOST:$DESTINATION_PATH.."
scp "$BIN_FILE" "$PI_USERNAME@$HOST:$DESTINATION_PATH"
Loading