This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280025: #pragma DATA_SECTION couldn't work for assigning const variable map to an fixed FLASH address

  • Hi Team,

      My customer reported an issue for using #pragma DATA_SECTION operation to allocate the const variable to an fixed FLASH address, could you kindly help on this?

      The detailed description has updated in the first post.

     

    Expect for your reply, thanks..

    Best Regards

    Benjamin

  • Benjamin,

    Do you know whether customer referred/used the variable anywhere in the code?  If it is not used yet, it may get optimized and removed.  

    Please check and confirm.

    Thanks and regards,
    Vamsi

  • Hi Benjamin,

    Quick observation -

    In map file it is saying used 0 word in APP_TYPE section which means the variable which is assigned to that location is  getting optimized. Can you request customer to check if that variable is used in code and if they are getting any compile warning for that variable ?

    Regards,

    Vivek Singh

  • Benjamin,

    If it is some type of static variable and user does not want to use it by variable name then request him to add following code for that variable after the definition.

    #pragma RETAIN (variable_name);

    This should avoid optimization of that variable.

    Regards,

    Vivek Singh

  • HI:

    Vivek Singh,

    Thank you for your support,I am the customer ,frist, I am not used the variable anywhere in the code,and  add the “#pragma RETAIN (variable_name)” in the code  can solve the problem。but I have a question ,why the variable get optimized or removed  when use the chip 280025?and I use the other chip in the same way have not this question ,for example  2802x/2803x.

    so can you tell me what's the difference between chip 2803x and  280025 on compile.

    Thanks and regards,

    Andilong

  • Andilong,

    Maybe it is for below reasons:

    1. It is a different compiler version and may be the old compiler behaved differently (did not optimized it).

    2. Maybe in your 2802x/3x application, you used the variable and hence it is not optimizied out.

    3. Maybe the difference is that in your F2802x/3x application, you used COFF output format; Where as for F280025, you might have used EABI output format, in which case, maybe the compiler is optimizing it.

    Let me know if you want me to loop in our compiler experts to confirm this.  

    For now, I am closing this post. If you want to take this discussion further, you can simply reply to this.  If it gets locked, you can open a new post using the "ask a related question" button at the top right corner of this webpage.

    Thanks and regards,
    Vamsi