Errors:range error for small data relocation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Errors:range error for small data relocation

1,096 Views
khadgaryu
Contributor II

         There is a struct in my [roject,like this,

         typedef struct
        {
           unsigned char Count;
           LabelMapping Mappings[];
        }LabelMappings;

       Code warrior 10.6 shows a error of range error for small data relocation,when i used the struct(LabelMappings, show above) in my project. There is a indefinite lengh array that support by C99 in the struct. And the code warrior supports C99. But there is a error when commpiling.

       There are two necessary conditions that lead to this error.One is the flexible array in the struct,the other I define varible ina file and refer the varible in another file.But I can't edit the files in my project.
       If i set the sdata and sdata2 to 0, I can compile the project successfully.But when sdata and sdata2 is 0,my project can;t run into main().My test result,if sdata = 0 and sdata2 = 0,project can run in debug mode, and can't run in noemal mode.

       I updata the new attachments,it is a whole project and can be open by code warrior 10.6.

Original Attachment has been moved to: MPC5645S_TEST.rar

Labels (1)
Tags (2)
0 Kudos
Reply
2 Replies

944 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

you have to enable C99 extension. See the picture below.

pastedImage_1.png

Regards,

Martin

0 Kudos
Reply

944 Views
khadgaryu
Contributor II

Thank you for your help.

In my project, I had set C99 enable before i wrote the question. 

I think the reason is that the IDE(compiler or linker) cant support the Flexible array which define by C99. I did a test. If i define the  Flexible array in the a.c file and i reference the Flexible array in the a.c too. CW10.6 will don't report the error. But if i define the  Flexible array in the a.c file and i reference the Flexible array in the b.c. CW10.6 will report the error.So i guess the reason is IDE can't support the Flexible array perfectly.

0 Kudos
Reply