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

STM32F100RCT MCU + STM32CubeMX project: prvPortStartFirstTask() crash

Posted by anani on June 15, 2017

Hi All,

I am busy debugging STM32F100RCT MCU project. The project framework and FreeRTOS code are generated by STM32CubeMX. I was debugging (ST-Link) without any FreRTOS related issues for a couple of weeks. Suddenly prvPortStartFirstTask() execution crashed... I have checked some similar issue posts published here, but still no clue. It looks like I have all settings correct:

static void prvPortStartFirstTask( void ) { __asm volatile( " ldr r0, =0xE000ED08 n" /* Use the NVIC offset register to locate the stack. / " ldr r0, [r0] n" " ldr r0, [r0] n" " msr msp, r0 n" / Set the msp back to the start of the stack. / " cpsie i n" / Globally enable interrupts. / " cpsie f n" " dsb n" " isb n" " svc 0 n" / System call to start first task. */ " nop n" ); }

ASM stepping is stacked at line: svc 0 n" /* System call to start first task. */, when I tried to run the debbuging again, it crashes.

In FreeRTOSConfig.h I have what is required:

/* USER CODE BEGIN 1 */

define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}

/* USER CODE END 1 / / Definitions that map the FreeRTOS port interrupt handlers to their CMSIS standard names. */

define vPortSVCHandler SVC_Handler
define xPortPendSVHandler PendSV_Handler

/* IMPORTANT: This define MUST be commented when used with STM32Cube firmware, to prevent overwriting SysTickHandler defined within STM32Cube HAL / / #define xPortSysTickHandler SysTickHandler */

And in port.s I have the handler:

void vPortSVCHandler( void ) { __asm volatile ( " ldr r3, pxCurrentTCBConst2 n" /* Restore the context. / " ldr r1, [r3] n" / Use pxCurrentTCBConst to get the pxCurrentTCB address. / " ldr r0, [r1] n" / The first item in pxCurrentTCB is the task top of stack. / " ldmia r0!, {r4-r11} n" / Pop the registers that are not automatically saved on exception entry and the critical nesting count. / " msr psp, r0 n" / Restore the task stack pointer. */ " isb n" " mov r0, #0 n" " msr basepri, r0 n" " orr r14, #0xd n" " bx r14 n" " n" " .align 2 n" "pxCurrentTCBConst2: .word pxCurrentTCB n" ); }

Please help!

Best regards, Anani


STM32F100RCT MCU + STM32CubeMX project: prvPortStartFirstTask() crash

Posted by anani on June 15, 2017

Sorry, forgot to mention, working with Atollic v7.1.2 Lite, FreeRTOS V8.2.3 (comes with Cube).


STM32F100RCT MCU + STM32CubeMX project: prvPortStartFirstTask() crash

Posted by rtel on June 15, 2017

The SVC instruction effectively calls vPortSVCHandler(), which in turn starts the first task running. Often people step through to the SVC instruction when debugging and think the crash is occurring there - whereas in fact unknown to them the debugger has started a task executing and the crash actually happens in the task.

First set a break point in vPortSVCHandler() to see if it gets hit. If it does step through that program to see which task runs first. If you actually get into a task then something is going wrong in a task, not when starting the scheduler.


STM32F100RCT MCU + STM32CubeMX project: prvPortStartFirstTask() crash

Posted by anani on June 15, 2017

Thank you for the advice. I have done what you suggested, didn't hit the break point though... Please advise what to try next.


STM32F100RCT MCU + STM32CubeMX project: prvPortStartFirstTask() crash

Posted by anani on June 15, 2017

ST Link crashed and Debug perspective disappeared, went back to C/C++ perspective.


STM32F100RCT MCU + STM32CubeMX project: prvPortStartFirstTask() crash

Posted by anani on June 15, 2017

Is there any possibility that interrups are not configured properly?


[ 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