Keil™, An ARM® Company

Technical Support

RTX51: BANK SWITCH MODE 1 CAUSES SPORADIC RUN-TIME ERRORS


Information in this article applies to:

  • RTX51 Full Version 5
  • RTX51 Full Version 7

SYMPTOM

A application that is using code banking in banking mode 1 or banking mode 4 might cause sporadic problems with RTX51 Full when the system interrupt is triggered within the bank switching code.

CAUSE

The RTXCONF.A51 file contains a restore bank function that compares the current bank with the new bank. Since the bank switching code of banking mode 1 and mode 4 no longer disables the interrupt system, a potential run-time error might cause crashes of the application. This occurs when the RTX51 system interrupt is called exactly on the update of the B_CURRENTBANK value but before external hardware I/O lines are updated.

RESOLUTION

Change the code for ?RTX_SWITCHBANK in the file RTXCONF.A51 to:

            ?RTX_SWITCHBANK:
EXTRN CODE (?B_RESTORE_BANK)
JMP  ?B_RESTORE_BANK   ; new entry in L51_BANK that restores an old bank
;; -- the old code is no longer required
;;                         ; Check if bank switching required
;;                         CJNE A, ?B_CURRENTBANK, SWITCH
;;                         RET
;;                         ; Extract the Banknumber
;;SWITCH:                  ANL  A, #?B_MASK
;;                         MOV  B, #?B_FACTOR
;;                         DIV  AB
;;                         MOV  R7, A
;;                         JMP  _SWITCHBANK    ; Switchbank-Routine in L51_BANK

STATUS

The problem only exists in combination with L51_BANK.A51 configuration file version 2 and will be solved in future RTX51 revisions.

If you are using the L51_BANK.A51 Version 1.4 (which was part of the C51 Version 5) the run-time error does not occur, since this code disables the interrupt system during bank switching.

MORE INFORMATION

  • Ax51 User's Guide, Chapter 9, Code Banking

SEE ALSO

Last Reviewed: Tuesday, September 14, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure