FreeRTOS Processor Expert bug with static memory allocation

cancel
Showing results for 
Search instead for 
Did you mean: 

FreeRTOS Processor Expert bug with static memory allocation

Jump to solution
627 Views
tamaslorincz
Contributor I

Dear NXP,

I created a new FREERTOS project from example for S32K144 in the SDK version 2.9.0:

pastedImage_1.png

The example compiles and runs fine, however I would like to use static memory allocation, therefore I change this setting in the Processor Expert:

pastedImage_2.png

This way a few new lines are added to the generated FreeRTOSConfig.h:

pastedImage_3.png

When I try to compile the code, the following error occurs:

pastedImage_4.png

There is a workaround for this (adding these few lines into the generated FreeRTOSConfig.h), which works, but it is not nice and gives warning messages while compiling:

pastedImage_6.png

This way the code is working and it compiles. Is there a better solution for overcome this issue?

Thank you very much.

1 Solution
178 Views
ovidiualexandru
NXP TechSupport
NXP TechSupport

Hi tamaslorincz‌,

There is indeed a defect in the Processor Expert component for FreeRTOS, which will be fixed for future releases.

Meanwhile, please use the following workaround for your project:

1. Check only the "Dynamic allocation" scheme Processor Expert component, and override with the "User Settings" option.

In the FreeRTOS PEx component, check only the "Dynamic memory allocation" checkbox:

pastedImage_3.png

Then, in "User Settings" tab, click on the "Definitions" button (with three dots):

pastedImage_4.png

In the window, add these lines:

/* Additional settings can be defined in the property Settings > User settings > Definitions of the FreeRTOS component */
#undef configSUPPORT_DYNAMIC_ALLOCATION
#undef configSUPPORT_STATIC_ALLOCATION

#define configSUPPORT_DYNAMIC_ALLOCATION         0
#define configSUPPORT_STATIC_ALLOCATION          1

pastedImage_7.png

Now, the static allocation will be used and dynamic allocation will be disabled. There is one more step to be done:

2. Exclude "heap_x.c" file from build

The Pex component will still link a heap_x.c file to the project at this point. You will need to exclude it by selecting it, right click -> Resource Configurations -> "Exclude from Build..." and select all options.

pastedImage_8.png

After this, the file should appear slightly greyed out and with a different icon, as below:

pastedImage_9.png

At this point, the setup is complete.

If you will need to use dynamic memory allocation as well, you will need to revert step 2 and remove the lines concerning configSUPPORT_DYNAMIC_ALLOCATION from the "User Settings" window.

Best regards,

Ovidiu

View solution in original post

5 Replies
178 Views
tibor_bekesi
Contributor II

Dear NXP,

Could you please check and confirm whether this bug is already fixed in S32 Design Studio for Arm version 2018.R1?

Best regards,

Tibor

0 Kudos
178 Views
ovidiualexandru
NXP TechSupport
NXP TechSupport

Hi tibor.bekesi@valeo.com‌,

Sorry for long delay. I can confirm the issue is fixed since S32 SDK S32K1xx RTM 3.0.0, which is included in Update 9 for S32 Design Studio.

Best regards,

Ovidiu

178 Views
tibor_bekesi
Contributor II

Hi Ovidiu,

Great! Thank you for your assistance. :smileyhappy:

Best regards,

Tibor

0 Kudos
179 Views
ovidiualexandru
NXP TechSupport
NXP TechSupport

Hi tamaslorincz‌,

There is indeed a defect in the Processor Expert component for FreeRTOS, which will be fixed for future releases.

Meanwhile, please use the following workaround for your project:

1. Check only the "Dynamic allocation" scheme Processor Expert component, and override with the "User Settings" option.

In the FreeRTOS PEx component, check only the "Dynamic memory allocation" checkbox:

pastedImage_3.png

Then, in "User Settings" tab, click on the "Definitions" button (with three dots):

pastedImage_4.png

In the window, add these lines:

/* Additional settings can be defined in the property Settings > User settings > Definitions of the FreeRTOS component */
#undef configSUPPORT_DYNAMIC_ALLOCATION
#undef configSUPPORT_STATIC_ALLOCATION

#define configSUPPORT_DYNAMIC_ALLOCATION         0
#define configSUPPORT_STATIC_ALLOCATION          1

pastedImage_7.png

Now, the static allocation will be used and dynamic allocation will be disabled. There is one more step to be done:

2. Exclude "heap_x.c" file from build

The Pex component will still link a heap_x.c file to the project at this point. You will need to exclude it by selecting it, right click -> Resource Configurations -> "Exclude from Build..." and select all options.

pastedImage_8.png

After this, the file should appear slightly greyed out and with a different icon, as below:

pastedImage_9.png

At this point, the setup is complete.

If you will need to use dynamic memory allocation as well, you will need to revert step 2 and remove the lines concerning configSUPPORT_DYNAMIC_ALLOCATION from the "User Settings" window.

Best regards,

Ovidiu

View solution in original post

178 Views
tamaslorincz
Contributor I

Thank you very much, it is working.