diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 8de106b4de00bb69bb53379c6d2a61f8f0fb561f..580e8f8c308b006c74b0e1b59881045fd1d1634f 100755 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -32,13 +32,24 @@ "problemMatcher": "$gcc" }, { - "label": "BUILD current-entrypoint", + "label": "BUILD current-entrypoint DEBUG", "type": "shell", "windows": { "command": "./sbs -d -b ${fileBasenameNoExtension}" }, "linux": { - "command": "./sbs -v -b ${fileBasenameNoExtension}" + "command": "./sbs -d -b ${fileBasenameNoExtension}" + }, + "problemMatcher": "$gcc" + }, + { + "label": "BUILD current-entrypoint NO DEBUG", + "type": "shell", + "windows": { + "command": "./sbs -b ${fileBasenameNoExtension}" + }, + "linux": { + "command": "./sbs -b ${fileBasenameNoExtension}" }, "problemMatcher": "$gcc" }, @@ -54,18 +65,30 @@ "problemMatcher": [] }, { - "label": "BUILD+RUN current-entrypoint", + "label": "BUILD+RUN current-entrypoint DEBUG", "type": "shell", "windows": { - "command": "ST-LINK_CLI.exe -P build/${fileBasenameNoExtension}.bin 0x8000000 -V -Rst" + "command": "./sbs -d -f ${fileBasenameNoExtension}" }, "linux": { - "command": "sleep 1;st-flash write build/${fileBasenameNoExtension}.bin 0x8000000" + "command": "./sbs -d -f ${fileBasenameNoExtension}" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "BUILD+RUN current-entrypoint NO DEBUG", + "type": "shell", + "windows": { + "command": "./sbs -f ${fileBasenameNoExtension}" + }, + "linux": { + "command": "./sbs -f ${fileBasenameNoExtension}" }, "problemMatcher": [], - "dependsOn": [ - "BUILD current-entrypoint" - ], "group": { "kind": "build", "isDefault": true diff --git a/sbs b/sbs index dee9fd248df9a0b65657eb647f0910c7f616d51c..4d1dd0e9f328c9abdc232bb295428c99771de253 100755 --- a/sbs +++ b/sbs @@ -40,8 +40,10 @@ EOF } find_deps() { - command -v ccache &> /dev/null && config_ccache=true - command -v ninja &> /dev/null && config_ninja=true + command -v ccache &> /dev/null && config_ccache=true + command -v ninja &> /dev/null && config_ninja=true + command -v st-flash &> /dev/null && config_stflash=true + command -v ST-LINK_CLI.exe &> /dev/null && config_stlink=true } print_found_deps() { @@ -103,7 +105,16 @@ flash() { if build "$1"; then echo if [ -f "$build_dir/$1.bin" ]; then - st-flash --reset write "$build_dir/$1.bin" 0x08000000 + printf "Flashing software: "; + [ "$config_stflash" = true ] && echo "st-flash" || ([ "$config_stlink" = true ] && echo "st-link" || "no") + + if [ "$config_stflash" = true ]; then + st-flash --reset write "$build_dir/$1.bin" 0x08000000 + elif [ "$config_stlink" = true ]; then + ST-LINK_CLI.exe -P "$build_dir/$1.bin" 0x8000000 -V -Rst + else + echo "Error: No flashing software found!" + fi else echo "Error: target '$1' is not flashable" fi @@ -180,6 +191,8 @@ config_ccache=false config_debug=false config_verbose=false config_ninja=false +config_stflash=false +config_stlink=false build_jobs= find_deps