初次创建仓库提交代码
1. 已经构建好了架子了。 2. 添加了示例的插件
This commit is contained in:
76
tools/doc2pdf.py
Normal file
76
tools/doc2pdf.py
Normal file
@ -0,0 +1,76 @@
|
||||
"""
|
||||
You need to install these libraries in the Linux os.
|
||||
1、sudo apt-get install python3
|
||||
2、sudo apt-get install libreoffice
|
||||
3、sudo apt-get install unoconv
|
||||
4、cd /usr/share/fonts/ mkdir chinese
|
||||
5、cp Windows os C:\Windows\Fonts to /usr/share/fonts/chinese
|
||||
chmod -R 755 /usr/share/fonts/chinese
|
||||
fc-cache -fv
|
||||
fc-list | grep chinese //check the new fonts
|
||||
6、Directions for use
|
||||
For example:
|
||||
python3 doc2pdf.py "./MI_SYS_API_V3.docx" "./MI_SYS_API_V3.pdf"
|
||||
"""
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
from comtypes import client
|
||||
except ImportError:
|
||||
client = None
|
||||
|
||||
try:
|
||||
from win32com.client import constants, gencache
|
||||
except ImportError:
|
||||
constants = None
|
||||
gencache = None
|
||||
|
||||
|
||||
def doc2pdf(docPath, pdfPath):
|
||||
"""
|
||||
convert a doc/docx document to pdf format
|
||||
:docPath: path to doc/docx Input
|
||||
:pdfPath: path to pdf Output
|
||||
"""
|
||||
docPathTrue = os.path.abspath(docPath)
|
||||
if client is None:#判断环境,linux环境这里肯定为None
|
||||
return doc2pdf_linux(docPathTrue, pdfPath)
|
||||
# name, ext = os.path.splitext(doc)
|
||||
# try:
|
||||
# word = client.DispatchEx("Word.Application")
|
||||
# worddoc = word.Documents.Open(doc)
|
||||
# worddoc.SaveAs(name + '.pdf', FileFormat=17)
|
||||
# except Exception:
|
||||
# raise
|
||||
# finally:
|
||||
# worddoc.Close()
|
||||
# word.Quit()
|
||||
word = gencache.EnsureDispatch('Word.Application')
|
||||
doc = word.Documents.Open(docPathTrue, ReadOnly=1)
|
||||
doc.ExportAsFixedFormat(pdfPath,
|
||||
constants.wdExportFormatPDF,
|
||||
Item=constants.wdExportDocumentWithMarkup,
|
||||
CreateBookmarks=constants.wdExportCreateHeadingBookmarks)
|
||||
word.Quit(constants.wdDoNotSaveChanges)
|
||||
|
||||
|
||||
def doc2pdf_linux(docPath, pdfPath):
|
||||
"""
|
||||
convert a doc/docx document to pdf format (linux only, requires libreoffice)
|
||||
:param doc: path to doc/docx document
|
||||
cmd = 'libreoffice --headless --convert-to pdf :writer_pdf_Export'.split() + [filePath] + ['--outdir'] + [destDir]
|
||||
"""
|
||||
filePath = docPath
|
||||
destDir = pdfPath
|
||||
cmd = 'libreoffice --headless --convert-to pdf :writer_pdf_Export'.split() + [filePath] + ['--outdir'] + [destDir]
|
||||
print(filePath)
|
||||
p = subprocess.Popen(cmd,stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
p.wait(timeout=60)
|
||||
stdout, stderr = p.communicate()
|
||||
if stderr:
|
||||
raise subprocess.SubprocessError(stderr)
|
||||
|
||||
if __name__ == '__main__':
|
||||
doc2pdf(sys.argv[1], sys.argv[2])
|
112
tools/map_calcsize.sh
Normal file
112
tools/map_calcsize.sh
Normal file
@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
|
||||
#######################################################################################
|
||||
#./build/map_calcsize.sh -c [0, 1]. control whether to generate a param table.
|
||||
#./build/map_calcsize.sh -p percent, percent=non-negative integer.
|
||||
#######################################################################################
|
||||
|
||||
PWDDIR=`pwd`
|
||||
MAPPATH="${PWDDIR}/project/image/output/map"
|
||||
DESTPATH="${PWDDIR}/build"
|
||||
SEG_LIST=".text .rodata .data"
|
||||
MAP_SUBDIR="ko so"
|
||||
PARAMSWITCH=1
|
||||
|
||||
MAPPARSER=map_parsesize.awk
|
||||
PARAMTABLE=map_param.thd
|
||||
PERCENT=0
|
||||
isGenerateParam=0
|
||||
|
||||
#Determine the MAX_THD by PERCENT.
|
||||
while getopts "c:p:" opt; do
|
||||
case $opt in
|
||||
c)
|
||||
if [ ${OPTARG} -eq 1 ]; then isGenerateParam=1; else isGenerateParam=0; fi
|
||||
#echo "isGenerateParam=${isGenerateParam}"
|
||||
;;
|
||||
p)
|
||||
if [ ${OPTARG} -lt 0 ]; then PERCENT=0; else PERCENT=${OPTARG}; fi
|
||||
#echo "PERCENT=${PERCENT}"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
generate_param_table()
|
||||
{
|
||||
cd ${PWDDIR};
|
||||
if [ ${PARAMSWITCH} == 1 ];
|
||||
then
|
||||
if [ -f ${DESTPATH}/${PARAMTABLE} ]
|
||||
then
|
||||
rm -rf ${DESTPATH}/${PARAMTABLE}
|
||||
fi
|
||||
PARAMSWITCH=0
|
||||
fi
|
||||
|
||||
awk -f ${DESTPATH}/${MAPPARSER} m=0 o=0 d=0 f=$2 ${MAPPATH}/$1/$2 >> ${DESTPATH}/${PARAMTABLE}
|
||||
}
|
||||
|
||||
#######################################################################################
|
||||
# calc .text, .rodata and .data size between testmap and THD #
|
||||
#######################################################################################
|
||||
calc_size_for_each_map()
|
||||
{
|
||||
#-------------------------------------------------------------------------------------------
|
||||
for mapsubdir in ${MAP_SUBDIR}
|
||||
do
|
||||
if test -d ${MAPPATH}/${mapsubdir}
|
||||
then
|
||||
for file in `ls ${MAPPATH}/${mapsubdir}/`;
|
||||
do
|
||||
if test -f ${MAPPATH}/${mapsubdir}/${file}
|
||||
then
|
||||
#-------------------------------------------------------------------------------------------
|
||||
#generate .text .rodata and .data totalsize to ${PARAMTABLE}
|
||||
if [[ ${isGenerateParam} -eq 1 ]]; then generate_param_table ${mapsubdir} ${file}; fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
for segtype in ${SEG_LIST}
|
||||
do
|
||||
#-------------------------------------------------------------------------------------------
|
||||
#echo "segtype=${segtype}"
|
||||
if [ ${segtype} == ".text" ]; then column=3; elif [ ${segtype} == ".rodata" ]; then column=4; elif [ ${segtype} == ".data" ]; then column=5; fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
#calc .text .rodata .data size in the mapfile
|
||||
size=`awk -f ${DESTPATH}/${MAPPARSER} m=0 o=0 d=0 f=${file} t=${segtype} ${MAPPATH}/${mapsubdir}/${file}`
|
||||
size_dec=`printf %d ${size}`
|
||||
#echo "size=${size} size_dec=${size_dec}"
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
#calc .text .rodata .data max_thdsize in the ${PARAMTABLE}
|
||||
sizeThd=`awk '{ if ($1 ~ "'$file'") {print ""$"'$column'"}}' ${DESTPATH}/${PARAMTABLE}`
|
||||
|
||||
size_decThd=`printf %d ${sizeThd}`
|
||||
size_modThd=`expr ${size_decThd} + ${size_decThd} \* ${PERCENT} / 100`
|
||||
size_hexThd=`printf 0x%x ${size_modThd}`
|
||||
#echo "PERCENT=${PERCENT} size=${size} size_dec=${size_dec} | sizeThd=${sizeThd} size_decThd=${size_decThd} size_modThd=${size_modThd} size_hexThd=${size_hexThd}"
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
#campare seg size int the mapfile and seg max_thdsize in the ${PARAMTABLE}
|
||||
if [[ ${size_dec} -gt ${size_modThd} ]]; then echo -e "\033[1;34;47m Warning: check ${file} fail! ${segtype}size:[${size}] > THD:[${size_hexThd}] Percent:[${PERCENT}] \033[0m\n"; fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
done
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e "\033[1;32m ${MAPPATH}/${mapsubdir} is not exist!\033[0m"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
calc_size_for_each_map
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
154
tools/map_param.thd
Normal file
154
tools/map_param.thd
Normal file
@ -0,0 +1,154 @@
|
||||
THD_dh9931_ko.map 0x18830 0x148d8 0xc8 0x3e90
|
||||
THD_drv_ms_cus_ad5820_ko.map 0xc9 0xb0 0x19 0x0
|
||||
THD_drv_ms_cus_ar0237_RGBIR_ko.map 0xcfa 0x884 0x442 0x34
|
||||
THD_drv_ms_cus_C2390_MIPI_ko.map 0xec7 0xafc 0x3b3 0x18
|
||||
THD_drv_ms_cus_dw9714_ko.map 0x115 0xfc 0x19 0x0
|
||||
THD_drv_ms_cus_F23_MIPI_ko.map 0x976 0x738 0x22e 0x10
|
||||
THD_drv_ms_cus_F32_MIPI_ko.map 0x1400 0xff4 0x3d4 0x38
|
||||
THD_drv_ms_cus_F37P_MIPI_ko.map 0x928 0x6c0 0x24c 0x1c
|
||||
THD_drv_ms_cus_F53_MIPI_0304_ko.map 0x12d0 0xe20 0x4a0 0x10
|
||||
THD_drv_ms_cus_gc1054_MIPI_ko.map 0x9f9 0x6a8 0x305 0x4c
|
||||
THD_drv_ms_cus_gc2053_MIPI_ko.map 0xc7d 0x868 0x3bd 0x58
|
||||
THD_drv_ms_cus_gc4653_MIPI_ko.map 0xad6 0x6b0 0x416 0x10
|
||||
THD_drv_ms_cus_H66_MIPI_ko.map 0x904 0x6d0 0x214 0x20
|
||||
THD_drv_ms_cus_hm5532_MIPI_ko.map 0x1c30 0x1060 0xb9c 0x34
|
||||
THD_drv_ms_cus_imx230_MIPI_ko.map 0x12a8 0xcf4 0x580 0x34
|
||||
THD_drv_ms_cus_imx274_MIPI_ko.map 0x306a 0x19e4 0x1656 0x30
|
||||
THD_drv_ms_cus_imx291_MIPI_ko.map 0xb69 0x934 0x221 0x14
|
||||
THD_drv_ms_cus_imx307_MIPI_ko.map 0x1c20 0x16dc 0x530 0x14
|
||||
THD_drv_ms_cus_imx317_MIPI_ko.map 0x1b58 0x120c 0x920 0x2c
|
||||
THD_drv_ms_cus_imx323_ko.map 0xa2c 0x624 0x3dc 0x2c
|
||||
THD_drv_ms_cus_imx327_MIPI_ko.map 0x1ff4 0x18bc 0x720 0x18
|
||||
THD_drv_ms_cus_imx334_MIPI_ko.map 0x2959 0x1360 0x15e5 0x14
|
||||
THD_drv_ms_cus_imx335_MIPI_ko.map 0x21af 0x1434 0xd67 0x14
|
||||
THD_drv_ms_cus_imx347_MIPI_ko.map 0x19c6 0x14b4 0x4ee 0x24
|
||||
THD_drv_ms_cus_imx412_MIPI_ko.map 0x3d10 0x1258 0x2a98 0x20
|
||||
THD_drv_ms_cus_imx415_MIPI_ko.map 0x3dd3 0x1ae0 0x22d3 0x20
|
||||
THD_drv_ms_cus_imx477_MIPI_ko.map 0xba9 0x7dc 0x3bd 0x10
|
||||
THD_drv_ms_cus_jxf37_MIPI_ko.map 0x13c0 0xef4 0x47c 0x50
|
||||
THD_drv_ms_cus_K04_MIPI_ko.map 0x14a0 0xe5c 0x634 0x10
|
||||
THD_drv_ms_cus_k17_MIPI_ko.map 0x1014 0xd98 0x26c 0x10
|
||||
THD_drv_ms_cus_nvp6124b_ko.map 0x289a 0x714 0x217a 0xc
|
||||
THD_drv_ms_cus_nvp6158c_ko.map 0x2715 0x468 0x229d 0x10
|
||||
THD_drv_ms_cus_opn008_ko.map 0x5fc 0x474 0x160 0x28
|
||||
THD_drv_ms_cus_OS02C10_MIPI_ko.map 0x17c0 0xe8c 0x924 0x10
|
||||
THD_drv_ms_cus_OS02F10_MIPI_ko.map 0xf0a 0x870 0x66e 0x2c
|
||||
THD_drv_ms_cus_OS02G10_MIPI_ko.map 0xa62 0x7c4 0x27a 0x24
|
||||
THD_drv_ms_cus_OS04A10_MIPI_ko.map 0x1a5c 0xfcc 0xa78 0x18
|
||||
THD_drv_ms_cus_OS04B10_MIPI_ko.map 0x9c4 0x724 0x58 0x248
|
||||
THD_drv_ms_cus_OS04C10_MIPI_ko.map 0x1c3c 0x125c 0x9b4 0x2c
|
||||
THD_drv_ms_cus_OS05A10_MIPI_ko.map 0xdcc 0x954 0x440 0x38
|
||||
THD_drv_ms_cus_OS05A20_MIPI_ko.map 0x1e26 0x1254 0xba6 0x2c
|
||||
THD_drv_ms_cus_OS08A10_MIPI_ko.map 0x37be 0x17dc 0x1fc6 0x1c
|
||||
THD_drv_ms_cus_ov2710_MIPI_ko.map 0xe84 0x808 0x650 0x2c
|
||||
THD_drv_ms_cus_ov2718_MIPI_ko.map 0x6e7a 0x1560 0x58fa 0x20
|
||||
THD_drv_ms_cus_ov2732_MIPI_ko.map 0x1234 0xd74 0x4a0 0x20
|
||||
THD_drv_ms_cus_ov2735_MIPI_ko.map 0xeac 0x804 0x67c 0x2c
|
||||
THD_drv_ms_cus_ov4688_MIPI_ko.map 0x1f38 0x1160 0xdc0 0x18
|
||||
THD_drv_ms_cus_ov4689_MIPI_ko.map 0x169d 0x974 0xd15 0x14
|
||||
THD_drv_ms_cus_PS5250_MIPI_ko.map 0xd69 0x860 0x4a9 0x60
|
||||
THD_drv_ms_cus_PS5258_MIPI_ko.map 0xc43 0x884 0x3a3 0x1c
|
||||
THD_drv_ms_cus_PS5260_MIPI_ko.map 0x18a0 0xbac 0x9b8 0x33c
|
||||
THD_drv_ms_cus_PS5268_MIPI_ko.map 0xca3 0x884 0x403 0x1c
|
||||
THD_drv_ms_cus_PS5270_MIPI_ko.map 0x1bce 0xbb8 0xfde 0x38
|
||||
THD_drv_ms_cus_PS5280_MIPI_ko.map 0x13ed 0x8c8 0x751 0x3d4
|
||||
THD_drv_ms_cus_PS5520_MIPI_ko.map 0xd21 0x7b0 0x501 0x70
|
||||
THD_drv_ms_cus_Q03_MIPI_ko.map 0x1270 0xe20 0x428 0x28
|
||||
THD_drv_ms_cus_rn6752_ko.map 0x58f 0x470 0x113 0xc
|
||||
THD_drv_ms_cus_rn6752_MIPI_ko.map 0x555 0x404 0x145 0xc
|
||||
THD_drv_ms_cus_rn6752m_ko.map 0x9da 0x6b0 0x31a 0x10
|
||||
THD_drv_ms_cus_rn6752V_MIPI_ko.map 0x685 0x53c 0x13d 0xc
|
||||
THD_drv_ms_cus_rn6852_MIPI_ko.map 0xa63 0x7a8 0x2af 0xc
|
||||
THD_drv_ms_cus_RX_MIPI_ko.map 0x87c 0x7d0 0xa0 0xc
|
||||
THD_drv_ms_cus_RX_RAW_MIPI_ko.map 0x3e5 0x370 0x69 0xc
|
||||
THD_drv_ms_cus_sc031gs_MIPI_ko.map 0xab2 0x878 0x1ea 0x50
|
||||
THD_drv_ms_cus_sc132gs_MIPI_ko.map 0x1082 0xae4 0x53e 0x60
|
||||
THD_drv_ms_cus_SC200ai_MIPI_ko.map 0x15eb 0x10cc 0xcf 0x450
|
||||
THD_drv_ms_cus_sc210iot_MIPI_ko.map 0xe72 0xc5c 0x112 0x104
|
||||
THD_drv_ms_cus_sc2210_MIPI_ko.map 0x1b0b 0x1184 0x923 0x64
|
||||
THD_drv_ms_cus_sc2231_ko.map 0xbab 0x748 0x6f 0x3f4
|
||||
THD_drv_ms_cus_sc2231_MIPI_ko.map 0xcd6 0x864 0x46 0x42c
|
||||
THD_drv_ms_cus_sc2232H_ko.map 0xca7 0x748 0x73 0x4ec
|
||||
THD_drv_ms_cus_sc2232H_MIPI_ko.map 0xc94 0x938 0x334 0x28
|
||||
THD_drv_ms_cus_SC2232_ko.map 0xc3e 0x7f4 0x31e 0x12c
|
||||
THD_drv_ms_cus_sc2235_ko.map 0xac2 0x7d8 0x2be 0x2c
|
||||
THD_drv_ms_cus_sc2238H_ko.map 0x91e 0x674 0x27e 0x2c
|
||||
THD_drv_ms_cus_sc2239_MIPI_ko.map 0xb38 0x918 0x78 0x1a8
|
||||
THD_drv_ms_cus_sc2310_ko.map 0xb6a 0x878 0x2ca 0x28
|
||||
THD_drv_ms_cus_SC2310_MIPI_ko.map 0x1852 0x117c 0x69e 0x38
|
||||
THD_drv_ms_cus_sc2315_MIPI_ko.map 0xe88 0x9b0 0x4c8 0x10
|
||||
THD_drv_ms_cus_sc2332_MIPI_ko.map 0x96d 0x7a0 0x85 0x148
|
||||
THD_drv_ms_cus_sc2335_MIPI_ko.map 0xb5c 0x904 0x78 0x1e0
|
||||
THD_drv_ms_cus_sc3235_ko.map 0xa86 0x754 0x30a 0x28
|
||||
THD_drv_ms_cus_sc3235_MIPI_ko.map 0xbce 0x914 0x292 0x28
|
||||
THD_drv_ms_cus_sc3335_MIPI_ko.map 0xb4a 0x924 0x1ca 0x5c
|
||||
THD_drv_ms_cus_sc4210_MIPI_ko.map 0x24ac 0x1698 0xddc 0x38
|
||||
THD_drv_ms_cus_sc4236_MIPI_ko.map 0x14dc 0xbd0 0x8e4 0x28
|
||||
THD_drv_ms_cus_SC4238_MIPI_ko.map 0x240d 0x1394 0x45 0x1034
|
||||
THD_drv_ms_cus_sc4335_MIPI_ko.map 0xbe6 0x8e8 0x2d6 0x28
|
||||
THD_drv_ms_cus_sc500ai_MIPI_ko.map 0x173c 0x12fc 0x278 0x1c8
|
||||
THD_drv_ms_cus_sc5235_MIPI_ko.map 0x3ba5 0x196c 0x75 0x21c4
|
||||
THD_drv_ms_cus_sc5335_MIPI_ko.map 0xc22 0x9a8 0x72 0x208
|
||||
THD_drv_ms_cus_sc5335P_MIPI_ko.map 0xb6e 0x8fc 0x6a 0x208
|
||||
THD_drv_ms_cus_sc8235_MIPI_ko.map 0x43a4 0x18a0 0x124 0x29e0
|
||||
THD_drv_ms_cus_sp2306_MIPI_ko.map 0x9c8 0x764 0x23c 0x28
|
||||
THD_drv_ms_cus_SP2309_ko.map 0xe99 0x894 0x5f1 0x14
|
||||
THD_drv_ms_cus_sp2329_MIPI_ko.map 0x13fc 0xfc0 0x424 0x18
|
||||
THD_drv_ms_cus_tc358743xbg_MIPI_ko.map 0x1cdc 0x1c64 0x6c 0xc
|
||||
THD_drv_ms_cus_tp2852b_MIPI_ko.map 0xb16 0xa7c 0x8e 0xc
|
||||
THD_drv_ms_cus_tp2852_MIPI_ko.map 0x93a 0x7c0 0x16e 0xc
|
||||
THD_drv_ms_cus_tp2855_MIPI_ko.map 0x220d 0x2128 0xd5 0x10
|
||||
THD_drv_ms_cus_tp9950_MIPI_ko.map 0x1658 0x788 0xec4 0xc
|
||||
THD_fbdev_ko.map 0x330f 0x3118 0x167 0x90
|
||||
THD_mhal_ko.map 0x11c705 0xec058 0x13351 0x1d35c
|
||||
THD_mi_ai_ko.map 0xb41c 0xa478 0xf00 0xa4
|
||||
THD_mi_alsa_ko.map 0x1fdd 0x17c8 0x23d 0x5d8
|
||||
THD_mi_ao_ko.map 0xa4ba 0x9764 0xc92 0xc4
|
||||
THD_mi_cipher_ko.map 0x48b2 0x4208 0x5b6 0xf4
|
||||
THD_mi_common_ko.map 0x84c 0x5c8 0x258 0x2c
|
||||
THD_mi_disp_ko.map 0x12279 0x10884 0x18c5 0x130
|
||||
THD_mi_gfx_ko.map 0x2402 0x2000 0x34a 0xb8
|
||||
THD_mi_hdmi_ko.map 0x31be 0x2cd0 0x45e 0x90
|
||||
THD_mi_ipu_ko.map 0x20c9 0x1d78 0x5d 0x2f4
|
||||
THD_mi_isp_ko.map 0xba64 0xaebc 0xadc 0xcc
|
||||
THD_mi_jpd_ko.map 0x8034 0x7780 0x81c 0x98
|
||||
THD_mi_ldc_ko.map 0x2588e 0x24624 0x11c0 0xaa
|
||||
THD_mi_mipitx_ko.map 0x1c18 0x1778 0x428 0x78
|
||||
THD_mi_panel_ko.map 0x3186 0x2e0c 0x2d6 0xa4
|
||||
THD_mi_rgn_ko.map 0xa339 0x92ec 0xf25 0x128
|
||||
THD_mi_scl_ko.map 0xbff2 0xb470 0xae2 0xa0
|
||||
THD_mi_sensor_ko.map 0x28f6 0x25c8 0x292 0x9c
|
||||
THD_mi_shadow_ko.map 0x437f 0x3aa0 0x84f 0x90
|
||||
THD_mi_sys_ko.map 0x3779c 0x31fc8 0x53cc 0x408
|
||||
THD_mi_vdec_ko.map 0x111e9 0x10098 0x1011 0x140
|
||||
THD_mi_vdisp_ko.map 0x644a 0x5b2c 0x85e 0xc0
|
||||
THD_mi_venc_ko.map 0x207fc 0x1e048 0x1ebc 0x8f8
|
||||
THD_mi_vif_ko.map 0x7dad 0x7590 0x735 0xe8
|
||||
THD_mi_ai_so.map 0x775e 0x65dc 0x1112 0x70
|
||||
THD_mi_ao_so.map 0x8b1a 0x7714 0x1396 0x70
|
||||
THD_mi_cipher_so.map 0x1434 0x11ec 0x1d4 0x74
|
||||
THD_mi_common_so.map 0x1118 0xdcc 0x278 0xd4
|
||||
THD_mi_cus3a_so.map 0x575b 0x4e84 0x790 0x147
|
||||
THD_mi_disp_so.map 0x263e 0x2514 0xb6 0x74
|
||||
THD_mi_gfx_so.map 0x12da 0xf7c 0x2ea 0x74
|
||||
THD_mi_hdmi_so.map 0x6130 0x4d00 0x13bc 0x74
|
||||
THD_mi_ipu_so.map 0x4b63 0x4154 0x997 0x78
|
||||
THD_mi_iqserver_so.map 0xa75f 0x8d98 0x1775 0x252
|
||||
THD_mi_ispalgo_so.map 0x2e76d 0x26bc0 0x41f0 0x39bd
|
||||
THD_mi_isp_so.map 0xc245 0xb50c 0x748 0x5f1
|
||||
THD_mi_jpd_so.map 0x203b 0x1d88 0x23f 0x74
|
||||
THD_mi_ldc_so.map 0x561e 0x42cc 0x1279 0xd9
|
||||
THD_mi_mipitx_so.map 0x896 0x76c 0xb6 0x74
|
||||
THD_mi_panel_so.map 0xe92 0xd68 0xb6 0x74
|
||||
THD_mi_rgn_so.map 0xef2 0xdd4 0xaa 0x74
|
||||
THD_mi_scl_so.map 0xcab 0xbd8 0x5f 0x74
|
||||
THD_mi_sed_so.map 0x4f3b 0x41a8 0xce3 0xb0
|
||||
THD_mi_sensor_so.map 0xfc2 0xe98 0xb6 0x74
|
||||
THD_mi_shadow_so.map 0x1b9f 0x1830 0x2fb 0x74
|
||||
THD_mi_sys_so.map 0x23cc 0x2244 0xab 0xdd
|
||||
THD_mi_vdec_so.map 0x1ecf 0x1c64 0x1f7 0x74
|
||||
THD_mi_vdf_so.map 0x118fd 0xe420 0x3474 0x69
|
||||
THD_mi_vdisp_so.map 0xb46 0xa1c 0xb6 0x74
|
||||
THD_mi_venc_so.map 0x9880 0x8cac 0xb60 0x74
|
||||
THD_mi_vif_so.map 0xcba 0xb8c 0xba 0x74
|
||||
THD_mi_wlan_so.map 0x6cc4 0x59a0 0x10f6 0x22e
|
252
tools/map_parsesize.awk
Normal file
252
tools/map_parsesize.awk
Normal file
@ -0,0 +1,252 @@
|
||||
#!/usr/bin/awk -f
|
||||
# arrays of arrays are support only after gawk v4.0
|
||||
# arguments: m for module count, o for subobj count, d for debugging, f for the mapfile, t for segment(.text .rodata .data).
|
||||
# m: [0, 50], module count, can control the number of output primary goals(*.a/*.o).
|
||||
# o: if (m=0); then o=0;elif (m>0); then o=[0, 30]; fi,subobj count,can control the number of output secondary goals(*.o).
|
||||
# d: 0 or 1, control whether to printout Debugging Accumulation info.
|
||||
# f: mapfile to be processed.
|
||||
# t: ".text" ".rodata" ".data", segment type
|
||||
|
||||
BEGIN {
|
||||
# Array element's sorted by value in descending order
|
||||
PROCINFO["sorted_in"] = "@val_num_desc"
|
||||
# Additional module
|
||||
moduleName["linker"] = "linker"
|
||||
}
|
||||
|
||||
#1 extract loaded module name as in the leaf folder path
|
||||
#moduleName[module]=module=the module name
|
||||
/^LOAD/ {
|
||||
match($2, /\/[^\/]*\.[^\/]*$/)
|
||||
module = substr($2, RSTART+1)
|
||||
if (!moduleName[module]){
|
||||
moduleName[module] = module
|
||||
#print "module="module " moduleName["module"]="moduleName[module]
|
||||
}
|
||||
}
|
||||
|
||||
#2 extrac the .text, .rodata and .data totalsize the beginning of each interested section
|
||||
/^\..*0x.*0x/ {
|
||||
if ($1 == ".text" || $1 == ".rodata" || $1 == ".data" || $1 == ".rom"){
|
||||
section = $1
|
||||
sectionSize[$1] = strtonum($3)
|
||||
#print "section="section " sectionSize["section"]="sectionSize[$1]
|
||||
}
|
||||
else{
|
||||
section = ""
|
||||
}
|
||||
next
|
||||
}
|
||||
|
||||
#3 accumulate module(*.a/*.o) size and subobj(*.o) size in each interested section
|
||||
section && $0 ~ /.*[[:blank:]]0x.*[[:blank:]]0x/ {
|
||||
#print $0
|
||||
#3.1 filter valid rows
|
||||
if (((NF == 4 && $1 ~ /^\./) || (NF == 3 && $1 ~ /^0x/ && strtonum($1) > 0)) && $0 !~ /.*\.mod\.o$/) {
|
||||
#print $0
|
||||
match($NF, /\/[^\/]*\.[^\/\(]*\(/)
|
||||
#3.2 separater primary and secondary goals by filtering
|
||||
if (RSTART){
|
||||
#3.3 separater secondary goals
|
||||
#print $0
|
||||
curModule = substr($NF, RSTART+1, RLENGTH-2)
|
||||
|
||||
match($NF, /\([^\(]*\.[^\(]*\)/)
|
||||
curSubObj = substr($NF, RSTART+1, RLENGTH-2)
|
||||
curSize = $(NF-1)
|
||||
|
||||
#printf("%-30s%-50s%-26s\n", sprintf("curModule=%s", curModule), sprintf("curSubObj=%s", curSubObj), sprintf("curSize=%s", curSize))
|
||||
}
|
||||
else{
|
||||
#print $0
|
||||
#3.4 separater primary goals
|
||||
match($NF, /\/[^\/]*\.[^\/\(]*$/)
|
||||
#print "NF="$NF" RSTART="RSTART
|
||||
|
||||
if (RSTART) {
|
||||
curModule = substr($NF, RSTART+1, RLENGTH-1)
|
||||
curSize = $(NF-1)
|
||||
|
||||
#printf("%-60s%-26s\n", sprintf("curModule=%s", curModule), sprintf("curSize=%s", curSize))
|
||||
}
|
||||
else{
|
||||
curModule = $NF
|
||||
curSize = $(NF-1)
|
||||
#print "section="section " curModule="curModule " curSize="curSize
|
||||
}
|
||||
curSubObj = ""
|
||||
}
|
||||
|
||||
#3.5 use curModule curSubObj curSize to calculate the size of each primary and secondary goals, and store them in arrays
|
||||
#if (moduleName[curModule])
|
||||
if ( 1 )
|
||||
{
|
||||
accSize += strtonum(curSize)
|
||||
|
||||
moduleSize[".total"][curModule] += strtonum(curSize)
|
||||
moduleSize[section][curModule] += strtonum(curSize)
|
||||
|
||||
if (section == ".rodata") {
|
||||
textsize += strtonum(curSize)
|
||||
#print "moduleSize["section"]["curModule"]="moduleSize[section][curModule] " textsize="textsize
|
||||
}
|
||||
|
||||
if (curSubObj){
|
||||
subObjSize[curModule][".total"][curSubObj] += strtonum(curSize)
|
||||
subObjSize[curModule][section][curSubObj] += strtonum(curSize)
|
||||
isContainObj[curModule] = 1
|
||||
}
|
||||
else {
|
||||
isContainObj[curModule] = 0
|
||||
#directObjSize[curModule][".total"] += strtonum(curSize)
|
||||
#directObjSize[curModule][section] += strtonum(curSize)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("module:\"%s\" Not Exist!\n", module)
|
||||
}
|
||||
}
|
||||
else{
|
||||
#print $0
|
||||
#3.6 calculate size of *fill* line
|
||||
if ($1 == "*fill*") {
|
||||
moduleSize[section]["*fill*"] += strtonum($NF)
|
||||
#print "section="section " "$0 " "$NF
|
||||
}
|
||||
else {
|
||||
#printf("NF[%d]:\"%s\" invalid!\n", NF, $0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
#4.1 parse params: m, o, d, f, t
|
||||
# Module count to have break-down analysis
|
||||
if (m > 50)
|
||||
MODULECOUNT = 50
|
||||
else
|
||||
MODULECOUNT = m
|
||||
|
||||
# Object counts in each interested module to have break-down analysis
|
||||
if (MODULECOUNT > 0) {
|
||||
if (o > 30)
|
||||
SUBOBJCOUNT = 30
|
||||
else
|
||||
SUBOBJCOUNT = o
|
||||
}
|
||||
else {
|
||||
SUBOBJCOUNT = 0
|
||||
}
|
||||
|
||||
if ("X" != "X"f ) {
|
||||
SRCFILENAME = sprintf("THD_%s", f)
|
||||
}
|
||||
|
||||
if (".text" == t || ".rodata" == t || ".data" == t) {
|
||||
SEGTYPE = t
|
||||
}
|
||||
|
||||
# Code section @ ".rom" or ".text"
|
||||
if (sectionSize[".rom"])
|
||||
codeSection = ".rom"
|
||||
else
|
||||
codeSection = ".text"
|
||||
|
||||
#print "MODULECOUNT="MODULECOUNT " SUBOBJCOUNT="SUBOBJCOUNT " d="d
|
||||
#4.2 printout summary info include .text .rodata .data and total size
|
||||
totalSize = sectionSize[codeSection] + sectionSize[".rodata"] + sectionSize[".data"]
|
||||
|
||||
#printf("#####################################################################################################\n")
|
||||
#printf("%-36s%16s%16s%16s%16s\n", "Module", ".total", codeSection, ".rodata", ".data")
|
||||
#printf("=====================================================================================================\n")
|
||||
|
||||
# print out total and section size summary
|
||||
if("" == t) {
|
||||
printf("%-46s%16s%16s%16s%16s\n", SRCFILENAME, sprintf("0x%x",totalSize), sprintf("0x%x",sectionSize[codeSection]),
|
||||
sprintf("0x%x",sectionSize[".rodata"]), sprintf("0x%x",sectionSize[".data"]))
|
||||
}
|
||||
|
||||
#4.3 printout the size of a certain segment
|
||||
if (SEGTYPE == ".text") {
|
||||
printf("0x%x\n",sectionSize[codeSection])
|
||||
}
|
||||
else if (".rodata" == SEGTYPE) {
|
||||
printf("0x%x\n",sectionSize[".rodata"])
|
||||
}
|
||||
else if (".data" == SEGTYPE) {
|
||||
printf("0x%x\n",sectionSize[".data"])
|
||||
}
|
||||
|
||||
#4.4 printout Debugging Accumulation info include .text .rodata .data and total size
|
||||
# if debugging option's on, print section accumuation size as well
|
||||
if (d){
|
||||
sectionAccSize[".total"] = accSize
|
||||
for (section in sectionSize) {
|
||||
sectionAccSize[".total"] += moduleSize[section]["*fill*"]
|
||||
|
||||
if (sectionSize[section]){
|
||||
for (module in moduleSize[section]){
|
||||
sectionAccSize[section] += moduleSize[section][module]
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("%-36s%16s%16s%16s%16s\n", "Debugging Accumulation", sprintf("0x%x",sectionAccSize[".total"]), sprintf("0x%x",sectionAccSize[codeSection]),
|
||||
sprintf("0x%x",sectionAccSize[".rodata"]), sprintf("0x%x",sectionAccSize[".data"]))
|
||||
}
|
||||
|
||||
#4.5 printout primary goals's total .text .rodata and .data size.
|
||||
#print out module size summary
|
||||
if (MODULECOUNT) {
|
||||
printf("=============================================Module_List=============================================\n")
|
||||
i = 0
|
||||
#for循环依次取二级数组moduleSize[".total"]的二级下标
|
||||
for (module in moduleSize[".total"]) {
|
||||
#print "module="module
|
||||
#print "moduleSize[.total]"
|
||||
printf("%-36.36s%16s%16s%16s%16s\n", sprintf("%s",module),
|
||||
sprintf("0x%x",moduleSize[".total"][module]),
|
||||
sprintf("0x%x",moduleSize[codeSection][module]),
|
||||
sprintf("0x%x",moduleSize[".rodata"][module]),
|
||||
sprintf("0x%x",moduleSize[".data"][module]))
|
||||
if (++i >= MODULECOUNT)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
#4.6 printout secondary goals's total .text .rodata and .data size.
|
||||
if (SUBOBJCOUNT) {
|
||||
i = 0
|
||||
for (module in moduleSize[".total"]) {
|
||||
#print "isContainObj["module"]="isContainObj[module]
|
||||
if (isContainObj[module] == 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
printf("=============================================SubObj_List=============================================\n")
|
||||
|
||||
printf("%-36.36s%16s%16s%16s%16s\n", sprintf("%s",module),
|
||||
sprintf("0x%x",moduleSize[".total"][module]),
|
||||
sprintf("0x%x",moduleSize[codeSection][module]),
|
||||
sprintf("0x%x",moduleSize[".rodata"][module]),
|
||||
sprintf("0x%x",moduleSize[".data"][module]))
|
||||
|
||||
j = 0
|
||||
for (subObj in subObjSize[module][".total"]) {
|
||||
printf("%-36.36s%16s%16s%16s%16s\n", subObj,
|
||||
sprintf("0x%x",subObjSize[module][".total"][subObj]),
|
||||
sprintf("0x%x",subObjSize[module][codeSection][subObj]),
|
||||
sprintf("0x%x",subObjSize[module][".rodata"][subObj]),
|
||||
sprintf("0x%x",subObjSize[module][".data"][subObj]))
|
||||
if (++j >= SUBOBJCOUNT)
|
||||
break
|
||||
}
|
||||
|
||||
if (++i >= MODULECOUNT)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
#printf("#####################################################################################################\n")
|
||||
}
|
||||
|
11
tools/processExcel.py
Normal file
11
tools/processExcel.py
Normal file
@ -0,0 +1,11 @@
|
||||
# coding=utf-8
|
||||
import sys
|
||||
import openpyxl
|
||||
|
||||
def createExcel(fileName):
|
||||
wb = openpyxl.Workbook() # 创建一个excel文件
|
||||
sheet = wb.active # 获得一个的工作表
|
||||
wb.save(fileName)
|
||||
|
||||
if __name__ == '__main__':
|
||||
createExcel(sys.argv[1])
|
13
tools/processPdf.py
Normal file
13
tools/processPdf.py
Normal file
@ -0,0 +1,13 @@
|
||||
import re
|
||||
import sys
|
||||
from reportlab.pdfgen import canvas
|
||||
from reportlab.lib.units import inch, cm
|
||||
|
||||
def createPdf(fileName):
|
||||
c = canvas.Canvas(fileName)
|
||||
#c.drawImage('test.jpg', 0, 0, 10*cm, 10*cm)
|
||||
c.showPage()
|
||||
c.save()
|
||||
|
||||
if __name__ == '__main__':
|
||||
createPdf(sys.argv[1])
|
Reference in New Issue
Block a user