# Integrating freeRTOS to an existing project

**URL:** <https://forums.freertos.org/t/integrating-freertos-to-an-existing-project/6027>\
**Category:** Kernel\
**Created:** [July 16, 2016, 2:25pm UTC](https://forums.freertos.org/t/integrating-freertos-to-an-existing-project/6027 "2016-07-16T14:25:55Z")\
**Posts on this page:** 5\
**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:** [July 16, 2016, 2:25pm UTC](https://forums.freertos.org/t/integrating-freertos-to-an-existing-project/6027/1 "2016-07-16T14:25:55Z")

</div>

**[bou6](https://sourceforge.net/u/bou6/)** wrote on [Saturday, July 16, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f56aa4c2/#8a0e):

i am attempting to integrate freeRTOS to my application that run on AT32UC3A0512. I downloaded a freeRTOS project example for EVK1100 (it Supports the AT32UC3A) and try to include the kernel source files, so my application hierarchy looks like :

```auto
src
   |ASF
   |APP_FOLDER
   |freertos 
       |freertos-7.0.0
          |source

```

I solved some compilation errors due to unrecognized paths and remove exception.s from freertos folder since i have this file already under ASF\avr32\drivers\intc, in this stage the project compiles.

The strange thing is that with the kernel folder included in the project, the twi\_master\_read cause blocking, notice that i don’t make any call to the kernel functions nor include it’s header in any of my project files, the kernel folder is just present physically.

However if i exclude the kernel folder from the project all works well.

The question is : is there any redefinition (clocks, pins,…) in the kernel sources that lead to this behaviour, i really can’t see the problem, so if someone have any suggestion don’t hesitate to comment.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 16, 2016, 9:53pm UTC](https://forums.freertos.org/t/integrating-freertos-to-an-existing-project/6027/2 "2016-07-16T21:53:33Z")

</div>

**[bou6](https://sourceforge.net/u/bou6/)** wrote on [Saturday, July 16, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f56aa4c2/#e1af):

In port.c i come to the function \_init\_startup in the comment it’s said that its " Low-level initialization routine called during startup, before the main function.", could this function be the source of the problem ? , is there other functions that i should pay attention at ?

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [July 16, 2016, 11:52pm UTC](https://forums.freertos.org/t/integrating-freertos-to-an-existing-project/6027/3 "2016-07-16T23:52:41Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Saturday, July 16, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f56aa4c2/#53ac):

What do you mean with these :

```auto
    freertos
    freertos-7.0.0

```

What is in that first directory?

It would also be interesting to see the source code of that `twi_master_read`, to know if it is influenced by port.h

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 17, 2016, 11:02am UTC](https://forums.freertos.org/t/integrating-freertos-to-an-existing-project/6027/4 "2016-07-17T11:02:52Z")

</div>

**[bou6](https://sourceforge.net/u/bou6/)** wrote on [Sunday, July 17, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f56aa4c2/#4fd2):

Thanks for the feedback, i edited the question, freertos-7.0.0 is under the folder freertos, ASF stand for Atmel Software Framework it contains drivers for the peripherals, ` twi_master_read` is a blocking read operation, it waits a flag `twi_busy` to become false in order to unblock, `twi_busy` becomes false using twi interruption, what i come to conclude today is that including freeRTOS folder has changed the interrupt controller behaviour. Even the timer interrupt are not working due to the inclusion of this folder.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 17, 2016, 4:57pm UTC](https://forums.freertos.org/t/integrating-freertos-to-an-existing-project/6027/5 "2016-07-17T16:57:53Z")

</div>

**[bou6](https://sourceforge.net/u/bou6/)** wrote on [Sunday, July 17, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f56aa4c2/#c163):

After passing few hours debugging i find that the interrupt controller behaviour is changed due to calls to the function `sprintf`, before calling `sprintf` the timer interrupts works well and only after calling `sprintf` function the timer ISR becomes unreacheable, so `sprintf` + freeRTOS folder in my project causes problems i don’t why ?
