MCUXpresso Heap Usage (FreeRTOS) reporting problem when using Heap 5 memory scheme

cancel
Showing results for 
Search instead for 
Did you mean: 

MCUXpresso Heap Usage (FreeRTOS) reporting problem when using Heap 5 memory scheme

Jump to solution
2,705 Views
Contributor II

Hi,

I'm using the MCUXpresso FreeRTOS SDK and switched over to the Heap 5 memory allocation scheme in order to use both memory regions on the MK22FN1M0VLK12 I'm using (64kB + 64kB).

However, I can no longer accurately analyse how the heap is being used as the Heap Usage table shows blocks that are not part of the heap and it is preventing the green/red bar visualisation from displaying properly.

I am getting a ~500MB block of memory being reported.

How can I fix this?


Thanks

2018-04-05 13_53_47-workspace - Develop - RAPPb_freertos_portable_port.c - MCUXpresso IDE.png

1 Solution
411 Views
NXP Employee
NXP Employee

As previously stated, we are investigating this issue with the FreeRTOS TAD view. Hopefully we can incorporate a fix in the next IDE release.

Regards,

MCUXpresso IDE Support

View solution in original post

34 Replies
348 Views
Contributor II

I now have a new problem...

I have updated to MCUX 10.2 and SDK2.3.1 (latest available for my chip).

I created a new project from scratch and placed my source in it, ensured that I followed the MCUX FreeRTOS Debug guide again and now I get the error shown in the screenshot:

2018-05-23 15_16_29-workspace - RAPPb_source_FreeRTOSConfig.h - MCUXpresso IDE.png

2018-05-23 15_17_08-workspace - RAPPb_freertos_include_freertos_tasks_c_additions.h - MCUXpresso IDE.png       2018-05-23 15_17_34-workspace - RAPPb_freertos_include_freertos_tasks_c_additions.h - MCUXpresso IDE.png

348 Views
Contributor V

Hi Mike,

I have the same problem, just reported to Erich: see the posts above.

Many thanks

Biafra

348 Views
NXP Employee
NXP Employee

In any case: if using FreeRTOS memory scheme 5, then the memory areas have to be in the array named xHeapRegions .

Because this is the symbol the plugin is looking for.

As used in the following example:

mcuoneclipse/FRDM-K64F_FreeRTOS_Heap5.c at master · GitHub 

I hope this helps,

Erich

348 Views
Contributor V

Hi BlackNight‌,

I reproduced the error, please read this post: https://community.nxp.com/message/1018070?commentID=1018070#comment-1018649.

Many thanks,

Biafra

348 Views
Contributor V

Hi BlackNight‌,

Did you reproduced the error?

Many thanks

Biafra

348 Views
NXP Employee
NXP Employee

I was not able to reproduce it.

348 Views
Contributor V

Hi BlackNight‌,

Not even using my project?

Many thanks

Biafra

348 Views
NXP Employee
NXP Employee

