AnsweredAssumed Answered

Vybrid M4 hangup when using initialized structs

Question asked by mpfgregory on Apr 21, 2016
Latest reply on May 9, 2016 by Victor Linnik

The following code crashes on my Vybrid M4. The code is not even executed, but mqxboot already crashes the Linux kernel when uploading the binary.

 

struct xxx {

    int a;

    int b;

};

struct xxx bla = {1, 5};

 

If I use struct xxx bla = {0, 0}; instead, it works fine. Using initialized variables !=0 that are not structs also work. It happens only when I initialize structs with something != 0.

 

I wonder in which section  the initialized structs are placed. In the .map file I see only functions, not variables. I have tried using

__attribute__((section("RAM_VECTORS")))

but the crash still happens. When building I get a linker warning:

FreescaleMQXRTOS4.0.1/lib/pcm052_m4.ds5/debug/bsp/ram.scf", line 42 (column 20): Warning: L6314W: No section matches pattern vectors.o(.vectors_ram).

 

I guess the structs should be placed in this section, but apparently nothing is put there. Does anybody know how to set-up the scatter file so that the initialized structs are placed in the correct section?

Outcomes