Help with ARM Semihosting

Sysprogs forums Forums VisualGDB Help with ARM Semihosting

This topic contains 9 replies, has 2 voices, and was last updated by  support 3 weeks, 5 days ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #25823

    sidprice
    Participant

    Sorry for the many posts recently, I have been away from VGDB for a while and have forgotten some of the features.

    I have enabled the fast semihosting framework and rebuilt my stm32f401re project, however I am not seeing any semihost window or messages. What should I check to make this work.

     

    Many thanks,

    Sid

    #25824

    support
    Keymaster

    Hi,

    Please follow our Semihosting tutorial to get familiar with the related settings and mechanisms.

    BTW, we have over 300 different tutorials showing various aspects of VisualGDB and the supported targets, so if you don’t feel comfortable with some VisualGDB features or settings, feel free to search and follow other relevant tutorials to get back on track.

    #25825

    sidprice
    Participant

    More information:

    I have made a little progress, now I am getting an exception on line #58/59 of “FastSemihosting.cpp” :

    asm volatile(“mov r0, %1; mov r1, %0; bkpt %a2” ::”r”(&s_FastSemihostingState), “r”(SysprogsSemihostingReasonBase + kInitializeFastSemihosting), “i”(AngelSWI)
    : “r0”, “r1”, “r2”, “r3”, “ip”, “lr”, “memory”, “cc”);

    Received a SIGTRAP: Trace/breakpoint trap occurred

    #25826

    support
    Keymaster

    Please try following the tutorial EXACTLY and ensure it works as described. Then try comparing your setup with the tutorial to understand which of the differences could be causing the issue.

    #25827

    sidprice
    Participant

    Yes, the example code works for both normal semihosting and fast semihosting.

    Note that this project uses libOpenCM3 and not HAL. Semihosting has previously worked for the project.

    Sid

    #25828

    support
    Keymaster

    Sorry, it looks like something about libOpenCM3 might be interfering with semihosting. As it is a 3rd-party component that does not come from VisualGDB, it is hard to suggest anything specific.

    Our best advice would be to create a project as similar as possible to the one that works and then try comparing various settings of the projects that behave differently to find a setting that is causing the incorrect behavior.

    #25829

    sidprice
    Participant

    The exception I am getting is in the call to “puts”, this suggests that the issue is not related to libOpenCM3.

    Sid

    #25831

    support
    Keymaster

    Sorry, unfortunately we are not able to review specific projects and locate the settings that have been configured incorrectly as a part of our regular support. If the semihosting works for a newly created project, the issue is specific to a particular project instance and the only way to get it to work again would be by comparing the 2 projects and eliminating the differences between them.

    #25876

    sidprice
    Participant

    I have checked my project settings, as well as I can, against the demo project and see nothing that looks wrong. When I last worked on this, some months ago, semihosting worked for me. I would really appreciate some help in tracking this down.

    The failure mode is different for the regular and the fast semihosting. With the regular an exception is thrown when either puts or printf is called. With fast semihosting the following line in FastSemihosting.cpp causes an exception:

    asm volatile(“mov r0, %1; mov r1, %0; bkpt %a2” ::”r”(&s_FastSemihostingState), “r”(SysprogsSemihostingReasonBase + kInitializeFastSemihosting), “i”(AngelSWI)
    : “r0”, “r1”, “r2”, “r3”, “ip”, “lr”, “memory”, “cc”);

    Again, I understand you can’t debug user project settings, however, I am completely lost as to how to resolve this.

    #25904

    support
    Keymaster

    Sorry, if the 2 projects behave differently, something either about the project structure, or about the project settings is responsible for the difference.

    Normally, the line should cause a special type of exception that would be intercepted by VisualGDB’s semihosting logic, however if it doesn’t happen, something interferes with the exception reporting mechanism, preventing VisualGDB from recognizing it.

    The best way to diagnose this type or errors would be to start with a working project and slowly change it one step at a time until it is 100% equivalent to the broken one (i.e. uses the same sources, produces a comparable output, etc). If at this point the 2 projects still behave differently, simply use the new project file instead of the old one (although checking it into source control over the old one will likely reveal some differences).

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.