Has anyone struck compiler errors when trying to convert a project over to use the new Cortex M3 MPU code? I’m trying to track down an issue wherein the task list gets overwritten by some task – the cause has not yet been discovered, and it’s causing me quite a bit of grief. As a means of tracking down the culprit, I was hoping to try and get the MPU on the job, in order to determine what the cause of this misbehaviour might be – the only threads that should be writing to this patch of memory should be exclusively the FreeRTOS kernel itself. Microcontroller/board here is the Luminary Micro EK-LM3S8962 evaluation kit. My code is based on the Eclipse demo for this board – for now I’ve disabled pre-emptive multitasking (this helps) and enabled stack overflow checking. It compiles fine and runs (with the aforementioned glitch) with the non-MPU Cortex M3 port (portable/GCC/ARM_CM3/port{.c,macro.h}). If however, I switch the Makefile to use the MPU version (portable/GCC/ARM_CM3_MPU/port{.c,macro.h}), I get loads of linker errors:
arm-stellaris-eabi-gcc -g -O0 -pipe -I /home/stuartl/ezecorp/git/arm-dcc -I /home/stuartl/ezecorp/git/arm-dcc/../libcan -I /home/stuartl/ezecorp/git/arm-dcc/../libsmartwheel -I /home/stuartl/ezecorp/git/arm-dcc/../stellarisware -I /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/boards/ek-lm3s8962 -I /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party -I /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/include -I /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU -D GCC_ARMCM3_LM3S8962 -D inline= -mthumb -mcpu=cortex-m3 -Tarm-dcc.ld -D PACK_STRUCT_END=__attribute((packed)) -D ALIGN_STRUCT_END=__attribute((aligned(4))) -D sprintf=usprintf -D snprintf=usnprintf -D printf=uipprintf -D DEVICE_SERIAL=0xa44ff1d -ffunction-sections -fdata-sections /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/utils/ustdlib.o /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/fatfs/src/ff.o /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.o /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/queue.o /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/MemMang/heap_2.o /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/list.o mmc-ek-lm3s8962.o rit128x96x4.o ssi_sem.o startup.o main.o hw.o font-small.o font-big.o font-huge.o uartTask.o oledTask.o calcTask.o menuTask.o /home/stuartl/ezecorp/git/arm-dcc/libcan/libcan.a /home/stuartl/ezecorp/git/arm-dcc/libsmartwheel/libsmartwheel.a /home/stuartl/ezecorp/git/arm-dcc/../stellarisware/driverlib/gcc/libdriver.a -nostartfiles -Xlinker -oarm-dcc.elf -Xlinker -M -Xlinker -Map=arm-dcc.map -Xlinker --no-gc-sections --entry reset -lm
/usr/local/lib/gcc/arm-stellaris-eabi/4.4.1/../../../../arm-stellaris-eabi/bin/ld: section privileged_functions loaded at [0001b63c,0001bbeb] overlaps section .data loaded at [0001b63c,0001b87f]
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `prvSetupMPU':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:458: undefined reference to `__FLASH_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:458: undefined reference to `__FLASH_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:464: undefined reference to `__FLASH_segment_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:464: undefined reference to `__FLASH_segment_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:464: undefined reference to `__FLASH_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:464: undefined reference to `__FLASH_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:470: undefined reference to `__FLASH_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:470: undefined reference to `__FLASH_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:476: undefined reference to `__privileged_functions_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:476: undefined reference to `__privileged_functions_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:476: undefined reference to `__FLASH_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:476: undefined reference to `__FLASH_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:481: undefined reference to `__privileged_data_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:481: undefined reference to `__privileged_data_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:485: undefined reference to `__privileged_data_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:485: undefined reference to `__privileged_data_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:485: undefined reference to `__privileged_data_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:485: undefined reference to `__privileged_data_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `vPortStoreTaskMPUSettings':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:564: undefined reference to `__SRAM_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:564: undefined reference to `__SRAM_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:571: undefined reference to `__SRAM_segment_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:571: undefined reference to `__SRAM_segment_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:571: undefined reference to `__SRAM_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:571: undefined reference to `__SRAM_segment_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:577: undefined reference to `__privileged_data_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:577: undefined reference to `__privileged_data_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:582: undefined reference to `__privileged_data_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:582: undefined reference to `__privileged_data_end__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:582: undefined reference to `__privileged_data_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:582: undefined reference to `__privileged_data_start__'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `MPU_vTaskAllocateMPURegions':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:662: undefined reference to `vTaskAllocateMPURegions'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.o: In function `xTaskGenericCreate':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.c:523: undefined reference to `vPortYieldFromISR'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.o: In function `vTaskDelete':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.c:582: undefined reference to `vPortYieldFromISR'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.o: In function `vTaskDelayUntil':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.c:668: undefined reference to `vPortYieldFromISR'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.o: In function `vTaskDelay':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.c:729: undefined reference to `vPortYieldFromISR'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.o: In function `vTaskPrioritySet':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.c:853: undefined reference to `vPortYieldFromISR'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.o:/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/tasks.c:899: more undefined references to `vPortYieldFromISR' follow
collect2: ld returned 1 exit status
make: *** [arm-dcc.elf] Error 1
I don’t see any demos using plain GCC that I can base my modifications on, especially not for this microcontroller, so I’m at a loss. (And Eclipse has horrid hard-to-read config files… it also doesn’t run very well on mipsel-linux as I lack Java.)
How does one properly go about integrating the MPU code into an existing project?