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

how to easily locate constant in bank easily?

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