# Compilation error

**URL:** <https://forums.freertos.org/t/compilation-error/16257>\
**Category:** Kernel\
**Created:** [November 22, 2022, 5:29am UTC](https://forums.freertos.org/t/compilation-error/16257 "2022-11-22T05:29:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![migmel](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@migmel](https://forums.freertos.org/u/migmel)\
**Post date:** [November 22, 2022, 5:29am UTC](https://forums.freertos.org/t/compilation-error/16257/1 "2022-11-22T05:29:10Z")

</div>

Hello, I am trying to compile (using Keil) an app into an STM32F407IG and get these errors:

Error: L6218E: Undefined symbol **FLASH\_segment\_end** (referred from port.o).  
Error: L6218E: Undefined symbol **FLASH\_segment\_start** (referred from port.o).  
Error: L6218E: Undefined symbol **SRAM\_segment\_end** (referred from port.o).  
Error: L6218E: Undefined symbol **SRAM\_segment\_start** (referred from port.o).  
Error: L6218E: Undefined symbol **privileged\_data\_end** (referred from port.o).  
Error: L6218E: Undefined symbol **privileged\_data\_start** (referred from port.o).  
Error: L6218E: Undefined symbol **privileged\_functions\_end** (referred from port.o).  
Error: L6218E: Undefined symbol **syscalls\_flash\_end** (referred from port.o).  
Error: L6218E: Undefined symbol **syscalls\_flash\_start** (referred from port.o).

I have founded in port.c this conditional extern variables:

static void prvSetupMPU( void )  
{  
#if defined( \_\_ARMCC\_VERSION )  
/\* Declaration when these variable are defined in code instead of being  
\* exported from linker scripts. _/  
 **extern uint32\_t \* privileged\_functions\_end;**  
 **extern uint32\_t \* FLASH\_segment\_start;**  
 **extern uint32\_t \* FLASH\_segment\_end;**  
 **extern uint32\_t \* privileged\_data\_start;**  
 **extern uint32\_t \* privileged\_data\_end;**  
 #else  
/_ Declaration when these variable are exported from linker scripts. \*/  
extern uint32\_t **privileged\_functions\_end** [];  
extern uint32\_t **FLASH\_segment\_start** [];  
extern uint32\_t **FLASH\_segment\_end** [];  
extern uint32\_t **privileged\_data\_start** [];  
extern uint32\_t **privileged\_data\_end** [];  
#endif

and these:

static void prvSVCHandler( uint32\_t _pulParam )  
{  
uint8\_t ucSVCNumber;  
uint32\_t ulPC;  
 #if( configENFORCE\_SYSTEM\_CALLS\_FROM\_KERNEL\_ONLY == 1 )  
 #if defined( \_\_ARMCC\_VERSION )  
/_ Declaration when these variable are defined in code instead of being  
\* exported from linker scripts. _/  
 **extern uint32\_t \* syscalls\_flash\_start;**  
 **extern uint32\_t \* syscalls\_flash\_end;**  
 #else  
/_ Declaration when these variable are exported from linker scripts. _/  
extern uint32\_t **syscalls\_flash\_start** [];  
extern uint32\_t **syscalls\_flash\_end** [];  
 #endif /_ #if defined( \_\_ARMCC\_VERSION ) _/  
 #endif /_ #if( configENFORCE\_SYSTEM\_CALLS\_FROM\_KERNEL\_ONLY == 1 ) \*/

Does anybody know what might be missing to cause these error messages?  
I am using this port for my app: FreeRTOS\Source\portable\GCC\ARM\_CM4\_MPU  
Thank you for your help

---

<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:** [November 22, 2022, 6:14am UTC](https://forums.freertos.org/t/compilation-error/16257/2 "2022-11-22T06:14:09Z")

</div>

That is the port with memory protection unit (MPU) support. Was that your intention? If so the variables that are currently missing are linker variables and need to be defined in your linker script - which Keil call a scatter file. There are examples in the FreeRTOS download if you look in FreeRTOS/Demo/CORTEX\_MPU\_\*. Otherwise, if you didn’t intend to use the MPU port build the port files from the directory that doesn’t have MPU in its name.

---

<div class="post-metadata">

**Author:** ![migmel](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@migmel](https://forums.freertos.org/u/migmel)\
**Post date:** [November 22, 2022, 6:24am UTC](https://forums.freertos.org/t/compilation-error/16257/3 "2022-11-22T06:24:51Z")

</div>

Hello, I have changed the port to FreeRTOS\Source\portable\GCC\ARM\_CM4F and it compiles fine. I think just made a mistake by selecting the wrong port. I was thinking because STM32F407IG includes a memory protection feature, then i should choose ARM\_CM4\_MPU port.  
Sorry I am new to FreeRTOS.  
Thank you
