Safety-certified tools Tools for Automotive Applications C-STAT Static analysis C-RUN Runtime analysis Debugging and trace probes IAR Visual State
IAR C/C++ Compiler for 8051 only supports banking of code generated from C source, i.e. segment CODE and bank switching will only be done when calling C functions, not at data accesses. However, if you're confident in the tools and feel you can manage it, you can see to that no bank switching is necessary when accessing data. That is done by putting the code and the constant data it accesses in the same bank.
Follow these steps:
The : is used to switch bank, see the IAR Linker and Library Tools Reference Guide. Of course, several pairs of CONSTn, CODEn may fit in the same bank but you have to check the map file to see that there's space enough in the bank and that you efficiently make use of the banks.
This Technical Note was written in 2005, at the time when IAR Embedded Workbench for 8051 version 7.20 was released. Some of the implementation details above may have changed since then.
All product names are trademarks or registered trademarks of their respective owners.