Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

ARM Cortex M3 MPU (GCC) port

Posted by Stuart Longland on March 24, 2010
Hi all,
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?

RE: ARM Cortex M3 MPU (GCC) port

Posted by Stuart Longland on March 24, 2010
Update: Managed to get some of the linker errors down, but not all...
This was done by adding in both port.c's from ARM_CM3 and ARM_CM3_MPU... which does not look right, and (predictably) leads to multiple definition errors. I also tinkered with the linker script.

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/port.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
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `pxPortInitialiseStack':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:207: multiple definition of `pxPortInitialiseStack'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.o:/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.c:115: first defined here
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `vPortSVCHandler':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:236: multiple definition of `vPortSVCHandler'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.o:/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.c:134: first defined here
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `xPortStartScheduler':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:320: multiple definition of `xPortStartScheduler'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.o:/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.c:167: first defined here
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `vPortEndScheduler':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:345: multiple definition of `vPortEndScheduler'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.o:/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.c:188: first defined here
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `vPortEnterCritical':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:352: multiple definition of `vPortEnterCritical'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.o:/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.c:202: first defined here
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `vPortExitCritical':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:363: multiple definition of `vPortExitCritical'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.o:/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.c:209: first defined here
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `xPortPendSVHandler':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:379: multiple definition of `xPortPendSVHandler'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.o:/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.c:222: first defined here
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `xPortSysTickHandler':
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.c:418: multiple definition of `xPortSysTickHandler'
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.o:/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3/port.c:254: first defined here
/home/stuartl/ezecorp/git/arm-dcc/../stellarisware/third_party/freertos/Source/portable/GCC/ARM_CM3_MPU/port.o: In function `prvSetupMPU':
port.c:(privileged_functions+0x252): undefined reference to `__FLASH_segment_start__'
port.c:(privileged_functions+0x256): undefined reference to `__FLASH_segment_start__'
port.c:(privileged_functions+0x268): undefined reference to `__FLASH_segment_end__'
port.c:(privileged_functions+0x26c): undefined reference to `__FLASH_segment_end__'
port.c:(privileged_functions+0x270): undefined reference to `__FLASH_segment_start__'
port.c:(privileged_functions+0x274): undefined reference to `__FLASH_segment_start__'
port.c:(privileged_functions+0x29a): undefined reference to `__FLASH_segment_start__'
port.c:(privileged_functions+0x29e): undefined reference to `__FLASH_segment_start__'
port.c:(privileged_functions+0x2b0): undefined reference to `__privileged_functions_end__'
port.c:(privileged_functions+0x2b4): undefined reference to `__privileged_functions_end__'
port.c:(privileged_functions+0x2b8): undefined reference to `__FLASH_segment_start__'
port.c:(privileged_functions+0x2bc): undefined reference to `__FLASH_segment_start__'
port.c:(privileged_functions+0x2e2): undefined reference to `__privileged_data_start__'
port.c:(privileged_functions+0x2e6): undefined reference to `__privileged_data_start__'
port.c:(privileged_functions+0x2f8): undefined reference to `__privileged_data_end__'
port.c:(privileged_functions+0x2fc): undefined reference to `__privileged_data_end__'
port.c:(privileged_functions+0x300): undefined reference to `__privileged_data_start__'
port.c:(privileged_functions+0x304): 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':
port.c:(privileged_functions+0x3e4): undefined reference to `__SRAM_segment_start__'
port.c:(privileged_functions+0x3e8): undefined reference to `__SRAM_segment_start__'
port.c:(privileged_functions+0x3f4): undefined reference to `__SRAM_segment_end__'
port.c:(privileged_functions+0x3f8): undefined reference to `__SRAM_segment_end__'
port.c:(privileged_functions+0x3fc): undefined reference to `__SRAM_segment_start__'
port.c:(privileged_functions+0x400): undefined reference to `__SRAM_segment_start__'
port.c:(privileged_functions+0x420): undefined reference to `__privileged_data_start__'
port.c:(privileged_functions+0x424): undefined reference to `__privileged_data_start__'
port.c:(privileged_functions+0x430): undefined reference to `__privileged_data_end__'
port.c:(privileged_functions+0x434): undefined reference to `__privileged_data_end__'
port.c:(privileged_functions+0x438): undefined reference to `__privileged_data_start__'
port.c:(privileged_functions+0x43c): 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':
port.c:(.text.MPU_vTaskAllocateMPURegions+0x16): undefined reference to `vTaskAllocateMPURegions'
collect2: ld returned 1 exit status
make: *** [arm-dcc.elf] Error 1


