# FreeRTOS support for AMB82

**URL:** <https://forum.amebaiot.com/t/freertos-support-for-amb82/2275>\
**Category:** SDK\
**Tags:** evb-amb82\
**Created:** [September 28, 2023, 4:26am UTC](https://forum.amebaiot.com/t/freertos-support-for-amb82/2275 "2023-09-28T04:26:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Osorio](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/daniel_osorio/32/1672_2.png) [@Daniel\_Osorio](https://forum.amebaiot.com/u/Daniel_Osorio)\
**Post date:** [September 28, 2023, 4:26am UTC](https://forum.amebaiot.com/t/freertos-support-for-amb82/2275/1 "2023-09-28T04:26:06Z")

</div>

Hello,

Is FreeRTOS supported on the AMB82? If not is there any planned support for this and when?

---

<div class="post-metadata">

**Author:** ![dakamaster](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/dakamaster/32/1744_2.png) [@dakamaster](https://forum.amebaiot.com/u/dakamaster)\
**Post date:** [September 28, 2023, 7:41am UTC](https://forum.amebaiot.com/t/freertos-support-for-amb82/2275/2 "2023-09-28T07:41:34Z")

</div>

Please refer to [https://github.com/ambiot/ambd\_arduino/blob/dev/Arduino\_package/hardware/cores/ambd/wiring\_os.c](https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/cores/ambd/wiring_os.c)

---

<div class="post-metadata">

**Author:** ![Daniel\_Osorio](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/daniel_osorio/32/1672_2.png) [@Daniel\_Osorio](https://forum.amebaiot.com/u/Daniel_Osorio)\
**Post date:** [October 22, 2023, 1:23am UTC](https://forum.amebaiot.com/t/freertos-support-for-amb82/2275/3 "2023-10-22T01:23:40Z")

</div>

Thank you.

Does this code work with amebapro2

---

<div class="post-metadata">

**Author:** ![dakamaster](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/dakamaster/32/1744_2.png) [@dakamaster](https://forum.amebaiot.com/u/dakamaster)\
**Post date:** [October 22, 2023, 1:49am UTC](https://forum.amebaiot.com/t/freertos-support-for-amb82/2275/4 "2023-10-22T01:49:08Z")

</div>

Sorry for providing the wrong link previously, please refer to this link instead:

> <https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/cores/ambpro2/wiring_os.c>

---

<div class="post-metadata">

**Author:** ![Lun](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/lun/32/2269_2.png) [@Lun](https://forum.amebaiot.com/u/Lun)\
**Post date:** [September 18, 2024, 9:01am UTC](https://forum.amebaiot.com/t/freertos-support-for-amb82/2275/5 "2024-09-18T09:01:12Z")

</div>

@dakamaster  
Is there any example code?  
It’s not easy for an amebapro2 beginner.  
Sincerely appreciate your help.

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [September 20, 2024, 2:10am UTC](https://forum.amebaiot.com/t/freertos-support-for-amb82/2275/6 "2024-09-20T02:10:39Z")

</div>

Hi @Lun,

In the latest early release of the Arduino SDK, the OTA example uses multithread. You may refer to that example. Underlying is FreeRTOS implementation.

Thank you.

---

<div class="post-metadata">

**Author:** ![Lun](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/lun/32/2269_2.png) [@Lun](https://forum.amebaiot.com/u/Lun)\
**Post date:** [September 21, 2024, 7:00am UTC](https://forum.amebaiot.com/t/freertos-support-for-amb82/2275/7 "2024-09-21T07:00:14Z")

</div>

Thanks for your reply.

According to [OTA source code](https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/OTA/src/ota_thread.cpp)

There are 2 thread for start\_OTA\_threads() under [OTA example](https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/OTA/examples/OTA/OTA.ino)

Example code told us to add code as follows.

> void loop()  
> {  
> // Empty or add non-blocking code here  
> }

Does it mean that there will be 1 thread for loop + 2 thread for OTA and we don’t need to handle multi-thread programming?

Or we also need to add another thread\_task under loop()?

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [September 23, 2024, 1:46am UTC](https://forum.amebaiot.com/t/freertos-support-for-amb82/2275/8 "2024-09-23T01:46:08Z")

</div>

Hi @Lun,

In the OTA example, you can see that I am starting two concurrent threads in the setup. You should not start a thread code in the loop().

You can add your other threads in the setup(), like how I did in the OTA example.

Thank you.
