Atmel CAVR-4 Manuale Utente
CAVR-4
62
Building and using a customized library
AVR® IAR C/C++ Compiler
Reference Guide
Overriding library modules from the command line
This procedure is applicable to any source file in the library, which means
library_module.c
in this example can be any module in the library.
1
Copy the appropriate
library_module.c
to your project directory.
2
Make the required additions to the file (or create your own routine, using the default
file as a model), and make sure that it has the same module name as the original
module. The easiest way to achieve this is to save the new file under the same name as
the original file.
file as a model), and make sure that it has the same module name as the original
module. The easiest way to achieve this is to save the new file under the same name as
the original file.
3
Compile the modified file using the same options, include paths, and library
configuration file as for the rest of the project:
configuration file as for the rest of the project:
iccavr library_module
This creates a replacement object module file named
library_module.r90
.
4
Add
library_module.r90
to the XLINK command line, either directly or by using
an extended linker command file, for example:
xlink library_module dlavr-3s-ec-64-n.r90
Make sure that
library_module
is located before the library on the command line.
This ensures that your module is used instead of the one in the library.
Run XLINK to rebuild your application.
This will use your version of
library_module.r90
, instead of the one in the library.
For information about the XLINK options, see the IAR Linker and Library Tools
Reference Guide.
Reference Guide.
Building and using a customized library
In some situations, see Situations that require library building, page 55, it is necessary
to rebuild the library. In those cases you need to:
to rebuild the library. In those cases you need to:
●
Set up a library project
●
Make the required library modifications
●
Build your customized library
●
Finally, make sure your application project will use the customized library.
Information about the build process is described in AVR® IAR Embedded Workbench™
IDE User Guide.
IDE User Guide.
Note: It is possible to build IAR Embedded Workbench projects from the command
line by using the IAR Command Line Build Utility (
line by using the IAR Command Line Build Utility (
iarbuild.exe
). There is also a
batch file
(build_libs.bat
) provided for building the library from the command line.