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

vPortStartFirstTask crashes in cortex m0plus controller

Posted by sureshthiraviam on October 21, 2013

Hi, Currently i am working with cortex m0plus controller using freertos.

When i am resetting the controller using NVIC_systemReset the system gets hangs at vPortStartFirstTask at nop instruction after svc instruction.

thanks in advance


vPortStartFirstTask crashes in cortex m0plus controller

Posted by davedoors on October 21, 2013

There is a problem on Cortex-M0 that interrupts have to be enabled to call SVC to in turn start the scheduler so there is an instruction during which interrupt are enabled and the scheduler is not started. What can be done about this?

On the M3 system interrupts are not enabled until the first task context is restored. That is possible because it uses the basepri, but there is no basepri on the m0.


vPortStartFirstTask crashes in cortex m0plus controller

Posted by sureshthiraviam on October 21, 2013

Thanks Dave,

is there any solution for this. this not hanging everytime. but sometimes this happens.

vPortStartFirstTask crashes in cortex m0plus controller

Posted by sureshthiraviam on October 21, 2013

Hi dave,

Can you explain you point in detail..

that would be better for me to understand..

thanks in advance


vPortStartFirstTask crashes in cortex m0plus controller

Posted by richardbarry on October 21, 2013

For the code you post it looks like you are using an out of date FreeRTOS version, although I don't think that is related to your problem.

Try replacing the code in prvStartFirstTask() (vPortStartFirstTask() in your case) with the following. It starts the scheduler without using the SVCHandler, so interrupts can remain disabled until the task context is ready:

/* The MSP stack is not reset as, unlike on M3/4 parts, there is no vector
table offset register that can be used to locate the initial stack value.
Not all M0 parts have the application vector table at address 0. */
	
ldr	r3, =pxCurrentTCB /* Obtain location of pxCurrentTCB. */
ldr r1, [r3]			
ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. */
adds r0, #32 /* Discard everything up to r0. */
msr psp, r0  /* This is now the new top of stack to use in the task. */
movs r0, #2  /* Switch to the psp stack. */
msr CONTROL, r0
pop {r0-r5}  /* Pop the registers that are saved automatically. */
mov lr, r5   /* lr is now in r5. */
cpsie i      /* The first task has its context and interrupts can be enabled.*/
pop {pc}     /* Finally, pop the PC to jump to the user defined task code. */

Please let me know if this solves the problem.

Regards.


vPortStartFirstTask crashes in cortex m0plus controller

Posted by sureshthiraviam on October 21, 2013

thanks for your kind reply..

Fine this works. After adding this part of code i am getting the error as insufficient heap.

we are not using any dynamic memory allocation. by adding this code suddenly hangs at insufficient heap..

thanks in advance


vPortStartFirstTask crashes in cortex m0plus controller

Posted by richardbarry on October 21, 2013

Does this happen the first time the system boots up (powers on), or only when you reset it using NVIC_systemReset?

What does resetting using NVIC_systemReset mean? Is it a hard reset?

Regards.


vPortStartFirstTask crashes in cortex m0plus controller

Posted by sureshthiraviam on October 21, 2013

thanks again.

yes this happens some times when i am resetting the controller using system reset. this not happening at every startup

NVIC_SystemReset() is an arm core API used to reset the controller. In this we are writing in AIRCR (Application Interrupt and Reset Control Register) which in turn request for an system soft reset..

thanks


vPortStartFirstTask crashes in cortex m0plus controller

Posted by richardbarry on October 21, 2013

yes this happens some times when i am resetting the controller using system reset.

If that means on a power on reset, then I don't know what could be causing the problem. Does it happen even when no interrupts are enabled before the scheduler is started?

Regards.


vPortStartFirstTask crashes in cortex m0plus controller

Posted by sureshthiraviam on October 21, 2013

Thanks again

No this is not all happening before scheduler starts.


[ 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