Tool/software: TI C/C++ Compiler
Hello everyone
TL:DR: new compiler with highest optimizations generates much larger asm-code than the old one.
My question is related to the size of code, that is produced by two different compilers. We have a really large project for TMS320F2812 MCU. This project is being developed for some years by this moment, growing larger and larger, it was migrated from CCS3.3 to CCSv5 and so on. This project utilizes about 95% of available memory of the MCU.
The problem is, that this project is built with C/C++ Compiler v6.2.0. I've discovered on this forum, that it's strongly recommended not to use that, so I decided to build it with v17.3.0 STS. But the build failed due to increased code size. I've tried to change Optimization levels, and set maximum optimization with the highest priority for code size - it doesn't help. Unfortunately, I'm not familiar with the assembler language, so I cannot perform a good analysis of the generated code.
I've compared .map-files and chose an .obj-file which had difference in code size. I've compiled it with different optimization levels. But it seems that non-optimized code of 6.2.0 is still smaller than the high-optimized code of 17.3.0.
Here are some line of the source code, and generated ASM-files. Could someone please check these files? Maybe i should turn some additional options on? I am also providing compiler call for this files.
Source code for the screenshot function:
void dlog_background_analizer(TDataLog *p) { p->trig_shift_int = (p->trig_shift&0xFFFFFF)>>16; if (p->trig_shift_int > 255) p->trig_shift_int = 255; TCo_OdVars *pco_vars = &co1_vars; unsigned char mode; if (!(p->control & 0x3F)) return; p->mode_reset = 0; p->valid_points_num = 0; if (p->control & 1) if (!(p->dlog_iptr1 = (type_data*) co_getAddr(pco_vars, p->ind_subind1))) p->dlog_iptr1 = (type_data*) &p->ind_subind1; if (p->control & 2) if (!(p->dlog_iptr2 = (type_data*) co_getAddr(pco_vars, p->ind_subind2))) p->dlog_iptr2 = (type_data*) &p->ind_subind2; if (p->control & 4) if (!(p->dlog_iptr3 = (type_data*) co_getAddr(pco_vars, p->ind_subind3))) p->dlog_iptr3 = (type_data*) &p->ind_subind3; if (p->control & 8) if (!(p->dlog_iptr4 = (type_data*) co_getAddr(pco_vars, p->ind_subind4))) p->dlog_iptr4 = (type_data*) &p->ind_subind4; p->WriteDelimiter = (p->control >> 16) & 0xFF; mode = (p->control >> 4) & 3; p->control = 0; dlog_set_mode(mode, p); }