# Setting compiler path to ARM\_CM4\_MPU showing error

**URL:** <https://forums.freertos.org/t/setting-compiler-path-to-arm-cm4-mpu-showing-error/6726>\
**Category:** Kernel\
**Created:** [August 9, 2017, 3:19pm UTC](https://forums.freertos.org/t/setting-compiler-path-to-arm-cm4-mpu-showing-error/6726 "2017-08-09T15:19:44Z")\
**Posts on this page:** 3\
**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:** [August 9, 2017, 3:19pm UTC](https://forums.freertos.org/t/setting-compiler-path-to-arm-cm4-mpu-showing-error/6726/1 "2017-08-09T15:19:44Z")

</div>

**[xuccccc](https://sourceforge.net/u/xuccccc/)** wrote on [Wednesday, August 09, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/300b24d2/#708b):

Hi,

I am currently using the stm32f446 for development. I found that there is the MPU support for it, I am tring to use the MPU function, but failed.  
The problme is after I chagned the complier path from GCC/AMR\_CM4F to GCC/ARM\_CM4\_MPU and compiled the code, it gave me the error:  
FreeRTOS/Source/portable/GCC/ARM\_CM4\_MPU/portmacro.h:176:96: error: ‘ **portNVIC\_PENDSVSET** ’ undeclared (first use in this function) #define portEND\_SWITCHING\_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC\_INT\_CTRL\_REG = portNVIC\_PENDSVSET

However, the portNVIC\_PENDSVSET is declared in the FreeRTOS/Source/portable/Tasking/ARM\_CM4F. As my understading this Tasking folder should be anohter complier, then it makes me comfusing.

It might be I am in the wrong way to use the FREEROTS MPU. I would ask is there anyboday who could provide me some ideasw how to use the MPU for M4?

Thanks a lot,  
Xu

---

<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:** [August 9, 2017, 4:00pm UTC](https://forums.freertos.org/t/setting-compiler-path-to-arm-cm4-mpu-showing-error/6726/2 "2017-08-09T16:00:41Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Wednesday, August 09, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/300b24d2/#708b/756a):

It is not clear what you are doing. The MPU port is a completely  
different port. To use it you need to remove all the non MPU port layer  
code and add in the MPU port layer code, then also update the include  
paths to ensure the portmacro.h is picked up from the MPU port layer.

Is that what you did?

I would recommend pulling the latest code from the public SVN repository  
on SourceForge as it contains some improvements to the MPU port.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [August 10, 2017, 12:01pm UTC](https://forums.freertos.org/t/setting-compiler-path-to-arm-cm4-mpu-showing-error/6726/3 "2017-08-10T12:01:34Z")

</div>

**[xuccccc](https://sourceforge.net/u/xuccccc/)** wrote on [Thursday, August 10, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/300b24d2/#708b/756a/f182):

Thanks for your reply. I updated the FreeRTOS, remove all non MPU port layer code and update the include path to the MPU code. It’s still not working. Now it shows the error:  
arm-none-eabi-ld: section privileged\_functions LMA [000000000000a7a0,000000000000d39b] overlaps section .data LMA [000000000000a79b,000000000000ac3e]  
arm-none-eabi-ld: section privileged\_data LMA [000000000000ac40,000000000000ad7f] overlaps section privileged\_functions LMA [000000000000a7a0,000000000000d39b]  
bin-vt8x8/cpu.o: In function `reboot': /home/xu/dev/volaWare/stm32-common/cpu.c:168: undefined reference to `MPU\_vTaskDelay’  
bin-vt8x8/port.o: In function `vPortStoreTaskMPUSettings': /home/xu/dev/volaWare/module/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/port.c:769: undefined reference to ` **SRAM\_segment\_start** ’  
/home/xu/dev/volaWare/module/FreeRTOS/Source/portable/GCC/ARM\_CM4\_MPU/port.c:769: undefined reference to ` __SRAM_segment_end__' /home/xu/dev/volaWare/module/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/port.c:769: undefined reference to ` **privileged\_data\_start** ’  
/home/xu/dev/volaWare/module/FreeRTOS/Source/portable/GCC/ARM\_CM4\_MPU/port.c:769: undefined reference to ` __privileged_data_end__' bin-vt8x8/port.o: In function `xPortStartScheduler’:  
/home/xu/dev/volaWare/module/FreeRTOS/Source/portable/GCC/ARM\_CM4\_MPU/port.c:462: undefined reference to ` __FLASH_segment_start__' /home/xu/dev/volaWare/module/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/port.c:462: undefined reference to ` **FLASH\_segment\_end** ’  
/home/xu/dev/volaWare/module/FreeRTOS/Source/portable/GCC/ARM\_CM4\_MPU/port.c:462: undefined reference to ` __privileged_functions_end__' /home/xu/dev/volaWare/module/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/port.c:462: undefined reference to ` **privileged\_data\_start** ’  
/home/xu/dev/volaWare/module/FreeRTOS/Source/portable/GCC/ARM\_CM4\_MPU/port.c:462: undefined reference to ` __privileged_data_end__' bin-vt8x8/crc32.o: In function `\_crc32\_lock’:  
/home/xu/dev/volaWare/module/crc32/stm32/crc32.c:63: undefined reference to `MPU_xQueueSemaphoreTake' bin-vt8x8/crc32.o: In function `\_crc32\_unlock’:  
/home/xu/dev/volaWare/module/crc32/stm32/crc32.c:76: undefined reference to `MPU_xQueueGenericSend' bin-vt8x8/crc32.o: In function `crc32\_init’:  
/home/xu/dev/volaWare/module/crc32/stm32/crc32.c:203: undefined reference to `MPU_xQueueCreateMutex' bin-vt8x8/init.o: In function `main\_loop’:  
/home/xu/dev/volaWare/arm-common/init.c:373: undefined reference to `MPU_xTaskGetTickCount' /home/xu/dev/volaWare/arm-common/init.c:381: undefined reference to `MPU\_vTaskDelete’  
bin-vt8x8/init.o: In function `_init': /home/xu/dev/volaWare/arm-common/init.c:398: undefined reference to `MPU\_xTaskCreate’

It seems some linker issue. Then is there any linker example for using the MPU code?

To make the things more clear. I would talk about what I really want to do. What I want to do is to replace the xTaskCreate() with xTaskCreateRestricted(), test and evaluate if this function can solve some problem, since I think in my code there is some memory corruption issue. The complier path for FreeRTOS I used before is ARM\_CM4F, which I think is not support xTaskCreateRestricted(), so I want to change it to ARM\_CM4\_MPU. But I didn’t make it work.
