How do I configure the Silicon Labs IDE for code banking when using the Raisonance toolchain?
Answer
Complete the following steps to configure the Silicon Labs IDE for code banking using the Raisonance compiler and linker:
Copy 'L51_BANK.A51' and 'BNK_SWTC.MAC' from the appropriate Raisonance examples folder to your project folder. For the C8051F12x family, these files are located in 'C:RIDEEXAMPLES8051DERIVATIVESSILABSC8051F12X'.
Add 'L51_BANK.A51' to your project and to the project build.
Configure the LX51 linker by adding the BANKAREA directive. Select 'Project'->'Tool Chain Integration' from the menubar and select the 'Linker' tab. For the C8051F12x family, add 'BANKAREA(8000H,0FFFFH)' to the linker command line options.
Figure 1 - Raisonance Linker Command Line Options
Configure the project build definition to locate code modules in specific code banks. Select 'Project'->'Target Build Configuration' from the menubar, click the 'Customize' button, and select the 'Files to Link' tab. Select an object file from the 'Files to be linked:' list and choose the desired code bank from the 'Bank #' combobox. This will automatically add the BANK directive to the linker command line options. If you are using an older version of the IDE in which the 'Bank #' combobox is disabled, then manually add the BANK directive to the linker command line. For example to locate a source file 'Blinky.c' in BANK1, add 'BANK1{Blinky}' to the linker command line options. The common bank is the default bank. Therefore you don't need to manually locate modules in the common bank.
Figure 2 - Locating Code Modules
At this point, you should be able to build the project without errors. Correct any errors before continuing. For more information see the RC51 and LX51 documentation in the 'C:RIDEDOC' directory.
Raisonance will generate an absolute OMF file for each bank used in the project. The common bank OMF file will have no extension, and the BANK1, BANK2, and BANK3 OMF files will have the .X1, .X2, and .X3 extensions. An absolute OMF file containing all banks will have the .ALL extension.
Select 'Project'->'Target Build Configuration' and change the 'Absolute OMF file name' so that it uses the .ALL extension. This will allow easier downloading and debugging.
Verify that each code module is located in the correct code bank by opening the generated .M51 map file. Notice that the code memory is split into separate sections for each code bank.
Figure 3 - Example M51 Map File Using Common, Bank2, and Bank3
Code Banking Using the Raisonance Toolchain