Quality RTOS & Embedded Software

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


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner