FreeRTOS+Trace with PIC32MX

chaabanemalki wrote on Friday, May 09, 2014:

Hello,
I’m currently testing FreeRTOS+Trace with a PIC32MX, the tool doesn’t support officially PIC32MX port yet.
So i was hoping if someone here might have a clue of the error i’m having here.
Basically I’m trying to open the ram dump into freeRTOS+Trace but i’m having this error :

“failed to load trace incomplete trace data (ended early) increase range of the ram dump”

I made sure to save the entire RAM into the mch file and i sill have this error

Any ideas how to fix this ?

Thank you

rtel wrote on Saturday, May 10, 2014:

Which version of FreeRTOS are you using? Version 8.x requires the latest FreeRTOS+Trace tool, whereas prior versions require a slightly older version. Is it possible you have a version mismatch?

Regards.

chaabanemalki wrote on Saturday, May 10, 2014:

I’m using FreeRTOS 8.0.0 and FreeRTOS+Trace 2.6

davedoors wrote on Sunday, May 11, 2014:

http://www.freertos.org/upgrading-to-FreeRTOS-V8.html#trace shows that is the right version. Are you sure you have a dump of the entire trace buffer. Try setting the trace buffer to a small size just to test. Can you open a trace when the buffer is really small, say 1.5K?

chaabanemalki wrote on Tuesday, May 13, 2014:

I had a load/ifetch exception, so I tried to be smart and halt the debug before this error happens and check what FReeRTOS+TRace give me but i guess this didn’t work that well.

In my code I have 2 tasks with only vTaskDelayUntil(). So far the exception seems to happen in random places and i’m finding it very hard to track it.

How can I track this kind of errors inside freeRTOS ?

rtel wrote on Tuesday, May 13, 2014:

Where do you end up when the exception occurs? If it is in a fault handler then you can get some information from the CAUSE register and try and work backwards from that to find the (actual) cause, but…

…if you only have two tasks, and the only function you are calling is vTaskDelayUntil(), and the only interrupt is the RTOS’s own tick interrupt, then there cannot be many things that could cause the problem.

Which heap_x.c implementation are you using, and what do you have configTOTAL_HEAP_SIZE set to? (http://www.freertos.org/a00111.html)

Did you base your application on one the official demo for that part, or did you create it from scratch yourself? If you used the official demo as a start, but the part number you are using is not the same as used in the official demo, did you ensure the project was targeted to the new chip (things like the linker script is correctly describing the memory on the device, etc.).

What do you have configMINIMAL_STACK_SIZE and configIRQ_STACK_SIZE set to in FreeRTOSConfig.h?

Regards.

chaabanemalki wrote on Tuesday, May 13, 2014:

->Where do you end up when the exception occurs?
I use _general_exception_handler provided along with the demo project and i didn’t change the device part (PIC32MX795F512L).

The cause is “load or ifetch” or"load/store" exception and the adress is in the flash memory. when i look it up in the program memory window, it seemed to be filled with RRRR (empty !!) : i’m still looking for the meaning of this.

I’m using heap_4.c and
configMINIMAL_STACK_SIZE ( 190 )
configISR_STACK_SIZE ( 250 )
configTOTAL_HEAP_SIZE ( ( size_t ) 28000 )

Does FreeRTOS take the defined configTOTAL_HEAP_SIZE amount from the predefined heap (in project properties) ?

And I didn’t add any linker script yet.

I believe most likely the problem is in traceTASK_DELAY_UNTIL() function since when i disable trace option via configUSE_TRACE_FACILITY, the program run with no problems. I coudln’t go far yet.

I tried to used the official demo projet but i got the same error.

rtel wrote on Tuesday, May 13, 2014:

Could it just be that the flash memory is not being programmed then? Can you do a ‘validate’ as part of the flash programming, or just read the program back to check it is as you expect?

Does FreeRTOS take the defined configTOTAL_HEAP_SIZE amount from the predefined heap (in
project properties) ?

No, the only time the predefined heap is used is if you include heap_3.c in your project - in which case configTOTAL_HEAP_SIZE has no effect. If you use heap_1, heap_2 or heap_4 (recommended) then configTOTAL_HEAP_SiZE dimensions an array that is used as the heap, and the predefined heap is not used at all.

traceTASK_DELAY_UNTIL()

Ah, ok, in which case I would guess you are trying to use the trace functions without first calling the trace library’s init function. Have a look at how the demos in the FreeRTOS download use the vTraceInitTraceData(); function: FreeRTOS Real Time Kernel (RTOS) / Code / [r2837] /trunk/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/main.c

Regards.

Regards.

chaabanemalki wrote on Wednesday, May 14, 2014:

Could it just be that the flash memory is not being programmed then?
I read the pic memory but had the same results.

I tried FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator and it works just fine, as expected ofcourse.

I would guess you are trying to use the trace functions without first calling the trace library’s init function

I called the vTraceInitTraceData() function before any call to FreeRTOS API functions, and I check the returned value of uiTraceStart() when I call it, to make sure that the recording started with no error which is the case.

I removed traceTASK_DELAY_UNTIL() yet I had the same exception. When debug step by step I coudln’t find any exception, but when stepping over functions (inside vTaskDelayUntil() )I find myself into the exception handler. Maybe an interrupt handler has been called while stepping over the function ? an caused the exception !!!, the only interrupt is the timer1 which is used and handled by the kernel.

Not sure how to find debug this further

Any ideas ?