ARM Technical Support Knowledge Articles

CONST VARIABLE BANKING WITH SILABS C8051F12X DEVICES

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

Can I use code banking and constant variable banking on Silicon Laboratories (former Cygnal)C80C51F120, C80C51F121, C80C51F122, and C80C51F123 devices?

ANSWER

Yes. You may easily configure the Keil C51 tools to use code banking and constant banking on these SiLabs devices. Additionally, the Keil µVision2 Debugger fully simulates code banking with these parts.

To begin, configure the L51_BANK.A51 file for Banking Mode 4.

It is important that the field IFBANK and COBANK have the same value, so, the SWITCH Macros should be set as follows:

SWITCH0         MACRO            ; Switch to Memory Bank #0
                MOV     PSBANK,#00H
                ENDM
;
SWITCH1         MACRO            ; Switch to Memory Bank #1
                MOV     PSBANK,#11H
                ENDM
;
SWITCH2         MACRO            ; Switch to Memory Bank #2
                MOV     PSBANK,#22H
                ENDM
;
SWITCH3         MACRO            ; Switch to Memory Bank #3
                MOV     PSBANK,#33H
                ENDM

Next, the startup code (STARTUP.A51) must be modified to call the ?B_SWITCH1 function.

; This code is required if you use L51_BANK.A51 with Banking Mode 4
 EXTRN CODE (?B_SWITCH1)
;               CALL    ?B_SWITCH1      ; init bank mechanism to code bank 1

Basically the SiLabs Banking mechanism is identical to the example hardware documented in the Code Banking section of the BL51 User's Guide. No code may be assigned to bank 0 since this hardware decoding is used for the common area.

With the extended LX51 Linker/Locater that is available in the PK51 Professional Developers Kit you can locate constants in code banks using the far const memory support. For more information take a look at the example in KEILC51EXAMPLESFarMemory1MB Constants on Classic 8051.

When using the LX51 Linker/Locater you can directly generate the HEX file image using the LX51: GENERATING HEX FILES FOR BANKED APPLICATIONS directive.

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-18 18:22:29

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential