FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2013 Threads] Timer Interrupt stop working after mallocPosted by Ricardo Crudo on August 19, 2013 I am using the FreeRTOS V7.4.2 with ARM-CM3 port (NXP LPC1788) and GCC cross compiler. Below is a pseudo code to reproduce my trouble: void main() { setup_timer1_with_interrupt_1ms();
/* when the two below lines are commented, all works fine */ char *p = pvPortMalloc(16); if (p) turn_on_led2();
while(1); the_function(); // task creations and other setups
vTaskStartScheduler();
}
void timer1_handler(void) { count_until_500_and_toggle_led1(); }
When I run this piece of code the led1 don't blink and the led2 turn on, but when I comment the malloc line the led1 blink, so, the Time1 interrupt stop working after allocate memory. I knew that malloc disable/re-enable the interrupts, so, Is possible that re-enable is not restoring the interrupts properly?
RE: Timer Interrupt stop working after mallocPosted by Ricardo Crudo on August 19, 2013 I noticed that after the scheduler is started the interrupt works properly. Is not possible use the interrupts while the scheduler is not running, even with timer priority out of configMAX_SYSCALL_INTERRUPT_PRIORITY range?
RE: Timer Interrupt stop working after mallocPosted by Richard on August 19, 2013 We always recommend leaving interrupts disabled until the scheduler has started, and, as your found out, if you call certain (most) API functions before the scheduler has started then interrupts will be left masked when the API function exits. Interrupts will automatically be enabled when the scheduler starts.
However, I would only expect interrupts below configMAX_SYSCALL_INTERRUPT_PRIORITY to be masked.
Regards.
RE: Timer Interrupt stop working after mallocPosted by Ricardo Crudo on August 19, 2013 Thanks for your reply Richard.
My timer1 interrupt don't use FreeRTOS API. I found a post with exact same situation that I am facing: http://www.embeddedrelated.com/groups/AT91SAM/show/4236.php, and I guess that solution response it's yours.
My Makefile use -mthumb for all sources files, but I gotten a error when I tried use the -marm flag in gcc (target CPU does not support ARM mode). And the -mthumb-interwork flag, build fine, but don't work too.
Regards
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|