2008-11-27 Øyvind Harboe <oyvind.harboe@zylin.com>
[nios2ecos.git] / packages / hal / nios2 / arch / current / src / gtf-launch.in
blobe60a99b5cb15bd113c0dad8a434250437843c528
1 //==========================================================================\r
2 //\r
3 //      gtf-launch.in\r
4 //\r
5 //      Input file used to generate the gtf-launch script.\r
6 //\r
7 //==========================================================================\r
8 //####ECOSGPLCOPYRIGHTBEGIN####\r
9 // -------------------------------------------\r
10 // This file is part of eCos, the Embedded Configurable Operating System.\r
11 //\r
12 // eCos is free software; you can redistribute it and/or modify it under\r
13 // the terms of the GNU General Public License as published by the Free\r
14 // Software Foundation; either version 2 or (at your option) any later version.\r
15 //\r
16 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY\r
17 // WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
18 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
19 // for more details.\r
20 //\r
21 // You should have received a copy of the GNU General Public License along\r
22 // with eCos; if not, write to the Free Software Foundation, Inc.,\r
23 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.\r
24 //\r
25 // As a special exception, if other files instantiate templates or use macros\r
26 // or inline functions from this file, or you compile this file and link it\r
27 // with other works to produce a work based on this file, this file does not\r
28 // by itself cause the resulting work to be covered by the GNU General Public\r
29 // License. However the source code for this file must still be made available\r
30 // in accordance with section (3) of the GNU General Public License.\r
31 //\r
32 // This exception does not invalidate any other reasons why a work based on\r
33 // this file might be covered by the GNU General Public License.\r
34 //\r
35 // -------------------------------------------\r
36 //####ECOSGPLCOPYRIGHTEND####\r
38 // \r
39 // This file is used to generate the script used to launch the gtf-generate\r
40 // tool. This is done in order to extract the PTF (SOPC builder configuration)\r
41 // file from the project settings. i.e. this script allows us to set the input\r
42 // PTF file to be the value of the C macro CYGHWR_NIOS2_PTF set through\r
43 // configtool. Similarly, the input CPU name is set to the value of the\r
44 // CYGHWR_NIOS2_CPU macro.\r
45 //\r
46 // In order to achieve this, the launch script (gtf-launch) is generated by\r
47 // running this file through the C pre-processor. \r
48 //\r
50 #define HASH #\r
52 // Insert the name of the shell to use.\r
54 HASH!/bin/sh\r
56 //\r
57 // Avoid the inclusion of the auto-generate file system.h. This is necessary\r
58 // in order to avoid the circular dependency that would otherwise be \r
59 // generated, since gtf-launch is used to create system.h.\r
60 //\r
62 #define HAL_NIOS2_NO_SYSTEM_H\r
64 #include <pkgconf/hal_nios2.h>\r
66 //\r
67 // Undefine the implicit define for nios2. This is important since "nios2" is \r
68 // part of the default path for the nios2 kit, which can result in the path\r
69 // name to PTF files getting corrupted.\r
70 // \r
72 #ifdef nios2\r
73 #undef nios2\r
74 #endif\r
76 ptf_file=`cygpath -m CYGHWR_NIOS2_PTF`\r
78 // Check that the PTF file really exists. This allows us o generate a more\r
79 // meaningful error message.\r
81 if [ -f "$ptf_file" ]\r
82 then\r
84 //\r
85 // The call to gtf-generate. This sets the PTF and CPU name as apropriate, and\r
86 // then expects the remaining arguments to have been supplied on the command line.\r
87 //\r
89 gtf-generate --ptf="$ptf_file" --cpu=CYGHWR_NIOS2_CPU $@\r
91 else\r
93 echo Error: CYGHWR_NIOS2_PTF does not exist. Please verify the value of the SOPC builder \\r
94 configuration parameter set within the Nios2 architecture package. \r
96 return 1\r
98 fi\r