Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Heap 2 model into PIC18

Posted by Marcelo Adrian Lorenzati Sanz on July 27, 2008
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.



RE: Heap 2 model into PIC18

Posted by PICmeup on July 27, 2008
could be just memory fragmentation. Do you check the pvPortMalloc return value for null?

RE: Heap 2 model into PIC18

Posted by Marcelo Adrian Lorenzati Sanz on July 28, 2008
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 MOVFFPOSTINC0, PREINC1 to the portSAVE_CONTEXT and and a MOVFFPOSTDEC1, POSTDEC0 to the portRESTORE_CONTEXT but without success.

Regards


RE: Heap 2 model into PIC18

Posted by Marcelo Adrian Lorenzati Sanz on July 30, 2008
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.


RE: Heap 2 model into PIC18

Posted by Paul_Piak on July 31, 2008
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

RE: Heap 2 model into PIC18

Posted by Marcelo Adrian Lorenzati Sanz on July 31, 2008
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


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists