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.

Compiler/MSP430F47187: How to remove thoes info from compilation output file such as "Number out of range. Valid range is -32768 (-0x8000) to 65535 (0xFFFF)"

Part Number: MSP430F47187

Tool/software: TI C/C++ Compiler

Hi TI,

We are using IAR for MSP430 to compile and generated a static library. The sources file, which is a c code of an algorithm(i.e. actually platform independent) and just a bit large but the generated libary should be small as around 30K Bytes as it is we generated the libary for many other platforms.  However, when we use IAR for MSP430 to generate the libary, it generates a library of nealy 600K Bytes. so big !

We tried to open the generated .r43 libary with an edit tool, such as a text edit, and find that it contains a lot of below readble compilation info appended to the "real" libary as below, which is the reason why the libary is so big:

       Number out of range. Valid range is -32768 (-0x8000) to 65535 (0xFFFF).
       File: *****\******\*****\****.c, Line: 11126
       Source: CALL #?Subroutine123s*******

There are hundreds of lines of such above readable info repeated(only except the Line number are different) inside the generated .r43 libary, which cause the libary is too big. And meanwhile, it provides a possibility to hack the libary since it contains two much readable info of source !  Actually, the above compilation info has been added into the generated .r43 object file by the icc430.exe  is performed and reserved into the .r43 libary by the xar.exe.

Although it is big, but the libary has no problem if we add it into out project and could be work fine. That is, the generated file has no problem to be linked into other projects.

If we remove the readable of above info from the libary using an edit tool and left those , and the size would be reduced to 30KBytes, but the library could not be linked into our proects and the conpilation says the libary "is not a UBROF file", which means that we could not remove those above meanningless compilation info from the libary simply just with an edit tool.

So, how and what might be the compilation option, so that we could exclude those compilation info from the generated .r43 libary?

Thanks!

  • Your sample message looks like it's partially auto-generated, and partly specific. What code is at line 11126? Can you find the string (e.g.) "Valid Range is" in the .c file? 

    To my eye it looks suspiciously like an ASSERT() message, intended to be displayed on a terminal. My first guess is that IAR has a default ASSERT() macro which generates something that looks like that, and your other platforms don't.

    Sometimes this is under control of a boolean symbol like DEBUG (-DDEBUG=0), but it may be worth searching the IAR documents for ASSERT to find out.

  • Thanks for the reply.

    Sure, if we could fix the compilation warning of "Number out of range. Valid range is" and then the information would not present inside the generated files anymore.  But this is an generated libary and we could not remove those codes which would unuded during we linked into a project, so these warnings will be here always.

    I have no against  if it would be present in the compilation window during compilation. But  the de-facto problem is not what is the meaning of the warninga,  (and the generated libray with these additional readable warnings workd fine as well) but why these warnings would be added into the generated libary file in a readble format.  This issue is present only when use IAR for MSP430, other than for IAR for ARM, and gcc for MSP430.  

    I 'd like to knwo a way to remove them from the generated libary when use IAR for MSP430.

    I guess there might be a compilation option if we add to the icc430.exe, or  a correctIAR configuration other than default, then redundant warnings would not be added into the generated libary. Just like what we have did to remove those debug info from the compilation.  And if so, I hope to get it.  I don't find it now.

    Thanks!

  • Hello,

    The 600KB is the size of library file or size of final code? As I know, these warning messages won't be compiled into the final code.

    But I think the root cause of these warnings should be resolved to eliminate risk. Could you post the detail description of this warning?    

  • > What code is at line 11126? 

    ----------------------------------------

    That doesn't look like a compiler warning to me; I can't think of any C code that could trigger that as a diagnostic. Do they resemble the diagnostics IAR gave you when you compiled the source?

  • 1. 600KB = file size of generated .r43 library. 

       More detais are,

    (1)  when we build a source to get a libray using IAR for MSP430, the IAR would trigger below command:

    icc430.exe C:\******\*****\****.c -o C:\******\*****\Release-F4xx\Obj\ -D__MSP430F47187__ --char_is_signed --enable_multibytes --double=32 --lock_r4 --lock_r5 --clib --library_module --core=430X --data_model=medium -Oh --c89 --segment __data16=DATA16 --segment __data20=DATA20 -DNDEBUG --code_model=small

    and generate an intermidiate .r43 file of more than 600KBYtes, which contains a lot of repeated  "Number out of range. Valid range is -32768 (-0x8000) to 65535 (0xFFFF)" inside, but there is no error to terminate the complation.

    (2) And then, the IAR woul trigger below command to convert the intermidiate .r43 file to a static .r43 libary, since we config IAR  to generate a libary

    Building library
    xar.exe C:\******\*****\Release-F4xx\\Release-F4xx\Obj\***.r43 -o C:\******\*****\****.c -o c:\******\*****\Release-F4xx\Exe\***.r43

    And the generated libaray file is around 600KBytes in size

    (3) Open the gnerated libary, we fould find that just at beginning, there is a small portion of un-readable code which is something the real libary codes as what we build with other tools, and following there are a lot of repeated readable "Number out of range. Valid range is -32768 (-0x8000) to 65535 (0xFFFF)" following, which makes the generared .r43 file is too big.

    (4) We geneterated a testing IAR project and added the generated 600K .r43 libary into the project, and build the project. Everything is OK and we could call the module functions from the libary successfully. We tried to call nearlly all the module functions of the libary from the testing project, and the built project image is only around 100KBytes, nearly a same size as what we did use other comiplation such as gcc.

    So, the problem is why so many unnecessary readable "nmber out of range...." would be added into the IAR generated library.

    2. When we open the generated libary using untraEdit, to find that:

         line# 0-29:  unreadable code, something like the real library code

        line# 30-7868:  Readable text of  "Number out of range...."  a

                                    (and only the last part of the the last line 7868 is some unreadable code like file end information etc)

    3. Examples of  "number out of range...."  inside the generated libary:

    30:  Number out of range. Valid range is -32768 (-0x8000) to 65535 (0xFFFF).
    31:  File: C:\******\*****\****.c, Line: 11373
    32:  Source: CALL #?Subroutine51s€ ?[7?^X 澯
    33:  Number out of range. Valid range is -32768 (-0x8000) to 65535 (0xFFFF).
    34:  File: C:\******\*****\****..c, Line: 11379
    35:  Source: CALL #?Subroutine44s€ ?[^@ L澒

    ........

    Thanks!

  • Since the warning messages indicate the code lines in file that trigger the warning, I'd like to suggest you to fix that code.

**Attention** This is a public forum