13.07.2015 Views

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>ARM</strong> <strong>User</strong> <strong>Guide</strong>How to overrule the default switch methodYou can overrule the compiler chosen switch method by using a pragma:#pragma linear_switch#pragma jump_switch#pragma binary_switch#pragma smart_switch#pragma tbb_switch#pragma tbh_switch#pragma no_tbh_switch<strong>for</strong>ce jump chain code<strong>for</strong>ce jump table code<strong>for</strong>ce binary search table codelet the compiler decide the switch method used<strong>for</strong>ce use of tbb instruction (uses a table of 8-bit jump offsets)<strong>for</strong>ce use of tbh instruction (uses a table of 16-bit jump offsets)same as smart_switch, but do not use tbh instructionUsing a pragma cannot overrule the restrictions as described earlier.The switch pragmas must be placed be<strong>for</strong>e the switch statement. Nested switch statements use thesame switch method, unless the nested switch is implemented in a separate function which is precededby a different switch pragma.Example:/* place pragma be<strong>for</strong>e function body */#pragma jump_switchvoid test(unsigned char val){ /* function containing the switch */switch (val){/* use jump table */}}1.10. Functions1.10.1. Calling ConventionParameter passingA lot of execution time of an application is spent transferring parameters between functions. The fastestparameter transport is via registers. There<strong>for</strong>e, function parameters are first passed via registers. If nomore registers are available <strong>for</strong> a parameter, the compiler pushes parameters on the stack.Registers available <strong>for</strong> parameter passing are r0, r1, r2 and r3.22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!