OSDN Git Service

Ticket 35407
[trx-305dsp/dsp.git] / trx305 / kernel / utils / ldr2sh
1 #! /bin/bash
2
3 # Prepare the headder part of the source code for SH2. 
4 cat > $2 <<_EOD_
5         .CPU            SH2
6         .SECTION        DSP,CODE
7 ;==========================================================================
8         .EXPORT BlackfinBytes
9         .ALIGN  4
10 BlackfinBytes:
11         .DATA.L BlackfinEnd-BlackfinStart
12 BlackfinStart:
13     .DATA.B H'00,H'00,H'80,H'ff,H'04,H'00,H'00,H'00,H'32,H'00,H'DE,H'AD,H'BE,H'EF
14 _EOD_
15
16 # convert the Blackfin LDR file as first parameter to the SH2 Assembler data format.
17 od  -v -t x1 $1 | sed "s/ /\,/g" |sed "s/^[0-9]*\,/.DATA.B ,/" | sed "s/,/,H\'/g" | sed "/^[0-9]*$/d" | sed "s/[0-9a-f]H//" | sed "s/,//" | sed "s/^/\t/" >> $2
18
19 # Add the tail part to the source code for SH2.
20 cat >>$2 <<_EOD_
21 BlackfinEnd:
22         .END
23 _EOD_