Setting compiler path to ARM_CM4_MPU showing error

xuccccc wrote on Wednesday, August 09, 2017:

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

rtel wrote on Wednesday, August 09, 2017:

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.

xuccccc wrote on Thursday, August 10, 2017:

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.