How to correctly create SDK that contains FreeRTOS

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

How to correctly create SDK that contains FreeRTOS

Jump to solution
2,223 Views
edward_c_sewell
Contributor II

I'm a newbie as regards micro-controller programming and what I really want to learn is to use FreeRTOS on a microcontroller.

To begin with I have installed the MCUXpresso IDE (11.1)  and using the MCUXpresso SDK Builder I've created an SDK for the LPCXpresso804(LPC804). I've successfully installed this SDK into the MCUXpresso IDE.

From my reading of the NXP documentation I expected the SDK to contain the required code files to allow me to create a new project using the FreeRtos as the operating system for all Cortex 'M' controllers, in my case the LPC804..

From the 'Operating Systems' tab on the 'Configure the  Project' dialog of the MCUXpresso IDE there is only the option of 'baremetal'.

At this point I'm wondering if I have made an error when creating the SDK as I might have expected a configure project option to allow me to use RTOS as the operating system for the micro-controller.

I'd appreciate if somebody could comment on what I have done so far and in particular how to correctly create a SDK that will allow me to select FreeRTOS as the OS for the micro-controller.

Thanks

Ed

Labels (1)
1 Solution
2,054 Views
ErichStyger
Senior Contributor V

Hi Ed,

I described it for my LPC845-BRK (I don't have any LPC804), but I assume it is the same for your LPC804:

Tutorial: Adding FreeRTOS to where there is no FreeRTOS | MCU on Eclipse 

I hope this his helpful,

Erich

View solution in original post

0 Kudos
9 Replies
2,054 Views
ErichStyger
Senior Contributor V

FreeRTOS is not included in the SDK for the LPC804 (same for the LPC845 which I'm using in my projects (e.g. see “60 Billion Lights”: 2400 RGB LEDs and 120 Stepper Motors hiding behind Canvas Art | MCU on Eclipse  which uses 15 LPC845 running FreeRTOS). The LPC845 has more RAM, but 4 KByte is enough for running FreeRTOS (I have been using it on 1K RAM devices too).

So while it is not included in the SDK, it is easy to have it added to any SDK project. If this is of interest, let me know and I see if I can come up with a quick tutorial how to do this.

I hope this helps,

Erich

0 Kudos
2,054 Views
edward_c_sewell
Contributor II

Hi Erich,

I've followed your tutorial and have now added FreeRTOS to the MCUXpresso project for the LPC804.

Problem is that there is now an over-commit on the SRAM. The LPC804 has 4K SRAM.

Output from the linker.

Memory region          Used Size    Region Size    %age Used
PROGRAM_FLASH: 17948 B       32640 B          54.99%
BOOT_FLASH:          0 GB            128 B             0.00%
SRAM:                       9476 B          4064 B          233.17%

I note your previous comment that you have had FreeRTOS working on 1K RAM devices which makes me wonder if I have mis-configured the FreeRTOS somehow or if I can configure the FreeRTOS to use less RAM.

If I can't reduce the RAM usage then this is the end of my hopes to start using FreeRTOS on the LPC804. 

Ed

0 Kudos
2,054 Views
ErichStyger
Senior Contributor V

Ed,

by default the FreeRTOSconfig.h uses 8KB for the heap.

Either change the

configTOTAL_HEAP_SIZE

in McuLib/config/FreeRTOS.h

or better (what I recommend) have the following in your IncludeMcuLibConfig.h:

#define configTOTAL_HEAP_SIZE                (3*1024)

Change that heap size to what you need, but 3K is a good start.

I hope this helps,

Erich

0 Kudos
2,054 Views
edward_c_sewell
Contributor II

Erich,

Thank you for your suggestion.

I had to tweak the configTOTAL_HEAP_SIZE value to allow the simple FreeRTOS example to work. Example contains a single xTaskCreate() call and vTaskStartScheduler() call which used a total of 2.5K SRAM. On my LPC804 this leaves no free SRAM to create any more tasks or queues etc. 

Seems like I'll now how to upgrade my development board to one with more SRAM  if I want to explore the functionality of FreeRTOS further.

Ed

0 Kudos
2,054 Views
edward_c_sewell
Contributor II

Hello Erich,

Thanks for your reply. Yes, I'm very much interested in knowing how to add FreeRTOS to the SDK for the LPC804. 

Ed

0 Kudos
2,055 Views
ErichStyger
Senior Contributor V

Hi Ed,

I described it for my LPC845-BRK (I don't have any LPC804), but I assume it is the same for your LPC804:

Tutorial: Adding FreeRTOS to where there is no FreeRTOS | MCU on Eclipse 

I hope this his helpful,

Erich

0 Kudos
2,055 Views
edward_c_sewell
Contributor II

Hi Erich,

I've had a first read through of your tutorial and I think I can follow  along given that I'm a newbie with the LPC804 board and the MCUXpresso IDE. 

I appreciate your efforts in putting together the tutorial and I'm sure others will as well.

Ed

2,055 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Ed:

There is no FreeRTOS support for LPC804 SDK.   You can only select CMSIS DSP library, FreeMASTER and safety components.   No FreeRTOS support in this list.

LPCXpresso804 only has 4KB RAM

pastedImage_1.png

pastedImage_2.png

Regards

Daniel

0 Kudos
2,055 Views
edward_c_sewell
Contributor II

Hello Daniel,

Do you know what rule/criteria the SDK builder applies to decide whether FreeRTOS is added as an option or not to the SDK?

I suspect that the SDK Builder may be using the selected board's available RAM value as criteria. As a test I selected (at random) the board LPCXpresso51U68. This board has 96KB RAM

pastedImage_1.png

And here the optional FreeRTOS is available.

pastedImage_2.png

Thanks

Ed

0 Kudos