# Using FreeRTOS with Atmel Studios and Arduino Due board

**URL:** <https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023>\
**Category:** Kernel\
**Created:** [May 8, 2022, 9:03pm UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023 "2022-05-08T21:03:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScottR1234](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/scottr1234/32/2489_2.png) [@ScottR1234](https://forums.freertos.org/u/ScottR1234)\
**Post date:** [May 8, 2022, 9:03pm UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/1 "2022-05-08T21:03:14Z")

</div>

I have been attempting to use the FreeRTOS with Atmel Studios now Microchip Studios and have made some progress. However, it will not successfully compile once I try and insert a task. I am using the ASF and installed the FreeRTOS 10.0.0. I have found a document atmel-42622-getting started with freertos and it gives good examples. Need help just getting it going.

---

<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:** [May 8, 2022, 11:04pm UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/2 "2022-05-08T23:04:17Z")

</div>

You said it didn’t compile, but didn’t post the compiler error message, so I’m not sure what to suggest.

---

<div class="post-metadata">

**Author:** ![ScottR1234](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/scottr1234/32/2489_2.png) [@ScottR1234](https://forums.freertos.org/u/ScottR1234)\
**Post date:** [May 8, 2022, 11:16pm UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/3 "2022-05-08T23:16:08Z")

</div>

Thanks so much for responding.

 ![Atmel Rtos errors](https://d2v6vdsk2p900z.cloudfront.net/original/2X/b/bfecb11195d026c45df4bc5633357957c68d5c06.png)

The folder structure seems to be fine. I used the ASF to add the FreeRtos.

---

<div class="post-metadata">

**Author:** ![ScottR1234](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/scottr1234/32/2489_2.png) [@ScottR1234](https://forums.freertos.org/u/ScottR1234)\
**Post date:** [May 8, 2022, 11:25pm UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/4 "2022-05-08T23:25:23Z")

</div>

```auto
#include <asf.h>

xTaskHandle worker1_id;
static void worker1_task(void *pvParameters)
{
	for(;;)
	{
		/* task application*/
	}
	/* Should never go there */
	vTaskDelete(NULL);
}

int main (void)
{
	/* Insert system clock initialization code here (sysclk_init()). */
    sysclk_init();
    board_init();

	/* Insert application code here, after the board has been initialized. */

    xTaskCreate(worker1_task,"Worker 1",configMINIMAL_STACK_SIZE,NULL, 2,& worker1_id);

    vTaskStartScheduler();

   while (1)
   {
   }

}

```

Very simple code, I copied and pasted from the atmel document and it will compile without errors until I add the create task function.

---

<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:** [May 9, 2022, 12:47am UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/5 "2022-05-09T00:47:03Z")

</div>

Functions that start “Application” [have to be provided by the application writer](https://www.freertos.org/a00016.html), or alternatively, you need to disable the feature in FreeRTOSConfig.h (the same link tells you how to do that).

---

<div class="post-metadata">

**Author:** ![ScottR1234](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/scottr1234/32/2489_2.png) [@ScottR1234](https://forums.freertos.org/u/ScottR1234)\
**Post date:** [May 9, 2022, 3:28am UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/6 "2022-05-09T03:28:30Z")

</div>

Thanks again. I set the hook config lines to 0, then I got a stack over flow error but went back to the config files and set the stack over flow to 0 as well. It appears to be working so far at least compiling with no errors.

---

<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:** [May 9, 2022, 3:44am UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/7 "2022-05-09T03:44:59Z")

</div>

? If you are getting stack overflows you need to increase the stack size. Turning the warnings off doesn’t stop the stack overflowing.

---

<div class="post-metadata">

**Author:** ![ScottR1234](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/scottr1234/32/2489_2.png) [@ScottR1234](https://forums.freertos.org/u/ScottR1234)\
**Post date:** [May 9, 2022, 3:47am UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/8 "2022-05-09T03:47:21Z")

</div>

The error was a stack hook overflow but turning off the stack overflow got rid of the compile error.

---

<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:** [May 9, 2022, 3:50am UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/9 "2022-05-09T03:50:02Z")

</div>

Ah. That makes sense, although it’s best to keep stack overflow detection set to 2 and configASSERT() defined during development. That will help catch a lot of issues, then once everything is good, you can turn them off before going into production.

---

<div class="post-metadata">

**Author:** ![ScottR1234](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/scottr1234/32/2489_2.png) [@ScottR1234](https://forums.freertos.org/u/ScottR1234)\
**Post date:** [May 9, 2022, 3:55am UTC](https://forums.freertos.org/t/using-freertos-with-atmel-studios-and-arduino-due-board/15023/10 "2022-05-09T03:55:33Z")

</div>

Thanks so much for the help. I’ve been using AVR for years and trying to move up to the ARM in particular the Sam series so I figured I would tackle both it and the RTOS at the same time.
