summaryrefslogtreecommitdiff
path: root/build_tools/make_firmware_object
blob: 4d721107247a143410418061fa3710762b8e96cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh -e

# make an object file from a raw binary firmware file
# arguments:
#   1 - firmware file
#   2 - output file
#   3 - template output file (used to learn desired format)

bfdname=`LANG=C objdump -f ${3} | grep -e "${3}:" | sed "s/.*file format \(.*\)/\1/"`
bfdarch=`LANG=C objdump -f ${3} | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"`

objcopy -I binary ${1} -B ${bfdarch} -O ${bfdname} ${2} --rename-section .data=.rodata,alloc,load,data,contents,readonly