# Porting Cortex-M4 with MPU

**URL:** <https://forums.freertos.org/t/porting-cortex-m4-with-mpu/18199>\
**Category:** ARM\
**Created:** [September 14, 2023, 11:30am UTC](https://forums.freertos.org/t/porting-cortex-m4-with-mpu/18199 "2023-09-14T11:30:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgrigorov](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/tgrigorov/32/3830_2.png) [@tgrigorov](https://forums.freertos.org/u/tgrigorov)\
**Post date:** [September 14, 2023, 11:30am UTC](https://forums.freertos.org/t/porting-cortex-m4-with-mpu/18199/1 "2023-09-14T11:30:50Z")

</div>

Hello,

I am trying to port M4 with MPU using the GCC\CM4\_MPU port. It seems everything is alright, but a linker error appears.

```auto
(mpu_wrappers_v2_asm.o): In function `MPU_xTaskDelayUntil':
C:\development\code\predevelopmnet\FreeRTOS\build\debug/..\..\Components\FreeRTOS\Kernel\portable\GCC\ARM_CM4_MPU/mpu_wrappers_v2_asm.c:55: undefined reference to `MPU_xTaskDelayUntilImpl'

```

The same error for TaskDelay, TaskPriorityGet ent, etc.

---

<div class="post-metadata">

**Author:** ![shtirka](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/shtirka/32/4719_2.png) [@shtirka](https://forums.freertos.org/u/shtirka)\
**Post date:** [September 14, 2023, 1:14pm UTC](https://forums.freertos.org/t/porting-cortex-m4-with-mpu/18199/2 "2023-09-14T13:14:40Z")

</div>

> [@tgrigorov](#):
>
> I am trying to port M4 with MPU using the GCC\CM4\_MPU port.

Hello, isnt there a CM3\_MPU port that you can use as a reference? I believe (the developers would correct me if I am wrong on this one) that’s what was recommended for both the CM3 AND CM4 since the MPU is pretty much identical (as I seem to recall the discussion) based microcontrollers here on the forum.

Ilya

---

<div class="post-metadata">

**Author:** ![karahulx](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/karahulx/32/4893_2.png) [@karahulx](https://forums.freertos.org/u/karahulx)\
**Post date:** [September 14, 2023, 2:43pm UTC](https://forums.freertos.org/t/porting-cortex-m4-with-mpu/18199/3 "2023-09-14T14:43:09Z")

</div>

Hi @tgrigorov  
`INCLUDE_xTaskDelayUntil` should be set to 1 in FreeRTOSConfig.h, for **MPU\_xTaskDelayUntilImpl** to be defined, could you confirm if that is set in the config file.  
Similar scenarios for the other APIs you mentioned  
`INCLUDE_vTaskDelay` for **MPU\_vTaskDelayImpl**  
`INCLUDE_vTaskPrioritySet` for **MPU\_vTaskPrioritySet**

---

<div class="post-metadata">

**Author:** ![tgrigorov](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/tgrigorov/32/3830_2.png) [@tgrigorov](https://forums.freertos.org/u/tgrigorov)\
**Post date:** [September 15, 2023, 8:16am UTC](https://forums.freertos.org/t/porting-cortex-m4-with-mpu/18199/4 "2023-09-15T08:16:56Z")

</div>

Hi @karahulx,  
Yes, I set them in the config file. It’s turned out that, in addition to the CM4 MPU port should be added _portable/Common/mpu\_wrappers.c, mpu\_wrappers\_v2.c_. I missed that step, migrating from the CM4F port to MPU.  
Thanks for the help!
