summaryrefslogtreecommitdiff
path: root/linkers/rtems-ld.cpp
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2012-11-21 11:07:12 +1100
committerChris Johns <chrisj@rtems.org>2012-11-21 11:07:12 +1100
commiteb3481120687bc6dbf86eebb8f269da6802ff64b (patch)
treeb0144066820c271aaca755e4653fd5e291817db8 /linkers/rtems-ld.cpp
parenta1d49302836ad78c9c64b6d9bf35a6155aa8e7c5 (diff)
Output application format files.
Added support for an RTEMS RAP format application file. The format is: <header> <LZ77> <Application Script> <[1..n] ELF Object files> </LZ77> Where the header is a text string of fields delimited by ',' and terminated with a line feed (\n). It is variable length: RTEMS-APP,0000000,01.00.00,LZ77,00000000\n\0 where: RTEMS-APP : file tag for quick acceptance and rejection Length : the length of the application in bytes including the : header Version : Version of the application format. Compress : The compression format. Checksum : CCITT CRC32 checksum. Following the header is a nul ('\0') character then an LZ77 container with the application loader script followed by the ELF object files. Note, the script format will be documented else where. Note, the final version may add a 32bit length field before each part in the compressed container to delimit the size of the file to be read. This is currently not in this version.
Diffstat (limited to 'linkers/rtems-ld.cpp')
-rw-r--r--linkers/rtems-ld.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/linkers/rtems-ld.cpp b/linkers/rtems-ld.cpp
index 54e9987..66ac235 100644
--- a/linkers/rtems-ld.cpp
+++ b/linkers/rtems-ld.cpp
@@ -170,7 +170,7 @@ main (int argc, char* argv[])
std::string output = "a.out";
std::string base_name;
std::string cc_name;
- bool script = false;
+ rld::outputter::type output_type = rld::outputter::ot_application;
bool standard_libs = true;
bool exec_prefix_set = false;
bool map = false;
@@ -211,7 +211,7 @@ main (int argc, char* argv[])
break;
case 'S':
- script = true;
+ output_type = rld::outputter::ot_script;
break;
case 'l':
@@ -385,10 +385,20 @@ main (int argc, char* argv[])
/**
* Output the file.
*/
- if (script)
- rld::outputter::script (output, dependents, cache);
- else
- rld::outputter::archive (output, dependents, cache);
+ switch (output_type)
+ {
+ case rld::outputter::ot_script:
+ rld::outputter::script (output, dependents, cache);
+ break;
+ case rld::outputter::ot_archive:
+ rld::outputter::archive (output, dependents, cache);
+ break;
+ case rld::outputter::ot_application:
+ rld::outputter::application (output, dependents, cache);
+ break;
+ default:
+ throw rld::error ("invalid output type", "output");
+ }
/**
* Check for warnings.