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


Problem with vPortStartFirstTask on CM3 and K

Posted by Kasper on December 23, 2010

I have tried to get the freeRTOS running on a STM32F100R4, there is no excact demoes for this target, but I have tried to set it up manually, It Compiles fine, but efter calling the
in the port.c file everything seems to stop. The systemTick counter is running, but if I break the program, the debugger stops, and give me and error. I can single step down to the last command in the function, but when execute the
scv 0
, the debugger stops. 

I have add some lines to the standadt startup file startup_stm32f10x_ld_vl.s

        IMPORT xPortPendSVHandler
IMPORT xPortSysTickHandler
IMPORT vPortSVCHandler

; Vector Table Mapped to Address 0 at Reset
EXPORT __Vectors
EXPORT __Vectors_End
EXPORT __Vectors_Size

__Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD vPortSVCHandler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler
DCD 0 ; Reserved
DCD xPortPendSVHandler ; PendSV Handler
DCD xPortSysTickHandler ; SysTick Handler

I'm using the CMSIS and stdPerph driver interface from ST, to set up the clock and the SystemTick. I hope anyone can help me to solve this problem !

RE: Problem with vPortStartFirstTask on CM3 and K

Posted by Kasper on December 23, 2010
Here is my program

SystemInit (); // CMSIS system init
SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );

xTaskCreate( vTaskCode, ( signed portCHAR * ) "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );

These are my global defines


RE: Problem with vPortStartFirstTask on CM3 and K

Posted by Richard on December 23, 2010
I presume you mean "svc 0", not "SCV 0".

Try putting a "cpsie i" instruction before the "svc 0" instruction - it might be that the start up code is leaving interrupts globally disabled in the CPSR. The FreeRTOS code does not expect to touch the global interrupt status, only the BASEPRI register.

If you get a warning saying that some padding was added, just either ignore it, use the asm directive to ensure correct padding, or most simply add a "nop" instruction after the svc 0, so you get

cpsie i
svc 0

where previously there was just
svc 0


RE: Problem with vPortStartFirstTask on CM3 and K

Posted by Kasper on January 3, 2011
Hi Thanks for the repply, hower it did not solve the problem.

But I have it up running now. I missed a couple of lines to set the interrupts prioty

/* Set the Vector Table base address at 0x08000000 */
NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );

NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );

[ 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