 గా గా రా బని పిపనూచు ఆపి నంచి సింలీం నా సిస్లు. మానూచు పుమా కిసికు. మానూచి వకిసా కి సిసినర్డి. పిటిక్చాచి సామా. మిక్డట్క మి and then how the return value the return result or whatever comes out of the function is passed back to the call function and how the stack frame is used for creating space for local variables as well as the argument which are passed into the function using the frame pointer. So, in this lecture now what we are going to cover and see a little bit more about the linker ok. Why I am taking linker so specifically is that that is where you may have to take based on the memory map of the target hardware ok. So, how to place a particular software is you know what will develop for a hardware. So, what I think you need to be aware of. So, it is a bit loss subject you know it will not be possible to cover them all in this you know lectures, but my intent is to give you enough introduction and the features that you need to be aware of. So, that you will be able to read the documentation that comes along with the tools and develop an environment and you will be able to develop the software for the system that you are building which are ARM based which are the systems which are ARM based. So, once you are aware that these are the things you need to be cautious about and where to look forward what kind of information then it will be easier for you to develop any software a system you can build using the ARM based ARM based system ok. So, having understood about what is inside the processor now we are this is spending some time on the tools and and what needs to be taken care of by considering the tools. So, since we are now trying to look at in the this tool lectures and then we will again go back to some hardware related for peripherals and other busses in the performance couple of lectures and then I will conclude it with a you know giving some details about you know various families of ARM processors and which are the advanced features that are being supported in them ok. So, this is the topic of discussion today and taking up all the things which are required for you to be a successful developer of software or a solution which are ARM based ok. So, let us see what are the things you need to be considered in a careful about understand deeper compilation tool behaviors ok and target environment ok. These are sometimes the compiler itself assumes something because if you do not give anything specific to the hardware details then compiler cannot expect you to give that. So, it will assume something and then proceed with some output. So, that is what happens when you do not give any information for the tool. This may not be compilation or compiler or any any other tool. So, there are steps involved to move from a deep depth or development build to a fully standalone production version of an application. So, what we mean by that is normally when we are developing any application or software using any you know software based solution we have a system ok target system ok both. So, any software that needs to be running on this first of all needs to be developed in debug make sure that it is working fine then only it should be ported onto the actual hardware. Suppose you say there is a no setup box which is ARM based ok there are buttons here and then there is a hardware inside ok which is ARM based solution ok. Now, so we will not be developing software on this system right away we may have a development mode which is given to the developer software developer which is similar to the target end hardware production hardware. So, the solution whatever the setup of software is developed is run on this first on this development mode which is connected to a PC development platform right know and then it is connected to a data or no failure any other interface that are there and then download the software verify it debug it run a debugger on this and then make sure that everything is working fine. So, this whole thing may be you may be switching the core also to output some values or write into some file or into memory you know if you may be if the actual software is there and then you may be tweaking this hardware to introduce some debug points ok may be put some print as and then make sure that the complete control tool is working and then the correctness is assured then we will be compiling and linking to the target platform. So, this could be a restricted memory you know or it may be a different layout also there. So, this software is to make sure that the debugger works fine this most of the time these two development platform and the end target hardware are not kept in the most of the same similar in terms of memory map or all those things. So, that you do not have to make too many changes to the software or the two configuration while loading the you know software into a end product because we do not want surprises at the end. So, you will do all the testing here and then put it to the system. So, actually minor changes will be there between the debug version and the development build. So, the development build is for a standalone running that means when it is running on setup of it is not going to be connected to another PC or developer is not going to be sitting by the setup of for it to work it should work in the customer screen as a without anybody or any developer by the side of it or any you know the PC or anything has connected to it. So, it is a standalone production version of the application. So, of course, initially debug is done and then standalone version will be generated. So, some changes to this C library functions is to be made to meet the target hardware ok, instead of C library environment resources. So, C library functions we will now use the target hardware feature or a lady use or whatever rather than the debug environment resources. It could be even the if suppose printer has to be put now there is no debug running on the screen. So, you cannot send it to a serial port or anything. So, it has to use all the hardware all the resources in the setup. So, that changes the C library also has to be modified ok. The tool chain has no inherent knowledge of memory map of any given concept. So, normally not normally always the tool chain is generated is developed for a generic hardware ok, generic memory map it could be anything. The tools can have been built for a particular memory map ok. The tools in the sense compiler, linker, assembler whatever tools you see they are all they can generate any output for any kind of memory map in this system. That means as long as it is within the 32 bit boundary you can map the you know output of any executor you know linker or any compiler. So, any memory map in the as per the choice in the target hardware. So, initially the tool chain does not have any inherent knowledge. We have to see the knowledge with the some configuration parameters. It means tailoring the image memory map to the memory layout of the target. So, we need to tailor the output of coming from the tools to meet the target hardware requirement. So, an embedded application must perform some initialization such as tag or heat initialization before the main application done. So, there is a requirement for initializing a stack as I told you some sometime back different modes of the stack pointers need to be initialized. So, those kind of generic initialization and then even the stack locations of different modes may be different for different kinds of a target. So, before the application starts there should be some initialization code which will be initializing the stack or the dynamic memory allocations be starting address those things need to be initialized. So, target hardware specific initialization routines are needed in addition to the arms the compiler library. So, some things are very C specific a language specific like initialize something and then call the main routine. So, that is calling the main routine is very language specific, but target specific initialization need to be done apart from the C compiler C language specific initialization. So, those library changes have to be done based on the hardware ok. These are the different considerations that you should be aware of when you are developing software ok. Let us see now what is the same question let me explain. Who is technical specification of the target hardware or memory map of the target system not available during software development? Still in a typical product like cycle ok, the target the hardware design ok may be made we might have taken a decision that we are using arm on SOC ok, but what are the kind of a memory which is going to be there and then what exactly the locations of the memory ok is mapped to which location of in the you know arm other states. Those things will be coming up during the both design time frame. So, both design happens sometimes you know later in the cycle whereas, hardware specification and the software requirements we can know initially we will say product requirement and then the specification is chosen and aligned with the customer ok and then the design starts. So, design for the hardware and software also starts in parallel because to keep up the time to market ok. Any any product hitting the market in a shorter time will be able to attract the customer's requirements and then it will it will be attract some software for the company that it makes in the product. So, there is a fierce competition so everybody wants to parallelize the development also. So, software development also happens in parallel with the hardware development in the sense may be the chip may be identified or may be it may be getting done in the by submitting to the company ok and they will be providing some the device there was another thing application software even much before the even chip is made. So, doing the software development the exact hardware specification or the memory specification where is that we are may be rough ideas will be there, but it will not be very big information won't be available. So, full technical specification of the target hardware memory map is not available. So, compilation tools have a default behavior. So, if you start with anyone that is your software just go with the default behavior and even the application using the debugger and development of environment that we have. And then semi costing is the mechanism that may be score running on an ARM target to communicate and use IO facilities on a post computer that is running on a debugger. So, the semi costing is it is not hosted fully on the hardware it is not a standalone application. So, suppose this is the hardware ok a board a chip is there inside to a debugger may be I call it as a PC ok. So, what of it is running here debugger is running in this PC and then the execution happens here, but there is a some piece of some software here also which is received to the debugger is there so that it can communicate back to the debugger running on the PC with some information. So, this is not exactly close no exactly a target hardware ok it is not a standalone hardware because it is thanks to a development platform a PC and a debugger is there and then we are interested you know interacting with the as a user we are interacting with the hardware and then getting the responses from there. So, it communicates using the IO facility of the debugger what do you mean by IO facility means suppose there is a LCD display here in the hardware ok LCD display they suppose to print some values here but to start with maybe while debugging is happening the output which is suppose to go to the monitor here may be coming to the debugger in the also because if the user is sitting here monitoring the output of what is happening here ok so the user will be checking the code here and output coming from from the debugger so they do not have the complete target hardware also so in the case IO facilities are used which are in the debugger ok so when when we are working in the debugger the debugger are in a substance program execution if we suspend the program running on there and then give a control to the debugger the debug agent then uses the debug capabilities the host and the debugger running on the host is having it is using that so for example, print the output to the debugger control so the software running on the target hardware is suspended and then control is given to the debugger and then you can say if you are doing a stepping to the software you will say that ok break point you will be putting and then it stops the execution and then gives the control back and then we will say that ok run then control goes back and then it starts running then till the next break point or step if you are single stepping then it will execute one instruction at the programming level C program is there then C program instruction level will be executing so it is actually controlled by the debugger as well as the user who is debugging the software in the using the pc so that is what is called semi coasting ok overview is this is the target hardware there is some piece of library code which is modified to communicate to the debugger ok debugger is on the host this will be a pc or live machine and then the output is put here not on the target hardware so this is the semi coasting work ok let us understanding of this is the software running and this is some debug agents sitting on the target hardware you know in stopping the execution and then communicating the debugger and then giving a control back all this things will be happening semi coast operations work when applications being developed are debugger on the developer so the application which is done ok so in the case C libraries which are actually having the input output error handling and the stack need setup and printer for writing to the disk profile all these things are in the C library they are also a little bit modified to say that it is connected to the debugger now ok so conceptually the C library can be divided into functions that are part of the ISO screen standard this is a completely C standard function that provides support to the C standard so these are all supporting functions so this is this library is now connected to the debugger and later on it will be only to the hardware so this that is what I said that C library needs to be changed when you want to run the software on the hardware so you know standalone mode when there is no debugger connected to the hardware you know you cannot expect a setup box at your users premises to be connected to a debugging environment so it is a standalone unit that time this library will be not the expecting that it is connected to some debugger so it will have it will be modifying it so that any error condition may be it may flash an LED to indicate that restart the setup box or it will restart itself no without you know user coming to know or no user may not know what to do so some error only condition it may do some error conditions it may send it to the restart or it may expect the user to do something such things will be done so the C library also will be modified for the standalone version of the software when it is being debugged the software which is setup of software which is being debugged during the development phase it will be modified to communicate with the debugging agent as well as the debugger sitting in the host so this is called semi-host okay as a target is as I told you the tools are ignorant of what the image is going to be and then we need to configure the tools to suit the particular you know target hardware configuration then there should be some awareness about the image how it is generated image in the sense the code output executable how is it generated by the tools and then what all the inputs need to be given to the tool okay tool in the sense it could be a linker or compiler or a loader whatever and then so that the executor will be generated properly so that it runs on the hardware even if you modify the hardware you change the input so that the output coming will be able to run on the hardware okay so let us understand the executable image so don't like better this is very very simple let us understand the flow see else I told you embedded and linking format this is the output executable format that when we have multiple obj files okay obj files are to be linked because linker gets multiple obj files to be linked to get an executable output executable so this is the flow as I told you as so each file or even between the file you may have different code functions so there will be separate sections of each of them this is a half separate part of the program program or code okay I call it as program or code or text whatever there are execution regions are combined into some multiple execution regions okay these are all execution regions different input files are combined and then form an execution region and they will all be in a different load region I will explain you what is the load and the execution region little while so this multiple know this execution region will be of different load region so they are put into the different segments okay these are all output segments coming from that basically the images generated in sections but this all combined multiple files are combined to form an executable when a big project are built it is not written in one single c file or single assembly file multiple c file may be multiple languages are also used some c input from c++ some c will be in written in assembly so this kind of multiple kinds of files will be there will not develop an executable so this kind of multiple things have to be combined so the linker to get a final image file so image file is the output may be I call it as a exe so the linker may also get file obj file of different source file or it may get some SO file some stat update file or some library file some library so this kind of different sources are there finally they form an executable so you know that there are multiple source files and library files combining into an executable so they all there is a fixed header and structure is there to give additional information to the tool where to keep these images in the final executable okay let us see some more and one thing may be you can remember it is a 2GB of program space can be there but may be the latest tool may have a different values which are the current performance to know exact value of it this is a program size now let me what is the image structure number of its constitution, region and output number of its the structure of the image is defined by the number of its constitution, regions and output as I tell you what is the region this is the output section and region so how many number of them are there those regions and sections then the image is loaded so what happens is in a typical hardware okay this I am showing the hardware language so that no one will understand this is the ARM processor there is a flash memory okay flash memory is there and then there is a ran chip so ran now what happens sometimes the flash will be having a code where it is loaded the image is loaded in this it could be this flash memory can be low you know map to some different address ranges okay some address range and then ran will be some other address range okay now this code may be copied from here to ran and then ran so the loaded area will be different from the execution region so it will be totally different physical location physical address because ARM has to access this to copy to another location so it has to bring it from this memory to the you know register and then maybe copy there or it has to you know program a DNA to do that but you know normally what happens is it is done by the processor to move the code from the flash to run so there is a possibility that the loaded location the memory where the image is loaded may not be the place where it is executed okay that we should know the memory of this region and section when the image is loaded and position number of this region and section when they image image is closed so they can be same they can be different so you should be aware of it each link state has a different view of the image so when you are linking you are creating a library file if its image will be different and when you are executed when you are generating for a particular hardware its view will be different because it will be looking at the image for what which hardware what is the memory map of the hardware based on that it will be generating the output so it in different view will be there for the different stages of the linking okay link and input the object file is coming from the compiler after the C source file or C plus source file is compiled and generated now OVJ file is generated so that is an input to the linker and L for object file can be relocatable file the place where the memory where the particular code has to be executed is not fixed it is relocatable you can move this code to any location and then you won't register you modify the address the starting address of the location then the rest of the code assumes based on that okay so relocatable code is not fixed to any particular region or any memory particular memory so that whole student data should be for linking of the other object file to create an executable file or shared object file so that is one output the output could be a relocatable file could be generating an executable file or a shared object file what is the difference between this executable file is the final image which can be now loaded into some hardware and run whereas the shared object file will not be running may be it will be loaded in some location may be but somebody else may use this library it is not an independent executable it is getting to be used by someone that is when the name implies it is shared object file mostly a library file will be given as a shared SO or .SO file which will be used by multiple processors they will be used by multiple people so the shared object file is not an executable address individually but it will be some other processors so an executable file holds the program suitable for execution a shared object file holds the code and data as a following context it is not like for the linker to process a file with other real executable and shared object to create another object so shared object file can be used with some other SO SO object file or link file to generate another executable another executable or may be another library so you can keep on building libraries SO or you can generate an executable address SO may be processing in any way it could process in any way an executable file so that will be an independent executable file that can run in the hardware SO this is all very high level overview I am giving so that you are aware of what all different things you will come across but even you are really developing software for a particular hardware on based hardware of course you will have to read more about these tools and options which are there ok my intent is not to give you complete information because it is very very difficult to give it in a short time now what are the shared object files an object file is if a definition found in the source file converted to the binary file and available for placing in your field program so all the OVF is what a .c file the compiler compiler OVF file ok so it is actually whatever is defined in the C file is converted into a set of assembly instructions converted into binary form and it is all captured in the OVF binary file it can be placed in the executable or it can be placed into a library does not matter so multiple opals are bundled together called a library when you are bundling multiple opals and then forming a library you can form you can form an executable or you can form a library that means it is not a final executable it has to be connected to another executable you know OVF has to form an executable and only it will be running for the library you will see a static collection of functions so you can create two libraries static or dynamic library what I mean by that means static library is typical you know in our world the entire library is embedded in the executable ok so static library is statically bound to the particular executable whereas in dynamic a shared library is assisted with S4 so that if we call dynamic library or static library or in DLL in those words so it is called . it is analogous to the static library but the shared library differs from a static library in one what is it it does not embedded in a final executable so when the dynamic library is linked the library stays alone separate and then executable is separate and only when a particular thing is required the library is linked around time so library may be may not be loaded in the main what happens the library may be in the static the static storage and then whenever a function is dynamically loaded into the main so effectively dynamic library do not occupy or increase the executable type so once executable type increases then the memory requirement of the executable in the main memory will need also increase so to avoid the dynamic library concepts are used wherever you want to reduce the image size but you have to remember that dynamic library takes more time for that to run so it does not embedded itself into a final executable and instead executable contains the reference that I will be and resolved during the run time so it is resolved at run time not even at the live time not at live time what I mean by run time when executable is running it will call a function which is in the shared object or shared library when the function is called wherever that function is defined in a library which is loaded into the memory and then the control goes there so based on the need the library is loaded into the memory suppose if the function is not called at all then why that library is not needed so effectively it saves the space required for the executable to run in the system okay now what are the load and execution through see you may be different that means the image where is it residing in the ROM may be at a different location especially the read write session is a actually data area as you see that read write is there so is a data area may okay it is sitting wrong because maybe initialize data some values are some six values are stored okay you may declare that constant you know variable pi variable pi and then immediately it is 3.14 so this value has to be preserved and kept in the code so it is those kind of values will be stored there and then it will be put into the RAM because sometimes you may be monitoring the values also the variable may be initialized but it may be modified so you may declare a global variable int add int count okay it is equal to 100 so what is the value 100 it has to be stored here and then afterwards you will be incrementing the code so in that case what happen it has to be in the read write area it cannot variable cannot be residing in the ROM area and then you can even increment you cannot do that so but you need to keep it in ROM area because this 100 will be lost because the program will not know whether you are initialized with the originally in the source file whether you are initialized with the 100 or 1000 part of the image so the data which is initialized with some specific value may reside in the data area and it is also part of the image okay this is both are image this is the code area we will read only this is code so this code can decide in the ROM and then you can execute but data area has to be copied but initially it will be in some location and then it will be copied to another location so the load image will be different from execution image in this section we may have static variables it needs to be initialized to 0 so to save space of the image the static variables or any variables which are initialized with 0 values they are not kept here but the information is kept somewhere in the image saying that this variables are in the occupying some location here and then needs to be initialized with all 0 so those variables will be positioned here and then they will be filled with 0 starting the application or execution these things are done so this particular area is copied there and then another area is created in the data section and then they are all initialized with 0 so that when the function starts executing these values are all in a proper places this is all where the execution images are supposed to be designed and they are all inside in the solicitation so that is what Inker has seen as an execution input so load view image region and section in terms of the address where it is located in the memory before execution and execution views describe the image and region image region where it is located during the image execution when its execution happens where this data area under each place area should be residing these addresses they should be copied okay so before passing the control to the application this who does it may be OS or some other loader or some other software which is coming in between to perform this job before giving the control to this so these are all already built into the string 0 so it has to be done before this control goes to the main function or whatever so this based on the these things are done prior to the execution so linker view the linker has two views as I said the address space of the program which becomes distinct in the presence of overlay okay let me position in the main or relocate of the program I told you that a program can be relocatable it can be put anywhere in the memory and it will be able to run okay program fragment should be code or data the fragment should be code or data the load address of the program fragment is a target address that the linker expression external agent such as a program loader or dynamic linker or debugger okay to load from that location to copy the fragment from L5 and might not be there so the job is to dismanage the address of the fragment executing so the loader load address is where the data or code area is returning as I told you earlier and then a loader or debugger or dynamic linker copies to some other location before executing so that is what is done by the that is the difference between load address and executer load address is where the code is repairing execution address is where the code is or data is supposed to be there when it is executed so let me see what is execution address as a program fragment is a target address where the linker express the fragment to reside when it participate in the execution of the program so why am I bringing linker because linker is the the tool which does this locating this variable or the or the code according to the load area or executable linker okay it is execution address can vary so the code we will look at the code or can be put anywhere and then we will be able to execute it what is the overlay and overlay is one of the two more two or more features of the code or data that can be loaded to pre-determined memory even on demand at the runtime see memory is very very premium in normal view as I showed you shared object is one example where the required code is brought into the location otherwise before it is running another example is the overlay that means this location okay some location in the memory is reserved for multiple obj okay it could be a obj or function so based on what function is being called okay that particular function is brought into the same location okay so all this obj is positioned to be located into the same location but not all images can be reserved so one example could be that suppose you know you are you want to generate image file okay from if a no video image or image file there may be different format for the video images so we may have a encoding mechanism for different format the functions can be the different files can be loaded okay then a.obj b.obj there is a different format but based on what obj output the user wants okay the video output format may be one of this things needs to be the code has to be put in this particular space and then the encoding has to be done so we do not need to bring all the encoders into this memory area because the input format is converted into one of the output format okay so based on the choice of the particular program while running it will bring the particular things to run so this kind of for one or two more pieces of the code can be kept in the same location so we are overlaying a a different function into the same area so initially each overlay is stored in ram or flash just like ordinary code data during the runtime and overlay can be copied to a known address in ram and executed there so different encoders may be lying in the ram but only one encoder will come to the ram and then it will get executed this time later it will replace the another overlay when that works okay only one overlay can occupy that space in the ram so you do not need to convert to multiple formats so this is the input format of course output format could be multiple but it will be one of the output format so once it is chosen that particular encoder is brought into the memory in the ram and then executed so only one will be lying at the memory at any time the compiler and linker provide no other special support for overlay so compiler and tools will not do overlays are not automatically copied to the runtime application so who decided the function which is running here this overlay function will be called because it will be specific to the application which application it only will know which loader which encoder has to be called based on that you will know which obj file needs to be copied into the ram so that is done by the executable or the application not the tool so overlay manager is a part of the program the programmer must write a code extra code for a overlay manager that requires you know copies are required to use at any one time the overlay manager will run through the application and will be called whenever overlay loading is needed so for instance the overlay manager may be called before every function is called which might be might require a different overlay segment to be loaded so based on which encoder is separate that will be called why am I saying this because you may come across this overlay manager you may have to use in your system because of the restriction in the ram see if the overlay is not there all the encoders have to be copied into the ram so it is a great change of space because you are going to only encode to one of the format so where do we have the images of all the encoders into the memory so it can be in a ROM or a flash and then because that is cheaper so you can bring only when it is required that particular encoder so that will be done if you have a which is running along with the application so you may have to use it in your system so better be aware what it means so that you will be able to use it whenever you are developing your own solution so it must be ensured that a correct overlay segment is loaded before calling any function in that function so before any function is executed a correct encoder has to be called otherwise there will be a run time instruction the same is true for data overlay also okay so with that we are completing something on the tool so let me look at the explanation memory map related thing so I will give you some higher level overview of each of this so that you understand how internally the tools are arranging the different segments or different type of the executables see code is here data is here and then this is 0 initialized okay I have mentioned it here so this is the normal order starting from the lower address the tool if you do not give any specific location for any of these images then it will automatically place them one after the other that means if suppose it takes 2 kilobyte of space after 2 kilobyte maybe this will be positioned it may take maybe 1 or 5 kilobyte okay normally data area is likely to be more than 4 acres so after that maybe each life 1 kilobyte of data area is in place so this will be put now what is the requirement of stack and heap that is again the programmer has to stay how much is required so it will automatically space so that the stack is always going downwards and then heap will be there when will the heap be used like ml of okay or new those look things will be getting the memory from this heap location and then whenever free or delete it is called they will be released back to the pool so some memory is got used by this function and then once they call free it goes back to the main pool so that is the heap location so it keeps on growing up based on the free and usage sequence and then the stack will be going down whenever a function call is nested you know how many nesting of function calls are there as that much of stack will be used as I shown you in the last session how stack gets grow whenever a function is called so it will go down like this and please make sure that they do not overlap with each other if it overlaps with each other there will be a stack limit 13 will be there as a part of the pool so that this kind of runtime problem do not occur or in the embedded system the stack limit 13 will be time consuming so there should be profiling should be done before the choice of a stack size and a heap size is done so that during runtime any part this will not overlap with each other you know it should not overwrite if it is on each other so if an image where a memory map has not to be displayed the linker places the code and data in this so linker decides this sequence now the image is linked to the load and the run address this will lead to the change see it defaulted may be this read only and zero initialized sections are there the heap follows directly from the top of this so this is the last question stack based location is provided by semi hosting operations the where the stack is starting that is decided after the stack starts going down now location of code and data see this is the read only it could be a code and data also data can be in read only it is possible you may define a constant data constant int pi is equal to pi is not going to be changing normally in any time you may declare some floating point constant and then initialize it as a constant so once you define a constant it will lie in a wrong area because that cannot be modified so those data area also can be in the it is a read only the region will have a read only access okay and then we have a data rewrite and then zero initialized data so how it is coming it is coming from this file whatever constants you define here whatever constants you have defined here in this file the file 2 and file dot the C file has been generated into O file and those constant values will be finding a place here and then the code area of this and code area of all this will be coming into this so A is this may be from some other file all the code area will be here constant data also different files will be there each file you may define some global variable or static variable so those variables are all collected together and perpetrated in own place and then you may be defining some functions in each of the files okay okay they all generate obj files okay so everywhere whatever code is there all the code is collected and kept in this all the data is collected and kept here and any initialized data is here and all the ammunicized data will be here so the collection of all of them is done by the linker okay from different obj files so it has to link all the group all the relevant information code and then all the data area all the global area or static variables they need to loop them all and then put it in a proper display so linker observes the setup rules to decide where in limit the code and data are updated okay they follow this sequence generally the linker starts the input section by attribute by name or position you know what are the file names may be you know in the increasing order this is the alphabetically this comes first code related belonging to this will be coming first and then the code belonging to the next file will be coming next so like this it will be ordering the code in the final memory because finally whatever functions you have defined they need to research somewhere in the location in the memory so how the linker decides is what and it will be there they fully control the placement of code and data a static loading mechanism is used if you want to say I want this particular code to be in this location it will be in this area I want you know this code in the file should be in another area in the memory then we have to use a static loading another file as an input they are even constituting so this is a typical example where you may say that one region one region it is starting from here and then it will have address you know the length is this much and then it is you know it is holding a all the or initialized data will be lead only so that of this particular file obj file needs to be kept in this address ok then what happens whatever you have written in program 1.p that code area code whatever functions that you have declared a function yes and then you have defined that that output file that obj file of that will be that function will be here static here in this case starting from 0 0 location so you can control it earlier what is shown was the tool defined where to place them but once you define such a you know a library definition and then give different region value name and then different files then it will group all of them according to the requirement that you have mentioned so the tool if this input file is not given then it will do its default mapping otherwise you will be able to control it where of this so that you know when you are developing a software for a particular audio solution you will be able to position the code wherever you want suppose you want to keep the ISR routine in the lower 0 0 0 0 to now 1000 whatever and then in the case what you want to do you want to say all the ISR routines are written in this particular function and then you say in this file it will be placed here then all the ISR routines will be residing in that particular menu very good so scatter loading the scripting file is shown above the region is defined by the header tag that contains the minimum name for the region and the short address then length can be another attribute okay maybe you can mention about this kind of a exercise also so accordingly the multiple regions of the pages wherever it is residing the page region will be the page access permissions will be defined the contents of the region depends on the type of the region so what type no.ro or rw we can define any of this type okay sorry okay now what are the type of simple images type on image this is just a different image can be there so rw this is the RAM okay and this is the lower view and this is the execution view while this is the view of the program when it is not executing and when it has to execute this has to be created who does it? it will be the lower data or the you have to write some code as a part of the library routine there is a values to all 0 and then give a control to the function then during the execution time this should also be there but during the load time when the image is kept in the wrong or and this may not be there this will not be there it is called a lower view three contiguous regions of execution this is the contiguous location another image is this will be in a separate location so they can be contiguous it can be contiguous it could be in a non-contiguous location that means this can be somewhere else suppose you do not have a memory in a contiguous space you do not map then this image can be created on more parts to be executed at a different location and it can be copied there before the execution starts but it could be kept in the wrong in a different locations different addresses in the hardware so ARM processor when it is wants to actually copy this section into this it has to access this first and then copy there so that will be done so that for that to do it should move this location it is mapped this after which after so the linker would have positioned the lower view here therefore will be here but when it is moved it should be executed only after moving the data area here and then it will be executed this is for 3 contiguous contiguous space lower view 1 region for lower view this is all contiguous another one is lower view shall vary 2 regions that means this will be in a separate location this will be in another region it may not be contiguous from that may be there and here also that can be gap 3 contiguous non-contiguous locations may be there these are all different images which are supported by the ARM linker and based on the target hardware it can be done so how do we start the application D part initialization sequences before the main function is called of any user code the C library is called ok it will copy the code and data as I told you from load image in the execution image then decompress so sometime what happen this sometime I am going back to and in value of this decompress that means why it is kept here it will be in the compressed form and then it is decompressed and then kept it as the execution image how much space it has so it may be you will space save sometime in the space in the ROM so so it has to decompress so before giving a control to run this will be done by the library so copy and decompress RW data initialize the ZI data to 0 and then set up the application stack and heap initialize library functions and then maybe call some you know top level constructors and then the control goes here and then exit is called or is terminate it will come here and exit from the application so it has to undo some of the things ok maybe it will release some areas some memories and then it will give a control back to the OS or any other operating function running in the system so this is the default initialization sequence so before any application done the job has to be done ok so it is when you develop a software and running your system in a debugger it runs immediately but when it has to be done on target hardware there is a lot of things involved that is what I am trying to tell you when you are developing software for a target hardware so in most embedded systems initialization sequence is used to set up the system before the main stack process is executed or called ok how do you debug it on a target hardware so what we do typically we will be debugging on a semi ghosting support but once we retargeted you may have to move whatever images in some memory to some other memory here functions also to be modified because it has to use some of the hardware specific printer for you know some LPD my display it has to use some of the features which are there in the hardware it cannot assume that whatever debugger is going to be running on the other side so retargeted means you have to re-compile actually the library may not be this portion and then build the executable run it on the target hardware by default C library is a semi ghosting to provide device level level function enabling host computer to act as an input output device this will be acting as input output device finally in target hardware if this target hardware will be taking care of all the input hardware ok so that has to be done it is not that whatever you debug here the same image will run on the hardware there will be some changes now I have told you what are the possible changes and so that you will understand it is not that it is you know you can just download it on the hardware and still run you have to do a lot of work before that and there you know you have all the knowledge now how memory is mapped how cache behaves how MMU behaves so you have all the knowledge and once you have a tools documentation with you you will be in a position to perform it has developed any software a semi ghosted environment and then Tiri target it makes modifications to the library and then run it successfully on the target hardware that is where you will be completing an a completion that means whatever all the things what you will learn will be used once you start working it on the target hardware so this is bringing us to the end of this section we have completed all the discussion that we have covered on tools and library linker in particular and then some memory map and then how different memory map changes from target to where it develops so I hope it was useful and I really enjoyed sharing this with you and I wish you all the very best for development and working with a real hardware and in the next lecture we will go on the umbar portion the specification and then some peripherals we will see before we come to the lecture wish you all the very best thank you for the time and attention see you in the next class bye bye