I tried to replicate it with a K64 (as I don't have a K66).

Your screenshots show to me that if you want to display the RTOS data while the data is inconsistent (not all information stored), then I'm not surprised that the TAD might show no data because the Kernel did not save all the data. This is what I see in your first screenshot.

And for the last screenshot: the memory heap/regions can only be shown correctly after vPortDefineHeapRegions() which is expected for me?

I hope this helps,

Erich

348 Views
Contributor V

Hi BlackNight‌,

I've just installed the new MCUXpresso 10.2.1 version, coming with TAD 1.0.6: now it works fine.

Many thanks

Biafra

348 Views
Contributor V

Hi BlackNight‌,

I've found this error when I tried to access to open the heap view:

pastedImage_1.png

It seems that it can't access to some informations it needs.

Many thanks

Biafra

348 Views
Contributor V

Hi BlackNight‌,

Just to clarify my situation.

I used two projects: the one that shows the problem is the real application, while the other, correctly displayed, is the test application.

All the screenshots above have been taken after the vPortDefineHeapRegions() function have been executed.

Using both projects, before the execution of the vPortDefineHeapRegions() function, the heap is displayed as in the lower pane of my first screeshot (it shows no data), I think this is the normal behaviour.

Using the test project, immediately after the execution of the vPortDefineHeapRegions() function, the heap is displayed correctly.

Using the real application project, the heap continues showing no data even after the execution of the vPortDefineHeapRegions() function, until the vQueueAddToRegistry() function is executed: from that moment on the error is displayed in the heap pane.

Using the test project, but after I changed the properties to relocate it at the address 0x10000 using a boot loader, the behaviour is the same as using the real application project (the real application starts at address 0x10000 too).

The test project I attached is the one modified to start at address 0x10000.

Maybe the error is related to the relocation process and it can be reproduced even using K64.

Many thanks

Biafra

348 Views
Contributor V

Hi BlackNight,

I just did some investigations.

This is the situation in my working application before I got the error: in the heap view there is no data, the PC value is 0x00020168, the address of the next instruction to execute.

pastedImage_2.png

This is the situation immediately after I got the error (I did step with instruction stepping mode active).

pastedImage_4.png

pastedImage_5.png

pastedImage_6.png

pastedImage_7.png

This is the situation in a correctly displayed demo application: it's immediately after the return from the vPortDefineHeapRegions() function, while in the previous application at the same point there was no data in the heap view.

pastedImage_8.png

Many thanks

Biafra

350 Views
NXP Employee
NXP Employee

Hi Mike,

what version of the FreeRTOS plugin are you using? It seems to me you are using V1.0.1 which indeed had this issue. There is a V1.0.2 availble (update site: http://freescale.com/lgfiles/updates/Eclipse/KDS) which shows correctly for me two heap regions with 64KByte (Setup in MCUXpresso IDE as in Using Multiple Memory Regions with the FreeRTOS Heap | MCU on Eclipse ).

Maybe you can give V1.0.2 a try? The public release mentioned to be expected end of May should come with this (and other fixes too), but until then you could try V1.0.2 plugin.

I hope this helps,

Erich

350 Views
Contributor V

Hi Erich,

I'm trying the new pulgin version, but it still displays wrong informations:

pastedImage_1.png

In the higher pane the sum of free space is not correct and there is not the green bar showing it.

In the lower pane the block size include the non existing space between two different blocks.

Many thanks

Biafra

350 Views
Contributor V

Hi everyone,

I've just downloaded and installed the latest MCUXpresso 10.2.0 where there is the updated FreeRTOS aware plugin.

Using memory scheme 5, in the heap usage view I get this error:

pastedImage_1.png

I've just read the document https://www.nxp.com/docs/en/quick-reference-guide/MCUXpresso_IDE_FreeRTOS_Debug_Guide.pdf and all the steps are correctly done.

What can I do to display the correct informations?

Many thanks

Biafra

350 Views
NXP Employee
NXP Employee

Hi Francesco,

could you share your FreeRTOSConfig.h and freertos_tasks_c_additions.h?

Erich

350 Views
Contributor V

Hi Erich,

Just done.

Many thanks

Biafra

350 Views
NXP Employee
NXP Employee

Hi Biafra,

your files look fine.

I believe it could be an include order problem on your side, as I'm not able to replicate this on my end.

Can you change that value below to 5 and give it a try?

pastedImage_1.png

Erich

350 Views
Contributor V

Hi Erich,

I set configFRTOS_MEMORY_SCHEME to 3 in FreeRTOSConfig.h.

In my system in freertos_task_c_additions.h file the lines 75 to 77 are grayed (configFRTOS_MEMORY_SCHEME has already been defined in FreeRTOSConfig.h).

Now I get this error:

pastedImage_1.png

Many thanks

Biafra

350 Views
NXP Employee
NXP Employee

Hi Biafra,

I was under the impression you are using scheme 5?

I think I would need to see the whole picture. It looks to me something is strang in your setup. Would it be possible that you could share a project to reproduce this? You don't have to include your custom code, just the project with the SDK and FreeRTOS and its configuration?

Erich