Tools to disassemble and reassemble binary SDK in-place

This commit is contained in:
Angus Gratton 2015-10-02 09:48:02 +10:00
parent d39b3f6bb6
commit 419f252d80
3 changed files with 40 additions and 2 deletions

5
binary_sdk/component.mk Normal file
View file

@ -0,0 +1,5 @@
# Component makefile for binary SDK components
binary_sdk_SRC_DIR = $(binary_sdk_ROOT)libmain $(binary_sdk_ROOT)libnet80211 $(binary_sdk_ROOT)libphy $(binary_sdk_ROOT)libpp $(binary_sdk_ROOT)libwpa
$(eval $(call component_compile_rules,binary_sdk))

32
binary_sdk/dump_libraries.sh Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
#
# Simple bash script to regenerate a set of binary SDK subdirectories
# containing assembler code disassembled using xtobjdis.
#
#
INDIR=$1
OUTDIR=$2
if [ -z ${OUTDIR} ] || [ -z ${INDIR}; then
echo "Usage: $0 [Input library dir] [Output binary_sdk dir]"
exit 1
fi
INDIR=$(realpath ${INDIR})
OUTDIR=$(realpath ${OUTDIR})
set -e -x
for LIB in ${INDIR}/*.a; do
LIB=$(basename ${LIB%.a})
echo $LIB
mkdir -p ${OUTDIR}/${LIB}
cd ${OUTDIR}/$LIB
ar x ${INDIR}/${LIB}.a
for O in *.o; do
O=${O%.o}
xtobjdis --rewrite-as-source ${O}.o > ${O}.S
rm ${O}.o
done
done

View file

@ -80,10 +80,11 @@ OBJDUMP = $(CROSS)objdump
# Source components to compile and link. Each of these are subdirectories # Source components to compile and link. Each of these are subdirectories
# of the root, with a 'component.mk' file. # of the root, with a 'component.mk' file.
COMPONENTS ?= $(EXTRA_COMPONENTS) FreeRTOS lwip core COMPONENTS ?= $(EXTRA_COMPONENTS) FreeRTOS lwip core binary_sdk
# binary esp-iot-rtos SDK libraries to link. These are pre-processed prior to linking. # binary esp-iot-rtos SDK libraries to link. These are pre-processed prior to linking.
SDK_LIBS ?= main net80211 phy pp wpa #SDK_LIBS ?= main net80211 phy pp wpa
SDK_LIBS =
# open source libraries linked in # open source libraries linked in
LIBS ?= hal gcc c LIBS ?= hal gcc c