This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi everybody,
I'm using FreeRTOS with my TI Hercules project, generated by HalCoGen and I want to use the SEGGER SystemView to debug my project.
I'm having problems porting the tracing code to the kernel.
For example, the official Segger patch requires to modify the xPortSysTickHandler function which does not exist in the TI port.
diff -rupN org/FreeRTOS/portable/GCC/ARM_CM0/port.c new/FreeRTOS/portable/GCC/ARM_CM0/port.c --- org/FreeRTOS/portable/GCC/ARM_CM0/port.c 2020-12-15 19:54:26.000000000 +0100 +++ new/FreeRTOS/portable/GCC/ARM_CM0/port.c 2021-03-03 10:20:34.000000000 +0100 @@ -359,13 +359,19 @@ void xPortSysTickHandler( void ) uint32_t ulPreviousMask; ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR(); + traceISR_ENTER(); { /* Increment the RTOS tick. */ if( xTaskIncrementTick() != pdFALSE ) { + traceISR_EXIT_TO_SCHEDULER(); /* Pend a context switch. */ portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } + else + { + traceISR_EXIT(); + } } portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask ); }
We also need to define the SEGGER_SYSVIEW_X_GetInterruptId() function.
Any idea how to get the IRQ interrupt number?
Is there a guide on using the TI port of FreeRTOS with SystemView?
How can I port the TI kernel to use SystemView?
Regards,
Gabriel
Hi Gabriel,
We started to be working on your issue and we will provide an update soon.
--
Thanks & Regards,
Jagadish.
Hi Jagadish,
Here's some update since I wrote this question.
I'm still not sure what to do for the systick handler.
I manage to implement SEGGER_SYSVIEW_X_GetInterruptId using the TI PMU.
There's still some problem with this solution (see my other e2e issue), but I'm getting close.
I also implemented SEGGER_SYSVIEW_X_GetInterruptId using the IRQVECREG register.
I'm not sure if it's the proper way to do it. If you have any ideas, let me know.
My biggest problem right now is the friction between portRAISE_PRIVILEGE and portENTER_CRITICAL().
Let me give you an example:
My task call vTaskDelay.
As expected, it goes inside an MPU wrapper function so its privilege is raised
Inside vTaskDelay, FreeRTOS gives us the ability to trace this event using traceTASK_DELAY() which is defined as SEGGER_SYSVIEW_RecordU32x3()
SystemView, our tracing engine, wants to make sure the tracing operation will be atomic.
So it wraps its logging function with RECORD_START() and RECORD_END().
Those wrappers are called FreeRTOS portENTER_CRITICAL() and portEXIT_CRITICAL().
The problem is when RECORD_END() is called, portEXIT_CRITICAL() resets our privilege.
Causing an MPU Crash.
Do you see a way of resolving this conflict between portRAISE_PRIVILEGE and portENTER_CRITICAL() ?
Sorry for the big follow-up.
I hope it is helpful for other forum users.
Best regards,
Gabriel
HI Gabriel,
Transferring the thread to an expert.
--
Thanks & Regards,
Jagadish.
Hi Jagadish,
Thanks for your answers.
I'm slowly progressing, but I'm still encountering problems as you can see in my new issue.
Hi Cabriel,
I don't know what portEXIT_CRITICAL() do in your project. If portEXIT_CRITICAL() is to re-enable the interrupt, and this function is called inside an interrupt service routine, but nested interrupt is not supported by TMS570 ARM-R devices, so data abort may be generated.
In HAL freeRTOS example, the RTI compare 0 is used to generate timer ticks.
HI QJ,
Sorry for the delay, something else needed my attention in the past 2 weeks.
portEXIT_CRITICAL is a function provided by HalCoGen's port of FreeRTOS if I'm not mistaken.
While I still need support for using SystemView with TI software, I have opened a new issue on the forum that specifically targets the ISR problem:
portEXIT_CRITICAL is a function provided by HalCoGen's port of FreeRTOS
Yes, but it is a empty function. Hercules devices don't support nextes interrupt. The IRQ is disabled automatically when an IRQ interrupt is serviced.