AnsweredAssumed Answered

Stop NXP / IAR SDK from using excessive code space for predefined values.

Question asked by rick stuart on Apr 23, 2017
Latest reply on Apr 24, 2017 by Paddock

 

In our NXP kl03 processor project, I see where 160 bytes of RO memory (assumed to be program memory) has been reserved for data.  When I make a list file of the source file accused of causing this RO memory reservation for data, I see it is due to a number of type uint16_t variables assigned values in a header file:

 

uint16_t offset_for_a = 0;
uint16_t offset_for_b= sizeof(image_a);
uint16_t offset_for_c = 128;
uint16_t offset_for_d = sizeof(image_c) + 128;

 

If I remove both the 2nd and 4th line from the above code, the RO memory reservation drops to zero for the source file which includes the above header information.  If I leave either the 2nd or 4th line (just one but not both), the RO memory reservation jumps to 160 bytes.

 

"image_a" is of type structure containing 26 uint16_t values.

"image_c" is of type structure containing 3 uint16_t values.

 

So, then, why has the NXP / IAR SDK wasted 160 bytes of precious code space?

 

Outcomes