MCUXpresso V11.5 FreeRTOS Heap Usage not working any more

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCUXpresso V11.5 FreeRTOS Heap Usage not working any more

Jump to solution
2,968 Views
ali2
Contributor II

FreeRTOS Heap Usage in MCUXpresso V11.2 works correctly, but for the same project in MCUXpresso V11.5, I get this message:

Could not load data for "Heap Usage" view probably due to missing heap related variable (try to define heap variables as "volatile" so they are not optimized out) or due to incorrect heap type identification (detected heap #1).

Make sure you have correctly defined "configFRTOS_MEMORY_SCHEME" macro in FreeRTOSConfig.h. TAD determines heap type either from MCUXPRESSO IDE's "FreeRTOSDEBUGConfig" structure (which uses "configFRTOS_MEMORY_SCHEME" define) or user defined variable "static const uint8_t freeRTOSMemoryScheme = <heap_type_used>;".

I have upgraded the IDE to get less bugs!

0 Kudos
1 Solution
2,859 Views
ali2
Contributor II

Well, it seems that the linker excludes the initialization of FreeRTOSDebugConfig[] from the final binary code since it cannot find any reference to this array in the project; as a work around we can use a linker option to force gcc to include the debug configuration data in the binary, regardless.

Specifically in MCUXpresso V11.5, we can go to the project properties >> C/C++ build >> Settings >> Tool Settings >> MCU Linker >> Miscellaneous and then add the following option for the linker:

--undefined=FreeRTOSDebugConfig

For more info see this 

Not sure why this was not a problem in previous versions!

Thanks

View solution in original post

12 Replies
2,860 Views
ali2
Contributor II

Well, it seems that the linker excludes the initialization of FreeRTOSDebugConfig[] from the final binary code since it cannot find any reference to this array in the project; as a work around we can use a linker option to force gcc to include the debug configuration data in the binary, regardless.

Specifically in MCUXpresso V11.5, we can go to the project properties >> C/C++ build >> Settings >> Tool Settings >> MCU Linker >> Miscellaneous and then add the following option for the linker:

--undefined=FreeRTOSDebugConfig

For more info see this 

Not sure why this was not a problem in previous versions!

Thanks

2,921 Views
ErichStyger
Senior Contributor V

Yes, this is what I use:

ErichStyger_0-1645641307963.png

On a side note: I'm using the McuLib FreeRTOS port, but that should not matter?

0 Kudos
2,920 Views
ali2
Contributor II

Thanks

0 Kudos
2,931 Views
ErichStyger
Senior Contributor V

I do use heap #4 a lot, and don't see any problems on my side:

ErichStyger_0-1645637840699.png

Could you check if that FreeRTOSConfig data structure had been linked with your application and is present?

ErichStyger_1-1645638385783.png

 

I hope this helps,

Erich

0 Kudos
2,925 Views
ali2
Contributor II

In my side, the debug info is not what it should be. e.g. FreeRTOSDebugConfig[5] which represent the heap type is always 1 not 4!

Is your screenshot from V11.5 ?

Thanks

0 Kudos
2,947 Views
ErichStyger
Senior Contributor V

What heap version are you using?

I was a aware that a previous (11.3?) had an issue with some heap types, but that got fixed (at least it was for me)?

Would be good if you could post more details to reproduce?

I hope this helps,

Erich

0 Kudos
2,938 Views
ali2
Contributor II

I use heap_4:

#define configFRTOS_MEMORY_SCHEME  (4)

Thanks

0 Kudos
1,992 Views
SpoonMan
Contributor IV

I had another (maybe stupid) reason why Heap Usage view was not working.

The following line must be added in FreeRTOSConfig.h:

#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 1

1,968 Views
ErichStyger
Senior Contributor V

Hi @SpoonMan ,

that makro alone does not help. What you need to have present in your application is a special structure with information for the debugger as in https://github.com/ErichStyger/McuOnEclipseLibrary/blob/master/lib/FreeRTOS/Source/include/freertos_...

 

Erich

0 Kudos
1,942 Views
SpoonMan
Contributor IV

Hi @ErichStyger 

that macro alone doesn't help, but without that macro other suggestions alone does not help too...

SpoonMan_0-1676881236025.png

If nobody is defining and setting configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H macro, then tasks.c is not including task C additions header... then nobody else is including such structure you're mentioning.

This is what I was pointing out, maybe my "I had another (maybe stupid) reason" wasn't clear?

 

0 Kudos
1,906 Views
lpcxpresso_supp
NXP Employee
NXP Employee

All code changes are already described in the FreeRTOS UG - see ch. 2.2.

Regards,
MCUXpresso IDE Support

0 Kudos
1,937 Views
ErichStyger
Senior Contributor V

Right. Thanks for make it clear.

0 Kudos