The linker script is as follows:
/******************************************************************************
*
* standalone.ld - Linker script for applications using startup.c and
* DriverLib.
*
* Copyright (c) 2005-2007 Luminary Micro, Inc. All rights reserved.
*
* Software License Agreement
*
* Luminary Micro, Inc. (LMI) is supplying this software for use solely and
* exclusively on LMI's microcontroller products.
*
* The software is owned by LMI and/or its suppliers, and is protected under
* applicable copyright laws. All rights are reserved. Any use in violation
* of the foregoing restrictions may subject the user to criminal sanctions
* under applicable laws, as well as to civil liability for the breach of the
* terms and conditions of this license.
*
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
* LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
* This is part of revision 1392 of the Stellaris Peripheral Driver Library.
*
*****************************************************************************/

MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
}

SECTIONS
{
.text :
{
KEEP(*(.isr_vector))
*(.text*)
*(.rodata*)
_etext = .;
} > FLASH

.privileged_functions : AT (ADDR(.text) + SIZEOF(.text))
{
*(.privileged_functions*)
} > FLASH
.data : AT (ADDR(.privileged_functions) + SIZEOF(.privileged_functions))
{
_data = .;
*(vtable)
*(.data*)
_edata = .;
} > SRAM

.bss :
{
_bss = .;
*(.bss*)
*(COMMON)
_ebss = .;
} > SRAM
}


Regards,
Stuart Longland

RE: ARM Cortex M3 MPU (GCC) port

Posted by Dave on March 24, 2010
Going back to your original problem (rather than answering your question :o) the most common cause of a crash in a cortex M3 application is a misconfigured interrupt priority. This can result from a misunderstanding of how interrupts priorities are defined (it is strange) or the misuse of a vendor provided function used to set a priority (the semantics differs between vendors and the vendors themselves get it wrong).

This is some text from the SafeRTOS support forum, it holds true for FreeRTOS too except in FreeRTOS the priorities set by the constants can be configured:


The SafeRTOS Cortex M3 port implements a full interrupt nesting model. Normally the user definable constants configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY define the interrupt priority used by the kernel itself and the maximum interrupt priority from which SafeRTOS API calls can be made respectively. However, when SafeRTOS is pre-loaded in ROM these constants cannot be modified. In the LM3S9B96 configKERNEL_INTERRUPT_PRIORITY is set to 255 and configMAX_SYSCALL_INTERRUPT_PRIORITY is set to 191.

Important: The Cortex-M3 core uses numerically low priority numbers to represent HIGH priority interrupts, which can seem counter-intuitive and is easy to forget. If you wish to assign an interrupt a low priority do not assign it a priority of 0 (or other low numeric value) as this can result in the interrupt actually having the highest priority; and potentially make your system behaviour unpredictable if this priority is above portSYSCALL_INTERRUPT_PRIORITY. Interrupts that use the SafeRTOS API must be assigned a numeric priority of 191 or a numerically higher value to give them an interrupt priority equal to or lower than 191. Interrupts that make use of the SafeRTOS API must be explicitly assigned an interrupt priority as all interrupt priorities are zero by default.

The value 191 is stated as if all eight priority bits were implemented. The LM3S9B96 only has three bits implemented, further the three bits are the top three bits of the byte. Therefore 191 is equivalent to ( 5 << 5 ) [5 shifted into the top 3 bits], or simply 5 if a CMSIS function is used to assign a priority to an interrupt.”

RE: ARM Cortex M3 MPU (GCC) port

Posted by Dave on March 24, 2010
Everything under the quote tag is supposed to be included in the quote, right down to the bottom.

RE: ARM Cortex M3 MPU (GCC) port

Posted by Richard on March 24, 2010
Switching from the standard CM3 port to the MPU enabled CM3 port can be quite involved, unless you have experience of doing it before and have taken care not to accidentally use any shared memory from the outset. Once the MPU is enabled user mode tasks will not be able to access shared memory unless they are explicitly given access to a memory region - so in most cases you would have to both switch to the MPU enabled port files AND determine which tasks can legitimately access which memory.

If you want to use the MPU enabled port then I would suggest that you start with one of the pre-configured MPU demo applications. That way you will have all the correct configuration from the outset (the LPC17xx eBook also contains a short chapter on using the MPU port) and can add in your own application code little by little so you always know you have a working configuration.

The linker errors you are seeing are generated because the port code expects to see certain constants (addresses) defined in the linker script itself. Take a look at the linker scripts that come with the existing MPU demos.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists