How to write function at particular memory location in flash memory? Is there any directive for that? Do i need particular linker?
相关问题
- Direct2D Only Partially Linking in C++ Builder
- What are the recommended GNU linker options to spe
- What is the right order of linker flags in gcc?
- Not sure how to export Objective-C classes. Undefi
- Relation between MSVC Compiler & linker option for
相关文章
- MPI and D: Linker Options
- How to print unsigned char as 2-digit hex value in
- Weakly link static library via -weak_library
- Linker Trouble: How to determine where a “/DEFAULT
- static const in c++ class: undefined reference
- Linking in several C object files that contain fun
- ws2_32.lib vs. libws2_32.a, what's the differe
- ld linking error while compiling z3
Use ORG directive.
For example, for a function to start at location 2000H
If you are using keil ide you can place a function at a specific address using .ARM.__at_address as the section name. To place the function add at 0x20000, specify:
Do you use the keil toolchain?
If yes, perhaps http://www.keil.com/support/docs/359.htm helps.
Edit: The .obj file is generated by the compiler. I am not sure what you mean with 'how can i configure .obj file'.
The linker mentioned above takes the obj files, links them together and places code and variables.
You should start with a project which compiles and links without errors. Then you have:
- Some c files. One of them with your function.
- A linkfile with the settings for the linker.
- A makefile or some kind of batchfile which calls compiler and linker with the necessary arguments.
If you have that, you can look into the m51 file for the name of the symbol for your function. The m51 file is a textfile generated by the lx51 linker with interesting information about which symbols are there and what the linker has done with them.
The keil documentation for the linker I mentioned says: The compiler creates a symbol name for the function using the following format: ?PR?function_name?file_name.
This means: You will find the names of all functions of your project in the m51 file. If your function is in file file_x and named func_x. The symbol name will be PR?func_x?file_x
In http://www.keil.com/support/man/docs/lx51/lx51_segments.htm you can find some information about the usage of the SEGMENTS directive of the lx51 linker. According to that:
should place your function to address 0x1234 in code memory.
Actually I have no keil toolchain. Therefore I cannot test all that myself. But I am sure that you can manage that yourself if you start with a simple working example, change things step by step and check what happens.
Good Luck.
Helmut