Readme for C2000 Code Generation Tools v20.12.0.STS
Table of Contents
Short-term Support Release
The C2000 CGT v20.12.0.STS release is a short term support (STS) release. This release will be supported only until the next STS or LTS release.
Compiler Downloads and Documentation
Documentation for the “TI C2000 Optimizing Compiler User’s Guide” and the “TI C2000 Assembly Language User’s Guide” is available online at:
https://www.ti.com/tool/C2000-CGT
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/tools
Defect Tracking Database
Compiler defect reports can be tracked at the Development Tools bug database at:
New Features:
Enumerated type changes
The exact type chosen for enumerated types and for enumeration constants has changed from previous branches for certain compilation modes. In particular, the compiler will now choose the same signedness for the underlying integer type for enumerated types in strict C mode as it always did in relaxed (default) C mode; the size of the underlying types chosen does not change.
That is, in strict ANSI mode, sometimes the compiler chose a signed type when it should have chosen the corresponding unsigned type. Also, the exact type of some enumeration constants may change in C mode. The C standard requires that all enumeration constants that will fit in “signed int” must have type “signed int,” which was not being observed in previous versions. Most programs will not be able to tell the difference. If you don’t assign an integer that does not correspond to an enumeration constant belonging to the enumerated type to a variable of that enumerated type, and you don’t perform arithmetic on enumerated types or enumeration constants, it is extremely difficult to tell the difference between the old behavior and the new behavior.
See the compiler user’s guide for the precise details of how underlying integer types for enumerated types and the types of enumeration constants are chosen.
Performance improvements
More efficient data accesses for lower 16-bits of memory: The C2000 compiler has a new feature for more efficiently accessing data with addresses in the lower 16-bits of memory. This can be done with either the location attribute:
__attribute__((location(0x100))) extern struct PERIPH peripheral;
Or dereferencing a literal (either of below):#define peripheral (*((struct PERIPH)(0x100)))
struct EPWM_REGS volatile* const epwm1 = (struct EPWM_REGS *)(0x4000);CLA improved loading of 16-bit constants: Previously, the C2000/CLA compiler would produce the following assembly for the loading of a 16-bit constant:
MOVIZ MR0,#0 MOVXI MR0,#256 MMOV16 @_g,MR0
For the use case of uint16_t, the first MOVIZ instruction is unnecessary and has now been eliminated.Improved performance for several HWINTDIV routines: In the 18.12.0.LTS release, the initial HWINTDIV implementation had inefficiencies with directly loading integer constants into floating point registers. This release includes improvements with directly loading into floating pointer registers for 22-bit unsigned and signed positive integers for either numerator or denominator.
Live Firmware Update
The live firmware update support in 20.12.0.STS compiler is alpha capability. Additional improvements will be made in future releases.
To support updating EABI firmware images of C28x/CLA devices without powering them down, a new feature is available which allows preserving global and static symbol addresses at memory locations of a previous ELF executable alongside updating certain symbol addresses. This behavior is controlled by the following symbol attributes:
__attribute__((preserve))Path to a reference ELF executable can be provided to the compiler using the following compiler option:
__attribute__((update))
--lfu_reference_elf,-lfu=pathWhen performing a “warm” start i.e. a Live Firmware Update using an executable compiled with this feature, the preserve symbols are located at exactly the same addresses as before while symbols that are update can move to a different address and must be re-initialized using a new autoinit RTS routine called:
void __TI_auto_init_warm();This routine should be called from a custom entry point in order to not re-initialize all the symbols whose values in memory should be preserved.
If the update attribute is specified for one or more symbols then a new section
.TI.update is created by the Linker and all update symbols are collected into this section. When this is the case, a new entry in the Linker command file to place this new .TI.update section in an appropriate memory range is required. It is also possible to choose whether to preserve the locations of all global and static symbols by default or to only preserve when a symbol attribute is specified using the following compiler option:
--lfu_default[=none,preserve]
The compiler defaults to preserving all global and static symbol addresses if found in the reference ELF executable unless an __attribute__((update)) is specified for a symbol. When -–lfu_default=none is specified, the compiler only preserves the addresses of those symbols which have __attribute__((preserve)) specified and is free to move the variables which have __attribute__((update)) specified.
It is also important to note that when variables are preserved for LFU, .TI.bound sections are created for each of these variables. When such sections are contiguous in memory, the Linker is able to coalesce them into single output sections and therefore reduce the number of CINIT records required to initialize them. The coalescing of bound sections is only enabled for Live Firmware Update at present.
For hand written assembly code, it is possible to have preserve behavior for symbols using a combination of a new directive .preserve <symbols_name> and adding a section for that symbol to be a subsection of .TI.bound as well as specifying .elfsym directives to indicate behavior. For e.g., to preserve the address of var0:
.preserve var0 ; In asm header block
…
.global ||var0||
.sect ".TI.bound:var0", RW
.elfsym ||var0||, SYM_PRESERVE(1)
…
.sblock ".TI.bound:var0"
For update behavior, simply making the section for that variable a subsection of TI.update and adding an .elfsym for that symbol is sufficient. For e.g. to update var1:
.global ||var1||
.sect “.TI.update:var1”, RW
.elfsym ||var0||, SYM_UPDATE(1)
…
Generate CRCs over memory ranges
Along with generating CRCs over output sections, the compiler can now generate CRCs over certain memory ranges. This feature is enabled by some new syntax added to the linker command file.
MEMORY
{
GROUP
{
MEMRANGE1 : origin = 0x000000, length = 0x000100
MEMRANGE2 : origin = 0x000100, length = 0x000100
} crc(_symbol, algorithm="CRC32_PRIME")
}
The MEMORY directive now supports a top-level GROUP keyword, which will let users specify logical groups of memory ranges. These groups can then be CRC’ed by invoking the ‘crc’ operator.
The above is a snippet of a linker command file. The file describes two memory ranges that span from 0x0 -> 0x200, and there’s crc invocation that will compute a CRC32_PRIME over that range of memory.
Like CRC tables, the result will be stored in a table format, that’s accessible from the runtime via a linker-generated symbol (‘symbol’ in the example above). See the user guide for more information regarding the format of the table.
All CRC algorithms supported by CRC tables will also be supported by CRCs over memory ranges.
CRCs over memory ranges can only be computed over continuous blocks of memory that are on the same page. This means that there can be no gaps between any of the memory ranges included in a GROUP.
Misra support deprecated
Misra support has been deprecated and removed from this STS release. The MISRA checking functionality will be disabled.
The --check_misra option is deprecated and issues a Warning.
The --misra_advisory and --misra_required options are deprecated and issue a remark.
All 3 options have no effect.
Resolved defects
Resolved defects in v20.12.0.STS:
| ID | Summary |
|---|---|
| CODEGEN-8244 | C2000 register load instruction, “MOVP T, SP”, erroneously eliminated |
| CODEGEN-8201 | C2000 MOVD32 instruction tries to simultaneously access two memory locations across DP boundary |
| CODEGEN-8175 | C2000 compiler guide erroneously says with –fp_mode=relaxed option, doubles will be replaced with integers instead of floats |
| CODEGEN-8116 | Documentation for hex2000 does not explain several boot table options |
Known defects
Known defects in v20.12.x.STS:
| ID | Summary |
|---|---|
| CODEGEN-8390 | Change compiler manual to note that PM status bits are always 1, and not 0 |
| CODEGEN-8377 | C++ header files do not build clean with –issue remarks |
| CODEGEN-8265 | Combining #pragma SET_DATA_SECTION and –gen_data_subsections=on fails to put arrays into subsections |
| CODEGEN-8214 | Rounding error in floating point division of constant values |
| CODEGEN-8100 | Compiler does not account for wraparound when different increment type added to signed int |
| CODEGEN-7444 | Linker internal error when crc_table is applied to EXIDX |
| CODEGEN-7388 | The option –preproc_dependency mishandles spaces in directory names |
| CODEGEN-6509 | Compiler error: no instance of function template matches the argument list |
| CODEGEN-6070 | Erroneous “redeclared with incompatible type” involving two tagless structs with same form |
| CODEGEN-5179 | When a symbol is remapped, DW_TAG_TI_branch/DW_AT_name is not updated |
| CODEGEN-5078 | Simple syntax error causes assembler to fail with INTERNAL ERROR |
| CODEGEN-4985 | Typo on ULP Advisor message |
| CODEGEN-4960 | Using –gen_profile_info with code with CLA source fails to build |
| CODEGEN-4342 | cerr.tie() returns the wrong value |
| CODEGEN-4329 | Initializing unordered_map with an initializer_list fails with -o2 or higher |
| CODEGEN-4323 | 1 ULP rounding error in double addition |
| CODEGEN-4318 | libcxx/include/random uses unsigned for unsigned long |
| CODEGEN-4305 | Compiler aborts with excessive inlining of C++ functions |
| CODEGEN-4298 | Internal error when passing a temporary array of objects |
| CODEGEN-4297 | Cannot take the address of std::ctype<char>::table_size |
| CODEGEN-4296 | Undefined symbol isblank with -g or -ooff |
| CODEGEN-4290 | wstring runtime failure - likely bug in swprintf |
| CODEGEN-4281 | Unexpected type returned by bitset [] operator |
| CODEGEN-4276 | std::multimap::clear is not noexcept |
| CODEGEN-4275 | std::num_get does not parse floating-point strings correctly |
| CODEGEN-4259 | noexcept(typeid(d)) runtime fail on polymorphic class type |
| CODEGEN-4258 | deeply nested lambda functions hang the codegen |
| CODEGEN-4250 | regex_constants::ECMAScript not expected to be 0 |
| CODEGEN-4248 | armcl allows non-default arguments to be specified after default arguments |
| CODEGEN-4247 | Internal error when assigning default arguments to a parameter pack |
| CODEGEN-4245 | Multiple non-variables may be declared using auto or decltype(auto) |
| CODEGEN-4234 | No error generated for lambda-expression in default argument cannot capture any entity. |
| CODEGEN-4158 | TI compiler does not emit clang error: constexpr function never produces a constant expression |
| CODEGEN-4157 | error with using constexpr for return from end() with empty std::initializer_list |
| CODEGEN-4132 | cannot find matching “==” operator definition |
| CODEGEN-4124 | Failure to defer access control checks |
| CODEGEN-4122 | decltype cannot be used as a destructor name |
| CODEGEN-4119 | user-supplied allocator function is not called |
| CODEGEN-4099 | Composing operations for valarray may fail to compile |
| CODEGEN-4090 | Unimplemented core issue 475: std::uncaught_exception is not true when constructing the thrown object |
| CODEGEN-4087 | wostringstream::fill(WCHAR_MAX) incorrectly sets the fill value to ' 'L. |
| CODEGEN-4076 | Exception propagating out of noexcept function does not call std::terminate |
| CODEGEN-4072 | Unimplemented core issue 1769: Catching a thrown derived class by reference to base clas |
| CODEGEN-4071 | <regex> never throws error_ctype |
| CODEGEN-4069 | std::linear_congruential_engine doesn't support 8-bit results |
| CODEGEN-4044 | libcxx istreambuf_iterator points to end of string instead of character past match |
| CODEGEN-1194 | hex2000, while using -b option, mistakenly states a section “falls in unconfigured memory” |
| CODEGEN-1031 | C2000 float software multiply doesn't handle -1*INF properly |
| CODEGEN-1028 | C2000 can't print 0 with %a format |
| CODEGEN-580 | C2000 RTS float arithmetic functions do not round correctly |
| CODEGEN-322 | Structure is not initialized correctly when using -o2 or -o3 optimization |
| CODEGEN-104 | Linker gives misleading warning when dot expressions used in SECTION directive for .stack section |
| CODEGEN-88 | strcmp doesn't correctly handle values with uppermost bit set |
| CODEGEN-71 | Extern inline functions are not supported in the C/C++ Compiler with COFF ABI |
| CODEGEN-63 | DWARF does not correctly represent variables stored in register pairs |
| CODEGEN-62 | pow(2,x) has fairly significant rounding error |
| CODEGEN-60 | printf gives wrong value for pointer when its value is incremented |
| CODEGEN-56 | Forward reference in .space generates an internal error |
| CODEGEN-30 | Compilers on PC will not work without TMP set |