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:
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++).
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.
- I can either fetch it from the thread's stack frame leftover from a previous context switch and hope it's up to date.
- The thread's stack pointer is not saved to the thread's control block, so I have to read the `PSP` register directly.
- If the MCU is in thread mode - no problem: access the live 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.
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 ().