Tips & Tricks
This page contains TriCore compiler tips & tricks from our customer support staff.
- Show help on tool errors
- Template expansion for C/C++
- How can I minimize the impact of turning off a particular optimization?
- After stepping into a function while debugging, how can I return quickly?
- Is there a way to handle repeated actions within CrossView Pro?
Show help on tool errors
Show Help on Tool Errors is a feature that allows you to get more details/information about errors/warnings that are encountered during the build process.
To use this feature go to the menu 'Help | Show Help on Tool Errors...', a new Errors/Warnings window will pop up. Now double click on the error/warning within the 'Build' tab of the 'Output' window. Within the new window, a detailed description of the error/warning will appear, often accompanied with clarifying examples.
Template expansion for C/C++
Template expansion is available for C and C++ sources from version v1.5r1 or newer of the TriCore Toolchain. Template expansions are useful for taking the drudgery out of repetitive editing tasks. They are designed to insert frequently used text into files at the press of a button, or to automatically expand common statements used in programming languages when appropriate abbreviations are typed.
To activate template expansion, go to Customize | Language | Tab "Templates" and tick the option Template expansion.
The expansions are activate by the space bar, for example:
Typing #d followed by pressing the space bar will cause an expansion to #define
How can I minimize the impact of turning off a particular optimization?
Enabling and disabling optimizations for the complete project or one of its modules can have significant consequences. With the #pragma optimize instructions you are able to selectively enable/disable specific optimizations at source level, and obtain more fine-tuned result.
#pragma optimize [flags] Controls the amount of optimization. The remainder of the source line is scanned for option characters, which are processed like the flags of the -O command line option.
#pragma optimize restore End a region that was optimized with a #pragma optimize. The pragma optimize restore restores the situation as it was before the corresponding pragma optimize. #pragma optimize/optimize restore pairs can be nested.
In this example, the peephole optimization is turned off for the code that's between the #pragma optimize instructions.
After stepping into a function while debugging, how can I return quickly?
If you (accidentally) step into a function, you can return to the higher level by selecting the Run | Return from Function menu item.
Is there a way to handle repeated actions within CrossView Pro?
CrossView Pro fully supports macros. A macro is a user-created shorthand for any sequence of CrossView Pro or C commands and expressions. Macros can be used anywhere a CrossView Pro or C expression is valid. CrossView Pro also allows you to save macro definitions, so they are always available. By passing parameters to a macro, you can create powerful and flexible methods to debug your code more efficiently. To control the macros, go to Tools | Macro Definitions. Here you can define new macros, edit your existing macros and save them in a file.
There is also a feature to connect macros to a graphical toolbox. You can have this toolbox visible as a CrossView Pro window and use it to execute a macro by clicking a button.