This commit is contained in:
Mysteo91
2023-08-02 18:21:46 +03:00
parent 7732cf6280
commit e40a82a218
5 changed files with 66 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="OCD Boot" type="com.jetbrains.cidr.embedded.openocd.conf.type" factoryName="com.jetbrains.cidr.embedded.openocd.conf.factory" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="myProject" TARGET_NAME="boot.elf" CONFIG_NAME="BOOT" version="1" RUN_TARGET_PROJECT_NAME="myProject" RUN_TARGET_NAME="boot.elf">
<configuration default="false" name="OCD Boot" type="com.jetbrains.cidr.embedded.openocd.conf.type" factoryName="com.jetbrains.cidr.embedded.openocd.conf.factory" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="myProject" TARGET_NAME="boot.elf" CONFIG_NAME="BOOT_DEBUG" version="1" RUN_TARGET_PROJECT_NAME="myProject" RUN_TARGET_NAME="boot.elf">
<openocd version="1" gdb-port="3333" telnet-port="4444" board-config="board/st_nucleo_g0.cfg" reset-type="RUN" download-type="UPDATED_ONLY">
<debugger kind="GDB" isBundled="true" />
</openocd>

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 KiB

Binary file not shown.

15
utils/board.cfg Normal file
View File

@@ -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

50
utils/debugger_script.ps1 Normal file
View File

@@ -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)