Heap 2 model into PIC18

Hi People I wonder if you could help me with this. I´ve been trying for a while Freertos on PIC18 microcontrollers with heap_1 model but now I´m using the heap_2 model and I find an erratic behaviour. I´m doing a ks108 graphic lcd driver for freertos and I wanted it to be with dinamical allocation of objects. It was working relatively ok but now It dont. I´ve modified the linker script for 18F4620 and I´ve been looking in the forum about the portCOMPILER_MANAGED_MEMORY_SIZE issue but couldn´t solve it. Some task (like the line primitive) when it is context switched get his stack data corrupted. I´m planning to donate the effort so any kind of help would be accepted. Is it possible to use it with heap 2 model? If so what I should do to use it correctly? Let me know and I´ll send you the code, it does some nice things with the LCD :) Best regards.

Heap 2 model into PIC18

could be just memory fragmentation. Do you check the pvPortMalloc return value for null?

Heap 2 model into PIC18

Hi PICmeup, As example, when the line "initiator" is called asks for a semaphore. If not Null, it takes the semaphore and starts the line task passing multiple parameters by reference, the semaphore handles is between them. When the line task ends it "gives" the semaphore and wakes up the "initiator". I do not receive a NULL to the semaphore and the task initiates correctly BUT when the line task gets context switched a variable used to store the slope of the line is corrupted. I´ve made a change to the port for PIC18 as others in the forum tried changing portCOMPILER_MANAGED_MEMORY_SIZE to 0x14 and adding a MOVFF    POSTINC0, PREINC1 to the portSAVE_CONTEXT and and a MOVFF    POSTDEC1, POSTDEC0 to the portRESTORE_CONTEXT but without success. Regards

Heap 2 model into PIC18

No one has an answer on this? Is heap_1 the only possible memory model for PIC18? What do I have to do? start before the scheduler all tasks to allocate memory on the queue, suspend them and then restarted when needed when I need a Task to work when called? Best regards.

Heap 2 model into PIC18

Hi, If you change portCOMPILER_MANAGED_MEMORY_SIZE, you should understand that it should be 1 less than .tmpdata+.mathdata See this message: http://sourceforge.net/forum/message.php?msg_id=3826722 Paul

Heap 2 model into PIC18

Thanks Paul_Piak, I’ve read It. I’ve just tried everything to make it work, but without success. I tested malloc and free implementations in heap 1 and heap 2 models alone (without starting the OS) and they work fine on the PIC18, that’s why I think the problem is with the port implementation for PIC18. Just when the task get context switched the data gets corrupted. Has anyone tried heap_2 model into PIC18? Whats the maximum configMINIMAL_STACK_SIZE for this microprocessor? Regards