MSP430 C/C++ CODE GENERATION TOOLS 18.1.0.LTS Release Notes January 2018 ================================================================================ Contents ================================================================================ 1) Support Information 2) New Features 2.1) C++14 support * Features Included from v17.9.0.STS: 2.2) C++ ABI Compatibility * Features Included from v16.12.0.STS: 2.3) New function attribute to specify calling convention and new ROM calling convention 2.4) Improved stack usage with inline functions 3) Notable Bug Fixes in 17.3.0.STS 4) Notable Bug Fixes in 17.6.0.STS ------------------------------------------------------------------------------- 1. Support Information ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- 1.1) List of Fixed and Known Defects ------------------------------------------------------------------------------- As of the 16.12.0.STS release, the DefectHistory.txt file has been replaced with the two files Open_defects.html and Closed_defects.html. For open bugs, a status of Open or Accepted means that the bug has not been examined yet, whereas a status of Planned means that an evaluation or fix is in progress. ------------------------------------------------------------------------------- 1.2) Compiler Wiki ------------------------------------------------------------------------------- A Wiki has been established to assist developers in using TI Embedded Processor Software and Tools. Developers are encouraged to read and contribute to the articles. Registered users can update missing or incorrect information. There is a large section of compiler-related material. Please visit: http://processors.wiki.ti.com/index.php?title=Category:Compiler ------------------------------------------------------------------------------- 1.3) Compiler Documentation Errata ------------------------------------------------------------------------------- Errata for the "TI MSP430 Optimizing Compiler User's Guide" and the "TI MSP430 Assembly Language User's Guide" is available online at the Texas Instruments Embedded Processors CG Wiki: http://processors.wiki.ti.com/index.php?title=Category:Compiler under the 'Compiler Documentation Errata' link. ------------------------------------------------------------------------------- 1.4) TI E2E Community ------------------------------------------------------------------------------- Questions concerning TI Code Generation Tools can be posted to the TI E2E Community forums. The "Development Tools" forum can be found at: http://e2e.ti.com/support/development_tools/f/default.aspx ------------------------------------------------------------------------------- 1.5) Defect Tracking Database ------------------------------------------------------------------------------- Compiler defect reports can be tracked at the Development Tools bug database, SDOWP. The log in page for SDOWP, as well as a link to create an account with the defect tracking database is found at: https://cqweb.ext.ti.com/pages/SDO-Web.html A my.ti.com account is required to access this page. To find an issue in SDOWP, enter your bug id in the "Find Record ID" box once logged in. To find tables of all compiler issues click the queries under the folder: "Public Queries" -> "Development Tools" -> "TI C-C++ Compiler" With your SDOWP account you can save your own queries in your "Personal Queries" folder. ------------------------------------------------------------------------------- 1.6) Long Term Support release ------------------------------------------------------------------------------- The MSP430 CGT v18.1.0.LTS release is a long term support (LTS) release. This release will be supported for roughly 2 years with periodic bug fix updates. ------------------------------------------------------------------------------- 2. New Features ------------------------------------------------------------------------------- -------------------------------------------------------------------------------- 2.1) C++ 2014 RTS support -------------------------------------------------------------------------------- As of v18.1.0.LTS, the compiler uses the C++14 version of the C++ standard. Previously, C++03 was used. See the C++14 Standard ISO/IEC 14882:2014. For a description of unsupported C++ features, see Section 5.2 of the "TI MSP430 Optimizing Compiler User's Guide". The move to C++14 will break ABI compatibility with previous C++ RTS releases. Attempting to link old C++ object code with the new RTS will result in a link-time error. Suppressing this error will likely result in undefined symbols or undefined behavior during execution. C ABI compatibility will not be affected by this change. In most cases, recompiling old source code with the new RTS should be safe. However, due to the changes made in the language, some constructs will result in syntax errors. Some common issues include: - Macro expansion immediately adjacent to string literals may fail due to the inclusion of new string literals and literal suffixes. Ex: u8"def" will fail to compile if 'u8' is a macro "def"_x will fail to compile if '_x' is a macro - New keywords: alignas, alignof, char16_t, char32_t, constexpr, decltype, noexcept, nullptr, static_assert, and thread_local - The auto keyword has been repurposed and is no longer a valid storage class specifier. Similarly, the register keyword has been deprecated and will be removed in the future. A full list can be found in Appendix C, section 2 of the C++14 standard. ------------------------------------------------------------------------------- 2.2) C++ ABI Compatibility ------------------------------------------------------------------------------- v17.9.0.STS contains the first planned updates in preparation for the support of C++14 (International Standard ISO/IEC 14882:2014(E)). As part of this update, it is necessary to make changes which might cause errors when building C++ projects containing C++ object files compiled with older versions of the compiler. These errors will usually include linktime errors involving undefined symbols. If you see undefined symbol errors during a link, pass the "--no_demangle" option to the compiler. If the undefined symbol's name starts with _Z or _ZVT, then it's possible that there is a C++ object file or library built with an older version of the tools being used. These will need to be compiled with the v18.1.0.LTS tools to work properly. ------------------------------------------------------------------------------- 2.3) New function attribute to specify calling convention and new ROM calling convention ------------------------------------------------------------------------------- The call_conv attribute can be used to specify the calling convention for function calls. This is intended for allowing IAR and TI compilers to link against the same ROM image if it was generated using the new cc_rom calling convention. Currently the implementation only supports linking against ROM images built with IAR’s compiler using their ROM calling convention implementation. The TI Compiler currently does not support generating cc_rom ROM images. The new attribute can be applied to functions, function pointers, and function typedefs. The attribute is applied to a function with GCC attribute syntax, as follows: __attribute__((call_conv("cc_rom"))) The attribute accepts "cc_rom" or "cc_norm" (the default calling convention). Some examples: #define __cc_rom __attribute__((call_conv("cc_rom"))) __cc_rom void rom_func(void) { ... } typedef __cc_rom void (rom_func_t)(void); int main() { rom_func(); rom_func_t *fp = (rom_func_t*)0x1234; fp(); ((void (__cc_rom *)(void))0x2468)(); void (__cc_rom *rom_func_ptr)(void); rom_func_ptr = &rom_func; rom_func_ptr(); } See the MSP430 Optimizing C/C++ COmpiler User's Guide or below article for more details: http://processors.wiki.ti.com/index.php/call_conv_attribute ------------------------------------------------------------------------------- 2.4) Improved stack usage with inline functions ------------------------------------------------------------------------------- The new compiler improves stack usage by sharing aggregate data originally defined in inline functions. Example: struct ARGS { int f1,f2,f3,f4,f5; }; static inline void func1() { struct ARGS a = {1, 2, 3, 4, 5}; foo(&a); } static inline void func2() { struct ARGS b = {1, 2, 3, 4, 5}; foo(&b); } void func3() { func1(); func2(); } In previous compilers, if func1 and func2 are inlined, the structs a and b would not share the same stack location. This version of the compiler will now share stack memory for local aggregates defined in inline functions. ------------------------------------------------------------------------------- 3. Notable Bug Fixes in 17.3.0.STS ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- 3.1) IAR Compatibility: __cc_rom calling convention ------------------------------------------------------------------------------- Fixed an issue where using the __cc_rom calling convention with parameters of pointer type could result in code that passed the pointer in the wrong register. For example: typedef struct { uint8_t a; uint_8 b; } str_t; extern __cc_rom void func(uint16_t, str_t *); str_t my_str = {0, 0}; func(0, &my_str); The address of 'my_str' would be passed in R14 erroneously, instead of R13. ------------------------------------------------------------------------------- 4. Notable Bug Fixes in 17.6.0.STS ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- 4.1) IAR Compatibility: __cc_rom calling convention ------------------------------------------------------------------------------- The TI MSP430 compiler requires that a function which returns a signed char value in the return register sign extend the return value to 16-bits in that register before returning to the caller. The IAR compiler does not adhere to this requirement. To address this issue, the TI MSP430 compiler will recognize a call to a function that has been annotated with the __cc_rom calling convention attribute and that returns a signed char type return value, and then sign extend the return value from such a function to 16-bits before that value is used elsewhere in the caller function. For example, consider the following code: extern __attribute__((call_conv("cc_rom))) char my_ext_func(void); char my_glob_char = 0; bool func() { my_glob_char = my_ext_func(); if (my_glob_char == -1) { return false; } /* code containing other uses of my_glob_char */ ... } Because the my_ext_func() is declared with the __cc_rom attribute, the compiler knows that its signed char return value in the return register might not be sign extended to 16-bits, so it will sign extend the value in the return register before that value is used in the "if" condition or later in the body of func(). The compiler will behave similarly for indirect calls to __cc_rom functions that have a signed char return value. For example, extern __attribute__((call_conv("cc_rom))) char (*my_ext_func_ptr)(void); char my_glob_char = 0; bool func() { my_glob_char = (my_ext_func_ptr)(); if (my_glob_char == -1) { return false; } /* code containing other uses of my_glob_char */ ... } In this case, the value in the return register is again sign extended to 16-bits upon return from the indirectly called __cc_rom function, before the value is used elsewhere in the body of func().