2 # Copyright (c) 2008 Atheros Communications Inc.
4 # $ATH_LICENSE_TARGET_MK$
6 # This script constructs an AR6002 ROM firmware binary image
7 # for FPGA(if FPGA_FLAG is "1") or for actual silicon if FPGA_FLAG
10 # It takes two things as input:
11 # sw.rom.out, which is an ELF image of ROM software
12 # that was built for actual hardware or for FPGA
13 # data.rom.hw.bin OR data.rom.fpga.bin, which contains
14 # DataSets and other data that is to be included
15 # at the end of the firmware image
17 # It produces fw.rom.bin, a firmware image appropriate for
18 # use with AR6002 ROM.
20 # The image is constructed by converting the sw.rom.out ELF
21 # image to binary, padding at the end of that binary,
22 # and appending the data binary from data.rom.*.bin. So the
23 # final fw.rom.bin image is a binary image that's exactly
24 # the same size as the ROM hardware and which contains ROM
25 # software (including literals, read-only data, data that
26 # will be copied to RAM in order to initialize read/write data),
27 # DataSet Metadata, and DataSets.
30 sw_image=${sw_image:-$PRJ_ROOT/build/image/magpie/rom.out}
31 sw_bin=${sw_bin:-$PRJ_ROOT/build/image/magpie/rom.bin}
34 ds_in_rom="0x`xt-nm $sw_image | grep " _data_start_in_rom" | cut -b -8`"
36 # Place data binary at the end of ROM.
37 #data_start=$((9168*1024-`stat --format='%s' $data_bin`))
40 --change-section-lma .lit4+0x400000 \
41 --change-section-vma .lit4+0x400000 \
42 --change-section-lma .rodata+0x400000 \
43 --change-section-vma .rodata+0x400000 \
44 --change-section-lma .dram0.literal+0x400000 \
45 --change-section-vma .dram0.literal+0x400000 \
46 --remove-section .dport0.data \
47 --change-section-lma .data=$((ds_in_rom)) \
48 --change-section-vma .data=$((ds_in_rom)) \
49 -O binary $sw_image $sw_bin
51 #cat $sw_bin $data_bin > $fw_bin
53 #if [ `stat --format='%s' $fw_bin` -ne $((96*1024)) ]
55 # echo "$0 ERROR: firmware $fw_bin is NOT the expected size."