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

return to main() for ARM ports

Posted 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 ports

Posted 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 ports

Posted 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 ports

Posted 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


[ 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