Specifying Jump Table Location

By default the CodeWarrior compiler and linker allocate jump tables for switch statements in RAM. When the application executes from ROM, it is sometimes better to have the switch table allocated in ROM to reduce RAM requirements.

To tell the compiler and linker to place jump tables in an object code section that will be placed in ROM, use this directive in your C or C++ source code:

#pragma read_only_switch_tables on
  

Alternately, to tell the compiler to generate a branch tree in executable code instead of a jump table in a data section, use this directive in C or C++:

#pragma switch_tables off