Skip to main content
Associate III
May 14, 2024
Solved

Debug inline assembler code

  • May 14, 2024
  • 1 reply
  • 2087 views

Hi,

I have a inline assembly code to implement some math, like:

************************************
C-Code...

asm(

" push {%5};"

" lsl %5, 1;"

" add %5, %3;"

...

);

C-Code

*******************************************************
Unfortunately I`m not able to step through this code. What I have done so far:

1. Set breakpoints inside asm code -> not reached
2. Set breakpoint before asembly code and try to step inside the inline asm code -> By the time I step inside the asm code, the debuger is "busy" as if it would be in run mode and sometimes it crashes and the debug session is over.

3. In Project build settings I have selcted the maximum debug level -g3 -> no effect

4. I have set optimization to "none" -> no effect

5. open the disassembly perspective and try to debug the code there -> same behavior as in 2.

I only can say that the debug code is doing the math, I can see the results, but for some changes I`d like to debug this asm code.

Anyone has any idea of what else I can do to get it done?

Thank you for any hint.

Benedikt

 

    Best answer by berait

    Thank you Semer CHERNI!

    I have solved it by generating a dedicated assembler file and add it to my project. Inline assembly is

    not suitable for debugging. 

     

    regards

    1 reply

    Semer CHERNI
    ST Employee
    June 3, 2024

    Hello @berait 

    First le me thank you for posting.

    Please try to check this post it should helps Solved: How to run assembly code in stm32 cube ide? (NUCLE... - STMicroelectronics Community

    KR,
    Semer.

    To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
    beraitAuthorBest answer
    Associate III
    June 3, 2024

    Thank you Semer CHERNI!

    I have solved it by generating a dedicated assembler file and add it to my project. Inline assembly is

    not suitable for debugging. 

     

    regards

    Andrew Neil
    Super User
    June 3, 2024

    @berait wrote:

    I have solved it


    then please mark your post as the Solution.

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.