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.

CCS 6.12 compile "unsigned int array" as "char array"

Other Parts Discussed in Thread: MSP430FR2033

Hi

I declare

I am using MSP430FR2033

unsigned int ADCLastSamplesResults[15];

If I stand with the mouser on the array - I see that the array is unsigned int array and start as address 0x00210C ...

And also include the last samples

but the compiler see this array as char array, and the diassembly is like char array ...

As you can see - the compiler use mov.b command.. also it read from address 0x2111 instead of 0x2116...

Also this code the complier didn't compile

because BatteryMinTH is define as 425 and if I define BatteryMinTH as 250 the complier wiil compile this code

As you can see the compiler see this array as char array and because char can't be greater than 255 the comiler didn't compile the if command that ask greater than 450

Can you please tell me where I wrong ? Maybee my declarion not match the compiler specifications?

Best Regards

Yaakov

  • There isn't enough information here to understand what is going on.  Please submit a test case.  Preprocess the source file with the function that generates the problem byte access.  Attach that to your next post.  Tell us the name of that function.  Also show the compiler version (not the CCS version) and the build options exactly as the compiler sees them.

    Thanks and regards,

    -George

  • Dear George,

    Thanks for your replay

    The full version is : Version: 6.1.2.00015 I use MSP430 Compiler

    The compliler options are:

     -vmspx --abi=eabi --opt_for_speed=0 --use_hw_mpy=none --include_path="C:/ti/ccsv6/ccs_base/msp430/include" --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-msp430_4.4.5/include" --advice:power=all --advice:hw_config=all -g --define=__MSP430FR2033__ --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU40 --printf_support=minimal

    The functions with problems are : Check Battery (the non comiple code) and CheckWRU (with the byte instead fo word problem)Battery.txtWRU.txt

    Please see the attach files (Ichange it to txt file instead of pp files).

  • In both cases (Battery.txt and WRU.txt), the global variable ADCLastSamplesResults is declared "extern char ADCLastSamplesResults[15];"

    1) This does not match what CCS is reporting for the variable. Check the variable definition and every declaration to make sure they are exactly the same type.

    2) For the ranges of values shown in your code, you must declare and define this variable as an array of int or unsigned int so that it can hold values of that magnitude.
  • Dear George

    Thanks for your answers.
    I declared "unsigned int" but in the extern I declared "char"
    Fix the declaration and everything fine.
    Do you have any idea what the compiler need to warnning in case for this mistake?
  • If you use optimization level 4 (--opt_level=4), the linker will catch type mismatches.
  • Hi

    I tried to compile with level4 and I got error : "errors occurred while reading"

    Do you have any idea - what the problem?

  • Sorry, but no.  I need to see more context.  Please post the entire build log from the Console view, not the Problems view.  Use the Copy Build Log icon to save it to a text file, then attach that to your next post.

    Thanks and regards,

    -George