[ABANDONED] RTX/Mbed RTOS Plugin

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] RTX/Mbed RTOS Plugin

    Hello,

    For the past few days I've been working on developing an RTXv5 (or Mbed) RTOS awareness plugin for the Jlink GDB Server.

    I seem to have gotten the thread detection working properly, and now I'm working on threads' register access.

    To accurately represent the current state of the threads' registers, I must to properly determine multiple parameters:
    • To access the registers of an inactive thread, no problem: find its stack pointer and read/write the values from RAM.
    • To access the registers of the currently running thread, there are some edge cases:
      • If the MCU is in thread mode - no problem: access the live CPU registers.
      • If the MCU is in IRQ mode - the registers are saved on the thread's stack, but:
        • The thread's stack pointer is not saved to the thread's control block, so I have to read the `PSP` register directly.
        • To determine whether the FPU registers were stacked, I need access to the `LR` register:
          • I can either fetch it from the thread's stack frame leftover from a previous context switch and hope it's up to date.
          • If the device was stopped right after a vector catch (can determine through `DFSR`), I can read the live LR register.




    In conclusion, I need access to the following CPU registers:



    • `PSR` (`IPSR`) - Find out if the CPU is in thread or IRQ mode.
    • `PSP` - Get the thread's SP if in IRQ.
    • `LR` - Find out if the FPU registers were stacked.
    Currently the Plugin SDK does not offer access to the CPU registers, so I'm kind of stuck.

    Any help or ideas would be greatly appreciated!

    Thanks,
    Tal

    EDIT: Also, while I'm at it: the SDK provides memory allocation functionality, am I right to assume I'm supposed to use those instead of directly calling malloc/free (or new/delete if coding in C++).

    The post was edited 2 times, last by risint96 ().

  • Hello Tal,

    Could you please update the SDK?
    The current API provides access to CPU registers:

    //
    // API version v1.1 and higher
    //
    U32 (*pfReadReg) (U32 RegIndex);
    void (*pfWriteReg) (U32 RegIndex, U32 Value);

    For now, it should also be possible to use standard memory allocation, but we recommend to use the functions provided by the SDK.

    Best regards
    Arne
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.