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.
I hava a need to fix one C file's local variables to some settled address in DATA area, how to do it, thanks very much.
Keil will do overlay analysis and maybe the local variables of the schedule() function and app.c file are using the same ram space
No, they won't.
how can I know the local var's address of schedule() function?
You can't, but that's OK, since you don't need to known them.
the app.c can reuse the ram that allocated by schedule()?
If that's possible, the overlay analysis will find out all by itself. That's what it's there for.
You really ought to stop fighting the tools all the way. You're making your life miserable without any good need.
The OVERLAY linker directive allows you to edit the call tree to suit yourself. Of course, you'd better understand exactly what you're doing when using it!
I don't understand the reference to declaring schedule() reentrant. From the code shown, it's only called in one context anyway. ("schedule" hints that you're doing task switching, but I didn't see anything directly pointing out that there are preemptive tasks here. So, there's only two contexts/call trees: from main(), and from the ISR.)
You mention a few other functions and C files. I assume these are all routines called by schedule(). They will all overlay each other; none of them will overlay with the ISR tree. schedule() cannot share its local variables with a function that schedule() calls; that's two different levels of the same call tree. (If you really don't need schedule's locals after you call some sub-task, then you can move the work done in schedule to another subroutine, which will overlay the other tasks.)
If you're really sure the ISR cannot occur at the same time as other routines -- because, for instance, you mask the interrupts to prevent it -- then you might use the OVERLAY directive to overlay the ISR and main task memory. Note that the compiler will trust you, though, and if you slip on the mutual exclusion, you'll get weird bugs as your memory gets corrupted.