We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi: I wish to call function "pow" (which is standard function in library) from my assembly code. How can I do it? Thanks!
and read the section in the Manual titled - wait for it - "Interfacing 'C' and Assembler" A bit cryptic, I know, but...
Hi, Thanks for your responses! Now I can call C library functions(pow()) from my assembly code. But another issue occurs. I need keep the code size under 32k and I have about 11k free space availiable. The linker ignored my free space and always put library function on higher address space(beyond 32k - >0x8000). Why does this happend? How can I tell linker to put library code right after my assembly code? Any comments are appreciated! Thank you!
You must unlimited Keil C51, PK51 ...
Hi, Now, I finally found the solution. I save all data in internal ram(128 bytes),PSW and SP to external ram before I call C code. And copy back the data from extern ram to internal ram after finish C call, the code works very well. Not sure what the problem it is. Stack or something is changed in internal ram after calling C code? But, this code only works if I located it to space from 0x0000 to 0x7fff(32k). If I relocated this code to space from 0x8000 to 0xffff, it will "reboot" everytime I call C code. Does C code need space between 0x0000 to 0x8000? Thank you! Any comments will be appreciated!
Sounds to me like you have too little stack space allocated. Michael Karas