To create a package the program mkpkg can be used. The set of files to put into the package should be in the desired location in the $(PackagesDir) directory. The mkpkg command should be run with $(PackagesDir) as the working directory and all files to go into the package must be referred to using relative paths. A package must have a package description file that is placed in the $(PackagesDir)/packages directory. The package description file name must end with _package.xml. If a package is to create entries in the new project wizard then it must have a file name project_templates.xml.
For example, a package for the mythical FX150 processor would supply the following files:
The package file FX150.emPackage would be created using the following command line:
mkpkg -c packages/FX150.emPackage targets/FX150/project_templates.xml … packages/FX150_package.xml
You can exclude specific files or directories from being added to a package using the -exclude option:
mkpkg -c packages/FX150.emPackage targets/FX150 -exclude targets/FX150/excluded_file.txt -exclude targets/FX150/excluded_directory packages/FX150_package.xml
You can list the contents of the package using the -t option:
mkpkg -t packages/FX150.emPackage
You can remove an entry from a package using the -d option:
mkpkg -d packages/FX150.emPackage -d fileName
You can add or replace a file into an existing package using the -r option:
mkpkg -r packages/FX150.emPackage -r fileName
You can extract files from an existing package using the -x option:
mkpkg -x packages/FX150.emPackage outputDirectory
You can automate the package creation process using a Combining project type.
When a package is installed, the files in the package are copied into the desired $(PackagesDir)-relative locations. When a file is copied into the $(PackagesDir)/packages directory and its filename ends with _package.xml the file $(PackagesDir)/packages/installed_packages.xml is updated with an entry:
<include filename="FX150_package.xml" />
During development of a package you can manually edit this file. The same applies to the file $(PackagesDir)/targets/project_templates.xml which will contain a reference to your project_templates.xml file.
mkpkg [options] packageFileName file1 file2 …
Option | Description |
-c | Create a new package. |
-compress level | Change compression level (0 for none, 9 for maximum). |
-d | Remove files from a package. |
-exclude path | Exclude path when adding files to a package. |
-f | Output files to stdout. |
-overwrite | Overwrite existing files. |
-no-date | Do not add date attribute to package. |
-r | Replace files in a package. |
-readonly | Force all files to have read only attribute. |
-set-attr attribute=value | Set package attribute to value. |
-sub-arch-endian | Create architecture and endian specific sub packages. |
-sub-arch-endian-compatiblity | Create architecture and endian specific sub packages including compatibility packages for versions of the IDE that don't have $(LibEndian) macro. |
-sub-base-type | Specify the type description of the base package. |
-sub-type | Specify the type description of the sub packages. |
-t | List the contents of a package. |
-v | Be chatty. |
-V | Show version information. |
-x | Extract files from a package. |