Hi folk I am developing a huge application of 64K * 4 using 4 banks on Keil 7.01 Consider the following scenerio: I have over 20 modules (over 20 c source files) in each of the banks. And in each module, I use quite a bit of constant data, for example, in bank1: void test1(void) { unsigned char code array[] + { 1, 2, 3} ; doThis() ; .... } and test2() in other module of the same bank, so on and so forth. Now the constant arrays will be linked into common bank but not in bank1. As you can see, the constant array has local function scope, and no way it can be accessed for outside the function, and surely it can be located in bank1 by default, but this is not the case. I understand that I can use linker to specify location such that bank1(?CO?test1,(0xc000),?CO?test2,...). For the 20 odd modules, it seems that is not the nice way to do. Also for the linker, can I just specific to locate the constant arrays starting to the end of the common bank, and how to do it. I understand that I can found out the length of common bank and then specifies the starting address of the constant, but as commonbank grows and shrinks, you do not expect one to keep on monitor its length and adjusted manually. It would be best if my wish can be done automatically. That is function scope constant should be linked to the relevent bank instead of common bank. Rgds Calvin
"I am developing a huge application of 64K * 4 using 4 banks ... I have over 20 modules (over 20 c source files) in each of the banks. And in each module, I use quite a bit of constant data..." Have you stopped to consider the fundamental question here: Is the application really suited to an 8051? Is the effort of trying to force this huge application onto a classic 8051 really worth the effort? Would the effort be better spent in moving to a more appropriate processor - maybe one of the 8051 derivates with >64K addressing (as Erik has already mentioned), or an ARM, or something completely different?
I use Cygnal C8051F124 with 128K flash memory (4 banks*32K). It is enough for the application. And other processor's features agree to the task. So I can't understand what for there is so much memory space if I can't use it?! It seems that I can use only 64K of code memory (linker creates the gaps in parallel with the constant data).
"So I can't understand what for there is so much memory space if I can't use it?!" One reason may be to support In-Application software updates - where you need space to save a whole download so that you don't trash the old code before you know for sure that the download has worked...!! (dunno if this applies to the C8051F124 specifically)