??? 02/23/11 20:26 Modified: 02/23/11 20:29 Read: times |
#181271 - linker magic Responding to: ???'s previous message |
Andy Peters said:
Neil Kurzman said:
Why not make the Bootloader a separate program.
But I agree the Bootloader should not erase itself. A separate program is ideal. I just don't know how to locate it starting at 0x8000, This is toolchain-dependent, and often boils down to linker magic. As I said, I don't Keil, but I'd start with reading the fine manual... ;-) Andy Peters said: The traditional way is to cast a constant (the address) to a function pointer and then invoke it.[...] nor how to jump to it, at least from within a C program. typedef void (* function_ptr)(); int main(void) { ((function_ptr)0x8000)(); } Less common methods would be to write a dummy function and move it to the given position again using linker magic and then removing it from the resulting hex by post-processing; defining a symbol at a required address using linker magic (together with writing a C prototype for it) (*); and the simplest: using inline assembler. JW [EDIT] Keil's linker does not appear to support custom symbol creation, making (*) unusable |
Topic | Author | Date |
Odd use of code banking | 01/01/70 00:00 | |
I don't know about Keil's... | 01/01/70 00:00 | |
Seperate Program? | 01/01/70 00:00 | |
separate program | 01/01/70 00:00 | |
Often special lock bits for boot regions | 01/01/70 00:00 | |
linker magic | 01/01/70 00:00 | |
RTFM | 01/01/70 00:00 | |
You are not good to go | 01/01/70 00:00 | |
updater and libraries | 01/01/70 00:00 | |
which is why | 01/01/70 00:00 | |
Please Reconsider | 01/01/70 00:00 | |
the golden rule | 01/01/70 00:00 | |
re: Reconsider | 01/01/70 00:00 | |
If needed... | 01/01/70 00:00 |