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] [December 2005 Threads] return to main() for ARM portsPosted by *anonymous on December 13, 2005 I thought I would share the following Idle Task hook that returns to main() when all tasks die. Feedback is welcome.
You could turn off the Tick ISR here or when back in main().
This assumes all allocated queues have been freed by the tasks themselves before they are deleted (or delete themselves) with vTaskDelete().
Also assumes this function is compiled as ARM code (say in portISR.c). Untested for return to Thumb code although I think it is correct.
void vApplicationIdleHook(void)
{
__static bool die = false;
_// when only the idle task remains, we may need one last pass of the idle
_// task to free resources of last application task, and then we quit
__if (die)
__{ // return to old context at end of vPortISRStartFirstTask()
____die = false;
____asm volatile ( "msr cpsr_c,#0xD3"); // back to supervisor state
____asm volatile ( "ldmia sp, {r11,sp,lr}"); // restore regs for return
____asm volatile ( "bx lr"); // and return
__}
__else if (uxTaskGetNumberOfTasks()==1)
__{ // only the idle task remains. so
____// die on next pass after all deleted task TCBs are sure to be freed
____die = true;
__}
}
return to main() for ARM portsPosted by nobody on December 13, 2005 Neat....maybe this should be the default behaviour for vPortEndScheduler() in port.c, which is at the moment "not implemented for the arm".
return to main() for ARM portsPosted by racemouse on July 10, 2007 Greetings,
I quess it's time to revive this old thread...
We use FreeRTOS in a bootloader. When the bootloader's job is finished we need to stop the scheduler and jump to a different location where the main application starts. When trying to compile the "new" vPortEndScheduler (which I moved to portISR.c for compilation in ARM Mode) I get the following junk thrown at me:
/cygdrive/c/DOCUME~1/RFI~1.LOD/LOCALS~1/Temp/cczKqAza.s: Assembler messages:
/cygdrive/c/DOCUME~1/RFI~1.LOD/LOCALS~1/Temp/cczKqAza.s:12: Error: flag for {c}psr instruction expected -- `msr CPSR_C,#0xD3'
/cygdrive/c/DOCUME~1/RFI~1.LOD/LOCALS~1/Temp/cczKqAza.s:14: Error: bad instruction `sbx LR'
make[1]: *** [Source/portable/GCC/ARM7_AT91SAM7/portISR.o] Error 1
I have no idea what this means. Can someone help me here ?
/RaceMouse
return to main() for ARM portsPosted by racemouse on July 10, 2007 Hmmm... My fault. One spelling error and one letter that should not be versal but was...
Works now :-)
/RaceMouse
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|