# FreeRTOS not running after bootloader jump (SAMC21, app @ 0x8000)

**URL:** <https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879>\
**Category:** Kernel\
**Created:** [April 8, 2025, 9:13am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879 "2025-04-08T09:13:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeevitha](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@Jeevitha](https://forums.freertos.org/u/Jeevitha)\
**Post date:** [April 8, 2025, 9:13am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/1 "2025-04-08T09:13:19Z")

</div>

My FreeRTOS code works perfectly when flashed alone (starts from 0x00000000).  
When bootloader is flashed first, then application (at 0x00008000), FreeRTOS doesn’t run — it doesn’t enter tasks.

FreeRTOS tasks not running after bootloader jump (SAMC21, app at 0x8000)

Microcontroller: _SAMC21N18A_  
Compiler/IDE: _Atmel Studio_  
FreeRTOS version (10)  
Bootloader used (custom)

I’m using a custom bootloader on a SAMC21N18A microcontroller with FreeRTOS. The bootloader starts at 0x00000000 and jumps to the application at 0x00008000. When I flash only the application (starting at 0x00000000), FreeRTOS works fine.

But when I flash the bootloader at 0x00000000 and the application at 0x00008000, FreeRTOS doesn’t run — no tasks are executed, and it seems interrupts aren’t firing

➕

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [April 8, 2025, 9:17am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/2 "2025-04-08T09:17:38Z")

</div>

> [@Jeevitha](#):
>
> no tasks are executed, and it seems interrupts aren’t firing

SAMC21 is a cortex-M device. Have you correctly updated the [VTOR](https://developer.arm.com/documentation/dui0662/b/Cortex-M0--Peripherals/System-Control-Block/Vector-Table-Offset-Register)?

This is a good document from ARM describing all the steps needed to write a bootloader - [Documentation – Arm Developer](https://developer.arm.com/documentation/ka002218/latest/).

---

<div class="post-metadata">

**Author:** ![Jeevitha](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@Jeevitha](https://forums.freertos.org/u/Jeevitha)\
**Post date:** [April 9, 2025, 4:34am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/3 "2025-04-09T04:34:14Z")

</div>

but our custom bootloader is working for non-RTOS code, but facing issue with RTOS code

---

<div class="post-metadata">

**Author:** ![jefftenney](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/jefftenney/32/1314_2.png) [@jefftenney](https://forums.freertos.org/u/jefftenney)\
**Post date:** [April 9, 2025, 4:40am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/4 "2025-04-09T04:40:03Z")

</div>

Yes but your RTOS code works fine without the bootloader, right?

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [April 9, 2025, 5:05am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/5 "2025-04-09T05:05:51Z")

</div>

> [@Jeevitha](#):
>
> but facing issue with RTOS code

A very possible reason is that the vector table is not correctly setup because FreeRTOS requires some ISRs to be installed correctly. Did you try my above suggestions?

---

<div class="post-metadata">

**Author:** ![Jeevitha](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@Jeevitha](https://forums.freertos.org/u/Jeevitha)\
**Post date:** [April 9, 2025, 6:53am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/6 "2025-04-09T06:53:20Z")

</div>

Yes, my RTOS code works fine (starts from 0x00000000)

---

<div class="post-metadata">

**Author:** ![Jeevitha](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@Jeevitha](https://forums.freertos.org/u/Jeevitha)\
**Post date:** [April 9, 2025, 7:14am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/7 "2025-04-09T07:14:43Z")

</div>

Vector table is correctly setup,  
I have configured FreeRTOS version 10 in Atmel Start. What other tools do I need to install for FreeRTOS to work properly?

int main(void)  
{  
atmel\_start\_init();  
Initialization(); // This includes print statements  
// Task creation for Task 1 to Task 6  
vTaskStartScheduler();  
}  
In my FreeRTOS code, I added print statements inside the Initialization() function (which runs outside the RTOS). I can see those print statements through Data Visualizer, so I know it’s being called.

However, the tasks are not being created — they are not running.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [April 9, 2025, 7:21am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/8 "2025-04-09T07:21:36Z")

</div>

> [@Jeevitha](#):
>
> Vector table is correctly setup,

Can you share the code in your bootloader where you do that?

---

<div class="post-metadata">

**Author:** ![Jeevitha](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@Jeevitha](https://forums.freertos.org/u/Jeevitha)\
**Post date:** [April 9, 2025, 9:35am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/9 "2025-04-09T09:35:51Z")

</div>

Sorry, I couldn’t share the code on a public forum

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [April 9, 2025, 11:20am UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/10 "2025-04-09T11:20:49Z")

</div>

In that case, have you done all the steps in the documents I liked above? Are you setting VTOR by doing something like the following:

```auto
SCB->VTOR = ( uint32_t )Address ;

```

If the answer to both the questions is yes, can you break the code in debugger and see what it is doing when it appears stuck?

---

<div class="post-metadata">

**Author:** ![dc42](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/dc42/32/487_2.png) [@dc42](https://forums.freertos.org/u/dc42)\
**Post date:** [April 11, 2025, 3:40pm UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/11 "2025-04-11T15:40:27Z")

</div>

We do exactly this on a SAMC21. You can find our code at [Duet3Bootloader/src/Bootloader.cpp at dev · Duet3D/Duet3Bootloader · GitHub](https://github.com/Duet3D/Duet3Bootloader/blob/dev/src/Bootloader.cpp). See in particular the StartFirmware() function at the end.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [April 12, 2025, 9:45pm UTC](https://forums.freertos.org/t/freertos-not-running-after-bootloader-jump-samc21-app-0x8000/22879/12 "2025-04-12T21:45:52Z")

</div>

Thank you for sharing @dc42!
