My question is if it is possible, using MDK ARM Keil IDE, to define exact start location for every source code file ? I know I can define per variable location, as well as per function location, but it can be big job if I want all the vars and functions in some source code file to start from some address.
Thanks
You can use the Scatter File to direct data from specific object files (ie MAIN.O) to specific regions.
If you want to group things together, use a structure.
Hello Marko,
Why would you need to define the exact start of every source file? Often there are only a few source files that must be placed in a particular location.
The more you force the location of files, the less flexibility the linker has in placing code.
You can read about scatterfiles here:
www.keil.com/.../armlink_pge1362075656353.htm
By default Keil creates a scatterfile for you (the .sct file extension in your project folder). If recommend you edit this file rather than making one from scratch.
http://www.keil.com/support/man/docs/uv4/uv4_dg_adsld.htm http://www.keil.com/support/docs/3629.htm http://www.keil.com/support/docs/3237.htm
Be careful when making a scatterfile that you don't fill up a particular execution region:
http://www.keil.com/support/docs/3701.htm
Although I don't need exact location for every file in most cases, one specific case came upon my mind. It was about some kind of bootloader which would occupy lower addresses and user program some distinct (higher) space. Of course locations could be reversed, but obviously distinct. And I am aware of interrupt vector table problem as well as many other problems which I intend not to incorporate into this thread.
Regards