??? 11/07/07 14:24 Read: times |
#146731 - There may be a way out after all ... Responding to: ???'s previous message |
The regular toolchains from any vendor may not allow you to do this natively.
This is how it was done in the days of DOS/CPM based systems with limited memory. You have the basic OS structure with fixed entry points(hooks) to various functions that your applications may need to access/handle the peripherals. This will be a fixed table of fixed hooks(pointers to functions who are placed at fixed addresses). The application would then call these hooks at run time; of course, since they are at fixed addresses, it does not matter to the linker building the application. Examine this Your core driver (permanently resident) has these functions 0000 - pointer to LCD function(void) 0002 - pointer to Keyboard function(void) ... ... 000x - pointer to some other function(void) LCD_function: Kbd_function: Other_function: The application works something like this. You may need to pass parameters in a set of global registers to / from the functions since the functions will be void of parameters and return values. I am not 100% sure of the syntax shown below, but I use it as a guide to illustrate what I am saying. #define LCD_Hook (*(code *)0000) #define KBD_Hook (*(code *)0002) main() { LCD_Hook; // call the lcd routine while (1) { Kbd_Hook; // call the keyboard scanner } } I have given a divergent view, but I do hope it will be helpful. Jerson |