2 * Copyright (c) 2006 SigmaTel, Inc.
4 * elftosb boot description file that creates some complicated situations for
5 * the loader to handle. of course this is also a good test for elftosb itself.
8 /* testing C style comments */
9 // testing C++ style comments
10 # testing shell style comments
13 kProgressReportsImageFlag = 0x1;
15 kPlayerDriveTag = 0xa0;
16 kHostlinkDriveTag = 0xb0;
20 productVersion = "5.0.999";
21 componentVersion = "5.0.999";
23 flags = kProgressReportsImageFlag; // turn on progress reports
25 secinfoClear = "ignore";
40 mainSizeIsDefined = defined(mainSize);
44 elffile = extern(0) (toolset="ghs");
48 anotherfile = "another.dat";
49 srecfile = "test_files/sd_player_gcc.srec";
53 driveTag = kPlayerDriveTag;
55 some_option = defined(testboolexpr);
59 printMessageAddr = elffile:printMessage;
60 printMessageSize = sizeof(elffile:printMessage);
62 // create const with address of main() in elffile
63 mainAddr = elffile:main;
65 mainSize = sizeof(elffile:main);
67 halfwordSize = sizeof(halfword);
69 elf_startAddr = elffile:_start;
71 // poop = exists(nonexistantfile);
73 binfile1size = sizeof(binfile1);
77 * test s-record support
81 load dcd {{ 00 11 22 33 }} > 0;
86 section(1; coalesce=true) {
88 info "welcome to section 1!";
89 info "elffile path = $(elffile)";
90 info "mainSizeIsDefined = $(d:mainSizeIsDefined)";
91 info "printMessage = $(x:printMessageAddr)";
93 info "size of binfile1 = $(binfile1size)";
95 // can use symbol refs inside bool expressions in an if stmt
98 warning "$(elffile) does not seem to have a main() function";
102 info "address of main() of $(elffile) is $(x:mainAddr)";
105 if defined(flag) && flag != 0
107 load 0x1234.h > 0..10K;
111 // print message using both decimal and hex formatting
112 warning "loading only halfword = $(d:halfword) [$(x:halfword)]!";
113 load halfword > 0..1K;
116 info "size of main() in $(elffile) is $(mainSize)";
117 info "printMessage() size is $(printMessageSize)";
118 info "size of halfword = $(halfwordSize)";
120 load 0xff.b > 32K..32K + sizeof(elffile:printMessage);
123 load {{ 00 01 02 03 04 }} > 1K;
125 // load all sections except .mytext
128 // figure out where to go from here
129 call :maybeSwitchSections(callArg1);
131 // print msg and loop
132 load "hi from section 1" > :szMsg;
133 call :printMessage(0);
138 // erase a function in memory
139 load 0.w > (elffile:endOfLine)..(elffile:endOfLine + sizeof(elffile:endOfLine));
142 section(2; alignment=64K) {
143 // cause an error if testConst has not been set
144 if !defined(testConst)
146 error "testConst is not defined!";
150 load "in section 2" > :szMsg;
151 call :printMessage();
154 // load the contents of binfile1 into the upper 128KB of ocram
155 load binfile1 > 128K..192K;
158 load "loaded binfile1" > :szMsg;
159 call :printMessage(0);
161 call :maybeSwitchSections(callArg2);
167 // non-bootable section between two bootable sections
168 section(0xbeef; alignment=32K, cleartext=false) <= binfile2;
170 section(3; alignment=8K) {
171 // load our special section
172 load $.mytext from elffile;
173 call elffile:countToN(5);
175 if (exists(foofile) && exists(anotherfile))
177 // a trainload of beef!
178 load 0xbeef.h > 128K..192K;
180 else if (exists(elffile) && callArg1 == 2)
183 load 0x12345678.w > 128K..192K;
190 load 0xaaaa.h > 128K..192K;
192 load 0xbbbb.h > 128K..192K;
197 load "hold on now, in section 3" > :szMsg;
198 call :printMessage(0);
206 load elffile[ $.bss ] > elffile:countToN;
207 // load [ $.bss ] > (elffile:countToN)..(elffile:countToN + sizeof(elffile:countToN));
212 info "address of _start in $(elffile) is $(elf_startAddr)";
215 section ('four'; alignment=8K, sectionFlags=0x1000) <= binfile1;
217 section ('five'; alignment=8K, cleartext=1, sectionFlags=0x1000) <= binfile1;
220 * create a data section out of some sections of an elf file
222 section (1234) <= ~$.bss, ~$.data from elffile;
223 section (4321) <= elffile [ $* ];
224 section (1111) <= elffile;
226 /* test data sections from various data sources */
227 section (0xaa) <= 0x12345678.w;
228 section (0xbb) <= "hi there! this is a data section.";
229 section (0xcc) <= {{ aa55aa55aa55aa55aa55aa55aa55aa55 }};
234 load elffile[ $*.text*, ~$.sdram* ];
240 // load a blob at address 0x1000
242 00 0a 07 b0 bb ff 03 78
243 00 0a 07 b0 bb ff 03 78
244 00 0a 07 b0 bb ff 03 78
245 00 0a 07 b0 bb ff 03 78
246 00 0a 07 b0 bb ff 03 78
252 // uncomment to test better error reporting for files that failed to open
256 //section (2345) <= {{ 00 11 22 33 44 55 }};