I wrote following Windows batch script that copies given file to Nucleo STM32 virtual drive:
@echo off
for /f %%D in ('%SystemRoot%\System32\wbem\WMIC.exe volume get DriveLetter^, Label ^| find "NODE_F446RE"') do set nucleo_drive=%%D
rem echo Nucleo drive: %nucleo_drive%
IF EXIST %nucleo_drive%\DETAILS.TXT (
IF EXIST %1 (
@echo on
xcopy %1 %nucleo_drive%
@echo off
echo Copied %1 on nucleo
) ELSE (
echo Binary %1 not found. Run `mingw32-make` in this directory to compile the project.
)
) ELSE (
echo Nucleo drive not found. If needed, edit the `find "NODE_F446RE"` part of this script to refference your nucleo volume name.
)
Nucleo's drive is virtual file drive. When you copy compatible binary on it, it flashes the binary on the actual Nucleo processor and restarts it. I'd like to do the same for Linux using a bash script - particularly Ubuntu, but the more compatible the better.
I can see that the Nucleo appeared on path /media/MY_USERNAME/NODE_F446RE
. But I have little experience with linux, is that path standard? Can I rely on copying the file to /media/%username%/NODE_F446RE
?
Or is there a better way to get removable device path (say, first volume if it has more volumes, which nucleo won't)?
lsblk -rno label,mountpoint | awk '$1=="NODE_F446RE"{print $2}'
– don_crissti Feb 14 '17 at 15:15