I'm trying to use the STM32CubeIDE's Serial Wire Viever Statistical Profiling tool. The problem I face with is that the result table does not show all functions visited. I, especially, want to see the functions from my own 'mySource.c' file. I tried to add a 500ms delay into some of them, but even then I couldn't see any entry for them in profiling table. I'm sure that those functions are visited at least one time. Also, an entry named "Unknown function" is in table somehow. It has an instruction address of 0x80033F4, which is located at the very end of machine code, in a function named "_fini". What do you think that I'm doing wrong?

  • \$\begingroup\$ Is this a valid EE question? \$\endgroup\$
    – Andy aka
    Commented Dec 16, 2019 at 9:36
  • 1
    \$\begingroup\$ @Andyaka might be pretty microcontroller-debugging-specific \$\endgroup\$ Commented Dec 16, 2019 at 9:37

1 Answer 1

  1. Compilers will inline functions if their call-chain is trivial, so that it looks like your function doesn't exist
  2. Sometimes, that can also lead to emission of "anonymous functions"
  3. A debugger can't know in what function it is if the stack frame isn't set up in a way the debugger understands. That's a common problem with interrupt handlers, or if you're using an operating system on your target that the debugger doesn't understand.
  4. Your "delay" is quite possibly not a time spent in that function, but actually a call to the RTOS to commence execution at that point in 500 ms and do something else or go to sleep in the meantime.
  5. _fini is a function name that you find in UNIX-targetting shared libraries. It's what the runtime loader calls before it tries to unload a shared library. I'm pretty sure you don't have shared libraries on an STM32, so that symbol should not exist. You're probably not using the right linker scripts and the wrong EABI for your compiler. Have you perhaps been trying to link against some shared library by accident? For example the fully-fledged libc?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.