AnsweredAssumed Answered

MQX: why does .vectors section gets empty if I empty .cfmprotect section?

Question asked by Luiz Fernando Schrickte on Apr 28, 2015
Latest reply on May 24, 2017 by Radek Sestak

Hi folks,


I know this may be a trivial question - I've already found a workaround but I need to understand what is happening!


My project has two programs: a bootloader and the application itself.


I want to keep the Flash Configuration Field definition only on the bootloader so I don't risk messing things up regardless of which firmware is programmed first.


In order to do this I have:


1. Changed the Application BSP vectors.c file in order to add the BSPCFG_ENABLE_CFMPROTECT conditional for GCC compilers (in green):



#elif defined(__CC_ARM) || defined(__GNUC__)


    /* flashx location defined in io/flashx/freescale/flash_mk64.h for KEIL */

    __attribute__((section(".cfmconfig"))) const uint32_t _cfm[4] __attribute__((used)) = {








2. Inserted the following line in my user_config.h:



3. Recompiled both BSP and application


The result is that now I don't have the _cfm symbol (which contains FCF definitions) on my resulting .map and .hex files. OK - I want this, but what I don't get is why did the .vectors section got empty too now? I didn't touch anything on vector definitions or memory area/sections!!


It looks like the linker is ignoring the GCC "used" attribute (but even if I uncheck the remove unused sections linker flag the .vectors section is still empty, with no vector table inside it)! Is it ignoring the whole vectors.o object on linking process for some reason? I've already obj-dumped the bsp.a lib and it has the table definition inside it!


App linker file memory areas, for reference:





    vectorrom   (RX): ORIGIN = 0x00008000, LENGTH = 0x00000400

    rom         (RX): ORIGIN = 0x00008420, LENGTH = 0x00077BE0  /* Code + Const data */

    ram         (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00030000  /* SRAM - RW data */


    /* kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap) */

    end_of_kd   (RW): ORIGIN = 0x2001FFF0, LENGTH = 0x00000000


    /* Boot stack reused by MQX Kernel data */

    bstack      (RW): ORIGIN = 0x2001FA00, LENGTH = 0x00000200  /* Boot stack */

    end_bstack  (RW): ORIGIN = 0x2001FC00, LENGTH = 0x00000000  /* Boot stack end address requires 4B alignment */



Some information:

1. Using KDS 2.0.0

2. Using MQX 4.1.1 for the APP. PE for the application.


Thanks very much!