Quality RTOS & Embedded Software

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




Loading

Exception

Posted by Ake Hedman on November 21, 2008
I'm a bit stuck here and need some suggestions

On PIC32MX using the standard "sys_arch.c" the procedure sys_sem_new is called and in this routine a semaphore is created by calling vSemaphoreCreateBinary which at some points call pvPortMalloc (allocating 0x4c bytes) and which at the end calls prvInsertBlockIntoFreeList This throws an exception and I end up in the _general_exception_handler.

I am trying to find a possible cause for this but as been unsuccessfull so far. Any tips what to look for here would be appreciated.

Cheers
/Ake

RE: Exception

Posted by Richard on November 21, 2008
Are you creating an lwIP port for the PIC32?

Can you confirm that prvHeapInit() is getting called the first time you call pvPortMalloc()? If there is something wrong in the startup code or linker script then it could be that the variable xHeapHasBeenInitialised is not being initialised to zero, which would prevent prvHeapInit() being called, which could cause a crash.

Also, do you have portBYTE_ALIGNMENT set to 4 (this is defined by the kernel in portmacro.h, so it should already be set to 4)?

Regards.

RE: Exception

Posted by Ake Hedman on November 21, 2008
>Are you creating an lwIP port for the PIC32?

Yes PIC32MC, lwIP 1.3.0, ENC28J60

>Can you confirm that prvHeapInit() is getting called the first time you call pvPortMalloc()?

Yes can confirm that.

>Also, do you have portBYTE_ALIGNMENT set to 4

yes.

btw I am using heap_2.c


I noticed that pxNewBlockLink->xBlockSize on line 220 of heap_2.c got a crazy value before the error. Its 0x0400FFAB. I will see if I can find the cause of this.

Cheers
/Ake

RE: Exception

Posted by Ake Hedman on November 21, 2008
Looks like I use all memory...

RE: Exception

Posted by Dave on November 21, 2008
Can you increase configTOTAL_HEAP_SIZE in FreeRTOSConfig.h?

RE: Exception

Posted by Ake Hedman on November 21, 2008
Yes I know. I have tried to increase it to 10K bytes but that does not help. Something takes a lot of memory here. The biggest taker is memp.o of lwip as far as I can see which also claims about 10K. I expected lwip to use less then 10K total. Hrm see if I can tweek it.

RE: Exception

Posted by Ake Hedman on November 21, 2008
lwIP have its own Heap size

/* MEM_SIZE: the size of the heap memory. If the application will send
a lot of data that needs to be copied, this should be set high. */
#define MEM_SIZE 2000

is this valid? Is't the FreeRTOS heap used?


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




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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

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

OpenRTOS and SafeRTOS