Relationship between PSoC Creator heap/stack and FreeRTOS heap/stack - Cypress.com Forums http://www.cypress.com/? Re: Relationship between PSoC Creator heap/stack and FreeRTOS heap/stack http://www.cypress.com/?rID=52686 Thanks Richard, that's exactly the information I was looking for.

What I had meant by "If I understand properly there isn't any dynamic allocation at all by default, right? Or is there?" is that I couldn't find any definition for malloc(..) in the autogenerated Cypress libraries or any calls to it, so I wasn't sure if there even was a way to allocate things from the heap whose size is controlled by PSoC Creator.

I take your answer to mean that the definition is around somewhere, and so it can be used from user-written code?

Again, thanks very much.

 

]]>
Sat, 02 Jul 2011 17:00:29 -0600
Re: Relationship between PSoC Creator heap/stack and FreeRTOS heap/stack http://www.cypress.com/?rID=52680 > The PSoC Creator design-wide resources editor has system parameters

> for heap size and stack size. What exactly is stored in this heap?

 

Presumably, as per normal, memory returned by any call to malloc() will come from the heap.

 

>If I understand

> properly there isn't any dynamic allocation at all by default, right? Or is there?

 

?

 

> Do I need to set it up so that my FreeRTOS heap size < the PSoC Creator heap size?

 

Please see the memory management section of the FreeRTOS.org web site.

In this case, FreeRTOS does not use the heap set up by the Cypress tools unless heap_3.c is included in your project, and it uses the stack set up by the Cypress tools as the interrupt stack.

 

> I'm thinking no, because I think the FreeRTOS heap reservation just reserves another

>area entirely?As far as the stack parameter is concerned, how does this interact with

>the FreeRTOS stack? Again, if I understand correctly, FreeRTOS allocates space for

> task stacks from its own heap when the task is created. (I'm pretty sure about this,

> because the stack size is dynamically supplied to the task creation function.)

 

Yes - as per the link above.

 

> Does this mean that I can get away with a very small PSoC Creator stack size, because

> that stack is only used for initialization stuff and for the scheduler itself, and is disjoint from

> the actual task stacks?

 

It needs to be at least big enough for main to run to the point where vTaskStartScheduler() is called, and at least big enough to hold a complete interrupt stack frame, which may be nested several interrupts deep, depending on what your application is doing.

 

Regards,

Richard.

 

FreeRTOS

Designed for Microcontrollers, more than 7000 downloads per month

]]>
Sat, 02 Jul 2011 01:45:33 -0600