diff --git a/.idea/runConfigurations/OCD_Boot.xml b/.idea/runConfigurations/OCD_Boot.xml index 354bcbe..795ddc5 100644 --- a/.idea/runConfigurations/OCD_Boot.xml +++ b/.idea/runConfigurations/OCD_Boot.xml @@ -1,5 +1,5 @@ - + diff --git a/utils/app_image_builder/main_prog.img b/utils/app_image_builder/main_prog.img new file mode 100644 index 0000000..460bdba Binary files /dev/null and b/utils/app_image_builder/main_prog.img differ diff --git a/utils/bin/app_image_builder_linux b/utils/bin/app_image_builder_linux new file mode 100644 index 0000000..41aed7c Binary files /dev/null and b/utils/bin/app_image_builder_linux differ diff --git a/utils/board.cfg b/utils/board.cfg new file mode 100644 index 0000000..82698af --- /dev/null +++ b/utils/board.cfg @@ -0,0 +1,15 @@ +adapter serial "\x34\x00\x48\x00\x0D\x00\x00\x59\x33\x4A\x53\x4E" + +# This is for all ST NUCLEO with any STM32F4. Known boards at the moment: +# STM32F401RET6 +# http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260000 +# STM32F411RET6 +# http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260320 + +source [find interface/stlink.cfg] + +transport select hla_swd + +source [find target/stm32g0x.cfg] + +reset_config srst_only diff --git a/utils/debugger_script.ps1 b/utils/debugger_script.ps1 new file mode 100644 index 0000000..6b0f6b3 --- /dev/null +++ b/utils/debugger_script.ps1 @@ -0,0 +1,50 @@ + +$dir=$PSScriptRoot +$MyCommand="$dir"+"\stlink\st-info.exe --probe --hot-plug" +Invoke-Expression -Command $MyCommand | Out-String -OutVariable output +$DevicesNum=$output.Substring($output.IndexOf("Found") + 7, 1) +if ($DevicesNum -eq 1) +{ + $serial=$output.Substring($output.Trim().IndexOf("serial") + 12, 24) +} +else +{ + Write-Host -ForegroundColor Yellow -BackgroundColor Blue 'Press key which number of debugger you wanna use' + $key=Read-Host + $res=$output.Split('.')[$key] + $res=$res.Substring(0, $res.Length-2) + $serial=$res.Substring($res.IndexOf("serial") + 12 , 24) + Write-Host -ForegroundColor Yellow -BackgroundColor Blue "Your select is : `r`n $res" +} + + + +$serial=$serial.ToCharArray() + +$StringForCompare='adapter serial "' + +for ($i = 0; $i -lt $serial.Count; $i=$i+2) { + $StringForCompare=$StringForCompare.Insert($StringForCompare.Length,"\x$($serial.Get($i))$($serial.Get($i+1))") +} +$StringForCompare=$StringForCompare.Insert($StringForCompare.Length,'"') +$Path = "$dir"+"/board.cfg" +$Lines = [System.IO.File]::ReadAllLines($Path) + +foreach ($line in $lines) +{ + if ($line -match "adapter serial") + { + if ($line -notmatch $StringForCompare) + { + $Lines[$Lines.IndexOf($line)]=$StringForCompare + } + [System.IO.File]::WriteAllLines($Path, $Lines) + exit + } +} + +$Lines[0]=$StringForCompare +[System.IO.File]::WriteAllLines($Path, $Lines) + + +