Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic GDB and semihosting/SWO (Read 6618 times)
rml
Junior Member
**
Offline


Posts: 38
Joined: Aug 29th, 2016
GDB and semihosting/SWO
Apr 20th, 2017 at 9:08am
Print Post  
Hello,

Has anyone tried GDB semihosting with Visual Studio/Micro? Or SWO tracing?
Thanks,

Armel
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB and semihosting/SWO
Reply #1 - Apr 20th, 2017 at 10:43am
Print Post  
we could put in semi hosting but that the difference between that and adding some trace points?

+

I haven't played with it much but VS gdb has a "Command" debug window where you can make manual commands and settings changes during an active debug session. for example "monitor xyz"

« Last Edit: Apr 20th, 2017 at 11:02am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
rml
Junior Member
**
Offline


Posts: 38
Joined: Aug 29th, 2016
Re: GDB and semihosting/SWO
Reply #2 - Apr 20th, 2017 at 12:14pm
Print Post  
We sometimes have boards without USB or UART connectors, so the only way to get debug messages out is through the SWD connector.

My understanding is that here are 2 ways to do it:
* semihosting
* on Cortex M3 and above, there seems to be a dedicated feature (SWO) meant for that usage, at a much smaller cost in terms of memory and performance

Is there another option?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB and semihosting/SWO
Reply #3 - Apr 20th, 2017 at 12:18pm
Print Post  
SoftwareSerial with ftdi cable on one or two digital pins is available now but I will try semihosting when I get a chance so hopefully that would give a terminal.

Otherwise you can use non-stopping breakpoints which can be trace messages combined with variable data but it's not as fluid or flexible as messages
« Last Edit: Apr 20th, 2017 at 12:19pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
rml
Junior Member
**
Offline


Posts: 38
Joined: Aug 29th, 2016
Re: GDB and semihosting/SWO
Reply #4 - Apr 20th, 2017 at 12:22pm
Print Post  
thanks - will try using non-stopping breakpoints as a quick workaround.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB and semihosting/SWO
Reply #5 - Apr 22nd, 2017 at 1:30pm
Print Post  
There is a new release of the main plugin that might help http://www.visualmicro.com/forums/YaBB.pl?num=1491650979/0#0

You should also take a look at the command window when debug is running. The Gdb Console commands are executed using Debug.MIExec

The latest release caters better for the return value of commands such as Debug.MIExec help and Debug.MIExec list

The latest release also has some gdb hooks allowing you to enable some events early on. More hooks can be added if they are needed.

You can add this type of syntax to the project board.txt or the hardware platform.txt as usual:-

Code
Select All
# Gdb override target_selected: fires after the target is selected and prior to halt
#
recipe.hooks.gdb.post_target_selected.1.pattern=monitor arm semihosting enable
recipe.hooks.gdb.post_target_selected.2.pattern=set mem inaccessible-by-default off
recipe.hooks.gdb.post_target_selected.3.pattern=monitor arm reg
recipe.hooks.gdb.post_target_selected.4.pattern=monitor arm semihosting_fileio enable 



I can see semihosting getting enabled but have not yet been able to use printf or any other mechanism that causes output to gdb. If you can get this work so that gdb produces some output for semihost messages that would be a good start.

When a gdb session completes visual micro writes logs to the project/configuration name/logs/gdb folder. The "gdb-to-vm" log will be the most useful initially to see if we can get semihosting messages coming through. The log is the raw output from gdb. In vm-to-gdb you will see your hooks being sent to gdb.
  
Back to top
WWW  
IP Logged
 
rml
Junior Member
**
Offline


Posts: 38
Joined: Aug 29th, 2016
Re: GDB and semihosting/SWO
Reply #6 - Apr 22nd, 2017 at 2:25pm
Print Post  
Thanks Tim, we will try to get semihosting up and running!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB and semihosting/SWO
Reply #7 - Apr 22nd, 2017 at 2:44pm
Print Post  
Thanks, + if you get any swo ip messages we could pick them up easily enough too.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint