I have a 8051 project which includes ROM and XRAM, both are used as code memory The memory address and range is as follows
CODE Space Main CODE at RAM C:0x0000 ~ C:0x2FFF Lib CODE at ROM C:0x3000 ~ C:0x3FFF XDATA Space XDATA RAM at X:0x0000 ~ X:0x0FFF
I want to build a library code by Keil C51, and put the library code in fixed ROM memory, so the code in RAM is able to call the library routine in the existing ROM. For example:
main.c in CODE RAM (C:0x0000 ~ C:0x2FFF)
main() { int x, y, z; x = 1; y = 2; z = Add(x, y); }
lib.c in CODE ROM (C:0x3000 ~ C:0x3FFF)
int Add(int x, int y) { int z; z = x + y; return z; } int Sub(int x, int y) { int z; z = x - y; return z; }
My question is: 1. Is there easy way to tell Keil C51 where to call library code at (C:0x3000 ~ C:0x3FFF) ? If a lot of routines in library.
2. Is it possible to call library function with arguments ?
3. Can library routine use local variables ?
Thanks for your response