The Cygnal f12x has 128k of flash and using code banking defeats the purpose of using Cygnal. The overhead of banking slows the program down as much as using the Cygnal speed it up. Thus: Is there a way in Keil to make all movc a,@a+dptr generated by the compiler/written in assembler access the upper 64k WITHOUT using bankswitching. The Cygnal chip has simple means of data bank select. in advance thanks, Erik
The overhead of banking slows the program down as much as using the Cygnal speed it up. Code banking only slows down calls to functions when a bank switch must occur. And, you, as the developer, are 100% in control of where those functions reside. Also, only the CALL and RETURN instructions (for functions where a bank switch is required) are slowed and that's only by a very few instructions. The following knowledgebase article describes a little of how the code banking mechanism works. The examples demonstrate what happens for various types of bank switches. http://www.keil.com/support/docs/1059.htm The following article discusses how to create code banking programs in general. Pay special attention to the Program Organization section. It shows you how to design programs to reduce the number of bank switches that happen. http://www.keil.com/support/docs/158.htm The following knowledgebase article explains just what to do to use Code Banking with the Cygnal devices. http://www.keil.com/support/docs/2441.htm Jon
Code banking ... I have neither need nor no desire for CODE banking, I just want constant data to reside an upper 64k and load with NO overhead. Erik
Well, it's going to be pretty hard to get a full 64K of constants. The reason is that whenever a MOVC executes to READ the constant, it's going to have to do so from that extra code memory. So, before the MOVC, you're going to need instruction(s) to switch the code memory around. And, you'll need to switch it back when you're done. If you want the compiler to do all of this for you, you'll need to use the XBANKING.A51 file to configure memory banking. And, you'll have to figure out the architecture of your system. If you want to do this manually, you'll have to write some kind of routine to read const strings from the additional code space. This may be the way best suited to your application. Jon
So, before the MOVC, you're going to need instruction(s) to switch the code memory around. And, you'll need to switch it back when you're done. No, the Cygnal F12x have SFR bits directing movc and other bits directing code fetch. I can live with getting only 32k for this. OK let me rephrase. In hardware I can specify that movc goes to 64-96k by setting a SFR. Will the software (specifically Keil "hidden functions") burp if I set those bits at the beginning of startup.a51. Can I tell the compiler to forget about banking, and let the linker locate constants in 64-96k Erik
You can do it only with CX51 and LX51 using far variable modifier and then by telling the linker where the constants are - howewer, compiler will generate a call to far variable handler (which you have to provide) for every access to far variables...some kind of bank switching anyway :( - Dejan
"Can I tell the compiler to forget about banking, and let the linker locate constants in 64-96k" Yes, that sounds exactly the same as what I'm doing with the Triscend (only the SFR names have been changed...) This does require LX51, but not CX51, and not any 'far' modifiers.
View all questions in Keil forum