# Problem with vPortStartFirstTask on CM3 and K

**URL:** <https://forums.freertos.org/t/problem-with-vportstartfirsttask-on-cm3-and-k/5560>\
**Category:** Kernel\
**Created:** [December 23, 2010, 3:56pm UTC](https://forums.freertos.org/t/problem-with-vportstartfirsttask-on-cm3-and-k/5560 "2010-12-23T15:56:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 23, 2010, 3:56pm UTC](https://forums.freertos.org/t/problem-with-vportstartfirsttask-on-cm3-and-k/5560/1 "2010-12-23T15:56:35Z")

</div>

**[snofrutech](https://sourceforge.net/u/snofrutech/)** wrote on [Thursday, December 23, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/f4b2e897/#dc84):

Hi

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

```
vPortStartFirstTask 

```

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[code], the debugger stops. 
I have add some lines to the standadt startup file startup_stm32f10x_ld_vl.s
[code] IMPORT xPortPendSVHandler
        				IMPORT xPortSysTickHandler
        				IMPORT vPortSVCHandler
; Vector Table Mapped to Address 0 at Reset
                AREA RESET, DATA, READONLY
                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[/code]
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 !
```

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 23, 2010, 4:01pm UTC](https://forums.freertos.org/t/problem-with-vportstartfirsttask-on-cm3-and-k/5560/2 "2010-12-23T16:01:47Z")

</div>

**[snofrutech](https://sourceforge.net/u/snofrutech/)** wrote on [Thursday, December 23, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/f4b2e897/#166b):

Here is my program  
[code

SystemInit ();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // CMSIS system init  
SysTick\_CLKSourceConfig( SysTick\_CLKSource\_HCLK );

xTaskCreate( vTaskCode, ( signed portCHAR \* ) “LCD”, configMINIMAL\_STACK\_SIZE, NULL, tskIDLE\_PRIORITY, NULL );  
]vTaskStartScheduler();

These are my global defines

```
USE_FULL_ASSERT  
USE_STDPERIPH_DRIVER
STM32F10X_LD_VL 
VECT_TAB_SRAM
RVDS_ARMCM3_LM3S1
```

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [December 23, 2010, 4:33pm UTC](https://forums.freertos.org/t/problem-with-vportstartfirsttask-on-cm3-and-k/5560/3 "2010-12-23T16:33:44Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, December 23, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/f4b2e897/#d133):

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.&nbsp; 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  
nop

where previously there was just  
svc 0

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 3, 2011, 3:20pm UTC](https://forums.freertos.org/t/problem-with-vportstartfirsttask-on-cm3-and-k/5560/4 "2011-01-03T15:20:57Z")

</div>

**[snofrutech](https://sourceforge.net/u/snofrutech/)** wrote on [Monday, January 03, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/f4b2e897/#ff60):

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 );
```
