# vPortStartFirstTask() for STM32L + FreeRTOS 

**URL:** <https://forums.freertos.org/t/vportstartfirsttask-for-stm32l-freertos/557>\
**Category:** Kernel\
**Created:** [December 2, 2010, 10:11am UTC](https://forums.freertos.org/t/vportstartfirsttask-for-stm32l-freertos/557 "2010-12-02T10:11:18Z")\
**Posts on this page:** 6\
**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 2, 2010, 10:11am UTC](https://forums.freertos.org/t/vportstartfirsttask-for-stm32l-freertos/557/1 "2010-12-02T10:11:18Z")

</div>

**[anuradha123](https://sourceforge.net/u/anuradha123/)** wrote on [Thursday, December 02, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/166f1c87/#6bf4):

Hello all,

I have changed the FreeRTOS demo for STM32F103 in order to work with STM32L. This is my main.c.

```
int main()
{
  
  prvSetupHardware();
  
  xTaskCreate(vLEDTask,( signed char * )"LED1",configMINIMAL_STACK_SIZE, NULL,mainFLASH_TASK_PRIORITY,(xTaskHandle*) NULL );
  xTaskCreate(vLEDTask2,( signed char * )"LED2",configMINIMAL_STACK_SIZE, NULL,(mainFLASH_TASK_PRIORITY+1),(xTaskHandle*) NULL );
  
  /* Start the scheduler. */
  vTaskStartScheduler();
  
  
  return 0;
}

```

Hard Fault exception occurs within the vTaskStartScheduler(); function.

As I noticed by the step running the exception occurs after the vPortStartFirstTask on portasm.s.

Have anybody any idea on how to configure this function so that the scheduler will start the first task?

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 2, 2010, 10:21am UTC](https://forums.freertos.org/t/vportstartfirsttask-for-stm32l-freertos/557/2 "2010-12-02T10:21:34Z")

</div>

**anonymous** wrote on [Thursday, December 02, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/166f1c87/#1501):

Hi,  
have you checked the name of the exception handler used by FreeRTOS?  
- SVC\_Handler (vPortSVCHandler)  
- PendSV\_Handler (xPortPendSVHandler)  
- SysTick\_Handler (xPortSysTickHandler)

Are the same defined in the vector table?

Regards,  
Stefano

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 2, 2010, 10:43am UTC](https://forums.freertos.org/t/vportstartfirsttask-for-stm32l-freertos/557/3 "2010-12-02T10:43:09Z")

</div>

**[anuradha123](https://sourceforge.net/u/anuradha123/)** wrote on [Thursday, December 02, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/166f1c87/#8d30):

Hello, Further to previous post,

I want to know how to change the “Constants required to manipulate the NVIC” defined in the port.c.  
Should they be same for all ARM CM3 ports???

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 2, 2010, 10:50am UTC](https://forums.freertos.org/t/vportstartfirsttask-for-stm32l-freertos/557/4 "2010-12-02T10:50:36Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Thursday, December 02, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/166f1c87/#074e):

> Should they be same for all ARM CM3 ports???

I think that has been answered already, and the answer is Yes.

Please keep your related posts in a single thread.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 2, 2010, 11:29am UTC](https://forums.freertos.org/t/vportstartfirsttask-for-stm32l-freertos/557/5 "2010-12-02T11:29:20Z")

</div>

**[anuradha123](https://sourceforge.net/u/anuradha123/)** wrote on [Thursday, December 02, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/166f1c87/#362b):

~~Thanks STF12~~

it worked 😃

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 7, 2010, 6:56am UTC](https://forums.freertos.org/t/vportstartfirsttask-for-stm32l-freertos/557/6 "2010-12-07T06:56:27Z")

</div>

**[anuradha123](https://sourceforge.net/u/anuradha123/)** wrote on [Tuesday, December 07, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/166f1c87/#08cf):

Hello,  
In the “CORTEX\_STM32F103\_IAR” FreeRTOS port the vector table is defined in stm32f10x\_nvic.c.  
Is there a special reason for using that file instead of using the provided startup files (startup\_stm32f10x\_cl.s etc) ?

Thank you.
