So I ported FreeRTOS. Tested the tick frequency with an oscilloscope. All fine but it seems I still have something to figure out.
I'm trying to test the demos found in the common directory. I'm taking for reference the official port to AT91SAM9XE. There are good news. All the demos work perfectly one running on their own. Then I have them run concurrently it seems the I'm running out of memory when vTaskStartScheduler is called.
The main starts by calling the functions that start the demos, creates a task that checks that the other tasks are runing and starts the scheduler.
I'm trying to debug this and when I call vTaskStartScheduler it will get stuck here eventually :
814 xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;; in the task.c file.
I'm using heap_2.c .
And you can have a look at my repo here : https://gitlab.in2p3.fr/colingd/freertos-template
Thanks in advance!
Yes, it would seem you are running out of memory.
If you are using heap2 then the amount of heap you have is defined by
configTOTALHEAP_SIZE. You can set that up until your application will
no longer link, the you know how much total heap you have. Be careful
to also remove any heap that is being allocated by your C run time (the
heap that is used when malloc() is called instead of pvPortMalloc()) -
otherwise it will just consume space that is never used.
You can then look at tuning the sizes of the stacks allocated to the
tasks. You can use the API or kernel aware plug-ins to see how much
task stack remains unused, and tune accordingly.
Thanks for answering! The answer nows seems obvious, I should have been more careful whilst reading the documentation and known better. I will look into this. However, the demo now works! I tried to publish my repo link to freertos interactive but I'm having issues with logging in freertos interactive.
Thanks for your time, it is greatly appreciated!
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.