This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Banking troubles

Hi,
I have an Infineon C515C with a PSD854F2 (configurable Flash+PLD from ST).

My banked software runs without a problem using Mode 1, banking register at xdata 02E0h.

However, for IAP (In-Application-Programming) I need the two MSB of the banking register as chip select qualifiers for my external program memory because I want to jump from a bootloader to my main application OR remain in the bootloader and re-program the main flash.

This should be possible by using the modified L51_Bank.A51 described in Keil APNT_130, but whenever the address decoding relies on the correct setting of the mentioned MSBs, my software crashes.

Using the uVision debugger, I think I have found the cause of the problem:
Startup.A51 is correctly executed until

LJMP    ?C_START


The code that is being run between this point and the first C-Code resets my banking register (all bits!)to zero which leads to my software crashing.
This code portion seems to be part of the Keil runtime environment. I have found similar code in Init.A51:

XLoop:          CLR     A
                MOVC    A,@A+DPTR
                INC     DPTR
                XCH     A,R0
                XCH     A,DPL
                XCH     A,R0
                XCH     A,R2
                XCH     A,DPH
                XCH     A,R2
$IF (DS390)
                MOV     DPX,#BYTE0 (?C?XDATASEG)
$ENDIF
                MOVX    @DPTR,A

The last line overwrites xdata at 0x2E0.

My XDATALEN is zero. Init.A51 is not part of my project. This happens even (in the debugger) if I remove everything dealing with the register at 0x2E0. I use C51 V8.05a.

If 0x2E0 is not in the xdata memory map, why does the runtime environment write to it?
Any solutions to this problem?
Regards, Ralph

Parents Reply Children
No data