because projects need, i have to import ?C?LIB_CODE twice.(One LIB_CODE start at 0xF80000, another start at 0xFD0000). The usr code call function in LIB_CODE which is in 0xF80000, sys code call functions in LIB_CODE which is in 0xFD0000. For the needs , how can i do that, please help.....
add
1. how can i locate ?C?LIB_CODE , one is start with 0xF80000, anther start with 0xFD0000 2. how can i specify the user code(code in 0xF80000 - 0xFCFFFF) call LIB_CODE in 0xF80000, sys code(code in 0xFD0000 - 0xFFFFFF) call LIB_CODE in 0xFD0000
Please explain why you feel you have to do that?
www.catb.org/.../smart-questions.html
Also, are you really using C251?
1.the reason is very complicated, hardware restriction ,project needs and ....... 2.it's MCS251 Expected your reply, thank you
Don't expect too much. We did expect an explanation about your perceived need to locate the same code in multiple locations and didn't get our expectations fulfilled. With our expectations broken, we did not see any good reason to spend more time with this thread.
I guess you either try to have two applications in the flash, for some dual-boot reasons. Or that you are trying to implement some form of code banking. But the thing is - I shouldn't have to guess.
I have to import two same lib. Because the user code can't call the sys code except use "trap". User code and sys code both call LIB_Code, so we need to locate LIB_CODE in both two area to avoid simple directive use "trap" for example 32bit mul or div. I don't know the Explanation is clear?
You will not be able to get the compiler to sometimes produce calls to a function stored at address 1, and sometimes call a function stored at address 2.
If you want the sys code to be completely separate from the main code, then you should restructure your projects so you create two separate binaries - with separate load addresses etc. Then merge the binaries when programming the chip.
I haven't worked with any 251 chip - but has that processor really two completely separate code spaces for system code and user code? Because if it doesn't, then system code can call a specific function, and the normal code can call the same function - all without any special things needed.
It's only if the function does something that requires system mode that the user-mode code can't call the function - at all - but have to make use of some form of call gate to get the processor into system mode.
we apply mmu to 251 core mmu will check the code addr with some rules, if it is illegal, mmu will refuse. thank you