Hi, I proceeded to build and run blinky on my board and got an error “undefined reference to thread_switch_helper” after calling InitializeInstrumentingProfiler(). So I tried to patch the RTX kernel in the irq_cm4f.S file but there is no SVC_ContextSwitch label. Where should I put the code under? I tried pasting them under SVC_Context/SVC_ContextSave or even created a label on its own but none worked. Thanks.
The exact names and structure of the IRQ handlers slightly varies between different mbed versions.
In general, the thread_switch_helper callback is supposed to be called just before the mbed runtime switches the context to another thread, so the VisualGDB profiler could handle this event and update its internal structures accordingly.
If the version you are using does not have the SVC_ContextSwitch call, please try locating the logic responsible for loading the stack pointer (similar to SVC_ContextRestore on the screenshot in our profiling tutorial) and inserting the call to thread_switch_helper just before it.
Edit: we have just retested the VisualGDB profiling with the latest mbed release and updated the tutorial. As of mbed 6.16, the call to thread_switch_helper goes right after the SVC_ContextRestore label and needs to save/restore the LR register as well as shown in the updated tutorial.