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 deal with API routine's local variable

I will provide API in my ROM,and the API will be called by custmer's program,custmer's program is stored in flash memory.
but as you know,the API routines will use some RAM ,and custmer's program may also use it.
for example:
I provide a FUNC
unsigned int dataWrite(unsigned int addr,unsigned int len,unsigned char *srcPtr)
{
.....
}
when i build it ,the RAM 0x34,0x35,0x36 was used by the function.

and the custmer's program have a FUNC dataTest(),it call dataWrite,and also use RAM 0x34,0x35,0x36 ,then after return from function dataWrite,the RAM had been changed.

can i avoid it by linker's or complier's configuration?
the only way i know is to arrange diffrent RAM memory for ROM's project and flash's project.
by the way,my target is 8051 system,and C51 language is used.the API must build in ROM,and i can provide my API source code to my customer if needed.

0