-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gryhyphen
committed
Nov 16, 2024
1 parent
f21f27f
commit 8f76e9b
Showing
6 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Build and Deploy", | ||
// Using node terminal as it lets me run the code without expecting | ||
// me to do anything. | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"command": "${workspaceFolder}/build.zsh", | ||
"cwd": "${workspaceFolder}" | ||
} | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Run build.zsh to build and flash the pico |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/zsh | ||
|
||
# Build the thing | ||
cargo build | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Build succeeded, flashing the binary to the board..." | ||
else | ||
echo "Build failed, please check the errors and try again." | ||
exit 1 | ||
fi | ||
|
||
# Get the current directory | ||
current_dir=$(pwd) | ||
|
||
# Read the Cargo.toml file | ||
cargo_toml="$current_dir/Cargo.toml" | ||
if [[ ! -f "$cargo_toml" ]]; then | ||
echo "Failed to find Cargo.toml" | ||
exit 1 | ||
fi | ||
|
||
cargo_toml_content=$(cat "$cargo_toml") | ||
|
||
# Extract the package name from Cargo.toml | ||
package_name=$(echo "$cargo_toml_content" | grep '^name =' | sed 's/name = "\(.*\)"/\1/') | ||
if [[ -z "$package_name" ]]; then | ||
echo "Failed to find package name in Cargo.toml" | ||
exit 1 | ||
fi | ||
|
||
# Construct the path to the build binary | ||
build_path="$current_dir/target/thumbv6m-none-eabi/debug/$package_name" | ||
|
||
# Define the openocd command and arguments | ||
openocd_command="sudo" | ||
openocd_args=( | ||
"openocd" | ||
"-s" "tcl" | ||
"-f" "interface/cmsis-dap.cfg" | ||
"-f" "target/rp2040.cfg" | ||
"-c" "adapter speed 5000" | ||
"-c" "program $build_path verify reset exit" | ||
) | ||
|
||
# Execute the openocd command | ||
$openocd_command "${openocd_args[@]}" | ||
status=$? | ||
|
||
if [[ $status -ne 0 ]]; then | ||
echo "openocd command failed with status: $status" | ||
exit 1 | ||
fi |
This file contains 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