Sysprogs forums › Forums › VisualGDB › semihosting err Command 'dump_image' failed with error code -1202
- This topic has 4 replies, 2 voices, and was last updated 3 years, 5 months ago by jerryottiii.
-
AuthorPosts
-
June 25, 2021 at 11:03 #30779jerryottiiiParticipant
Hi,
I have an STM32G070RB project that I am debugging the hardware remotely on a linux machine.
I had this first developed in STM32CodeIde (on linux) and then I imported this with VisualGDB. I can compile / debug with issues. However, when I started adding in semihosting function, I keep seeing an error
At first this was with Fast SemiHosting but I eventually removed it as it seemed to be very slow / many times just would never show up (maybe this is more due to using remote OpenOCD?).
I went back to STM32CodeIde, setup semihosting there, and it works great. I added in the changes on the VisualGDB project and I get all the printf statements but I am still seeing this error.
inside main() I have some breakpoints so I can isolate this and it is showing up when a printf occurs. Below is the text and you can see where it says it fails to open a tmp file from the windows computer trying to use dump_image command on GDB. This seems to happen on every printf that occurs. I’ve gone through the settings and I dont see anywhere about logging data to a file and the ones that do show logging or that I found, I had just enabled to capture the output easily but had no effect on this message.
<p style=”padding-left: 60px;”>Debug: 1480 3829 target.c:2441 target_read_buffer(): reading buffer of 4 byte at 0x0800041e
Debug: 1481 3829 hla_target.c:602 adapter_read_memory(): adapter_read_memory 0x0800041e 2 2
Info : 1482 3952 server.c:100 add_connection(): accepting ‘telnet’ connection on tcp/50446
User : 1483 3952 command.c:694 command_run_line(): invalid command name “mbatch”
Debug: 1484 4954 command.c:146 script_debug(): command – mdw 0x200011b8
Debug: 1486 4956 hla_target.c:602 adapter_read_memory(): adapter_read_memory 0x200011b8 4 1
Debug: 1487 4961 command.c:146 script_debug(): command – mdw 0x200011bc
Debug: 1489 4962 hla_target.c:602 adapter_read_memory(): adapter_read_memory 0x200011bc 4 1
Debug: 1490 5911 command.c:146 script_debug(): command – dump_image C:/Users/user_name/AppData/Local/Temp/tmpD616.tmp 0x200011b8 8
Error: 1492 5912 fileio.c:90 fileio_open_local(): couldn’t open C:/Users/user_name/AppData/Local/Temp/tmpD616.tmp
Debug: 1493 5912 command.c:628 run_command(): Command ‘dump_image’ failed with error code -1202
User : 1494 5912 command.c:694 command_run_line():</p>
Section in Code that I am testing on (but occurs on any printf):
<p style=”padding-left: 60px;”>int main(void)
{
/* USER CODE BEGIN 1 */
</p>
<p style=”padding-left: 60px;”>initialise_monitor_handles();
</p>
<p style=”padding-left: 60px;”>printf("Start\n");
/* USER CODE END 1 */
</p>
<p style=”padding-left: 60px;”>/* MCU Configuration--------------------------------------------------------*/
</p>
<p style=”padding-left: 60px;”>/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
</p>
Below is the start of the gdb stub output log file:
<p style=”padding-left: 30px;”>Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
User : 15 1 options.c:63 configuration_output_handler(): debug_level: 3
User : 16 1 options.c:63 configuration_output_handler():
Debug: 17 1 command.c:146 script_debug(): command – bindto 0.0.0.0
Debug: 19 1 configuration.c:97 find_file(): found /usr/bin/../share/openocd/scripts/interface/stlink.cfg
Debug: 20 1 command.c:146 script_debug(): command – adapter driver hla
Debug: 22 1 command.c:146 script_debug(): command – hla_layout stlink
Debug: 24 1 hla_interface.c:242 hl_interface_handle_layout_command(): hl_interface_handle_layout_command
Debug: 25 1 command.c:146 script_debug(): command – hla_device_desc ST-LINK
Debug: 27 1 hla_interface.c:216 hl_interface_handle_device_desc_command(): hl_interface_handle_device_desc_command
Debug: 28 1 command.c:146 script_debug(): command – hla_vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753
Debug: 30 1 command.c:146 script_debug(): command – transport select hla_swd
Debug: 31 1 hla_transport.c:205 hl_swd_transport_select(): hl_swd_transport_select
User : 32 1 options.c:63 configuration_output_handler(): hla_swdUser : 33 1 options.c:63 configuration_output_handler():
Debug: 34 1 configuration.c:97 find_file(): found /usr/bin/../share/openocd/scripts/target/stm32g0x.cfg
Debug: 35 1 configuration.c:97 find_file(): found /usr/bin/../share/openocd/scripts/target/swj-dp.tcl
Debug: 36 1 command.c:146 script_debug(): command – transport select
Debug: 37 1 configuration.c:97 find_file(): found /usr/bin/../share/openocd/scripts/mem_helper.tcl
Debug: 38 1 command.c:146 script_debug(): command – add_usage_text mrw address
Debug: 40 1 command.c:1115 help_add_command(): added ‘mrw’ help text
Debug: 41 1 command.c:146 script_debug(): command – add_help_text mrw Returns value of word in memory.</p>
I have tried different versions starting with VisualGDB-5.6-beta2 and even trying some of the nightly (or on demand) builds.
inside the vgdbcmake file for the remote (incase I’m missing something):
<p style=”padding-left: 30px;”><RemoteParameters>
<Mode>Auto</Mode>
</RemoteParameters>
<Configuration xsi:type="com.visualgdb.edp.openocd.settings">
<CommandLine>-c "debug_level 3" -c "bindto 0.0.0.0" -f interface/stlink.cfg -c "transport select hla_swd" -f target/stm32g0x.cfg -c init -c "reset init"</CommandLine>
<ExtraParameters>
<Frequency xsi:nil="true" />
<BoostedFrequency xsi:nil="true" />
<ConnectUnderReset>false</ConnectUnderReset>
</ExtraParameters>
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
<ProgramMode>Enabled</ProgramMode>
<StartupCommands>
<string>set remotetimeout 60</string>
<string>target remote $$SYS:GDBSTUB_HOST$$:$$SYS:GDB_PORT$$</string>
<string>mon halt</string>
<string>mon reset init</string>
<string>load</string>
</StartupCommands>
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
<PreferredGDBPort>0</PreferredGDBPort>
<PreferredTelnetPort>0</PreferredTelnetPort>
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
<SelectedCoreIndex xsi:nil="true" />
</Configuration>
</p>
Any pointers into where I might need to look or if there is some other information that would or may help show the problem I will try to remove any confidential info and provide it.
Thanks!
Jerry
June 25, 2021 at 22:19 #30780supportKeymasterHi,
It looks like something is preventing OpenOCD from creating a temporary file:
Debug: 1490 5911 command.c:146 script_debug(): command – dump_image C:/Users/user_name/AppData/Local/Temp/tmpD616.tmp 0x200011b8 8 Error: 1492 5912 fileio.c:90 fileio_open_local(): couldn’t open C:/Users/user_name/AppData/Local/Temp/tmpD616.tmp
It could be a buggy antivirus, or non-English characters in the actual user name that you have edited out. Either way, please make sure you are using our OpenOCD fork. It includes a patch that uses a special command for batch memory operations instead of the slower “dump_image” one.
June 28, 2021 at 16:28 #30795jerryottiiiParticipantOk thanks.
Both systems are setup for English. user_name is jott.
I am using OpenOCD (remote) from a Windows 10 machine to a Linux (using Arch Linux) machine.
Do you have an already compiled OpenOCD fork for Linux (64bit) or is the source code posted where i could recompile so i can have your openocd fork run on the linux system?
June 28, 2021 at 20:28 #30801supportKeymasterSorry for confusion. If OpenOCD is running on a Linux machine, indeed the “dump_image” command with a Windows path won’t work.
The easiest way to get it working would be to port the mbatch command from our OpenOCD fork (see this commit). You may need to adjust the code slightly, since the interfaces used by OpenOCD to implement custom commands change from version to version. You can use this fork as a reference. Once VisualGDB detects that OpenOCD supports the mbatch command, it will keep using it instead of dump_image.
June 28, 2021 at 21:13 #30802jerryottiiiParticipantok great thanks! ill try that
-
AuthorPosts
- You must be logged in to reply to this topic.