You are on page 1of 9

********************************************************************************

***********
NOIDA SERVER:
********************************************************************************
***********
commands to set the core on noida..
rf2
xt-run --show-config=cores
setenv XTENSA_CORE HiFi3_K3V6_LX6
echo $XTENSA_CORE

xt-run --turbo xa_evs_dec_test 32 stv32c_rfHI3_13200_32kHz.COD stv32_opt.OUT


********************************************************************************
***********
multiple commands with nohup option
add to .sh file and
add first line #!/usr/bin/sh
and save filename.sh
open from spiti
close
chmod +x filename.sh
nohup filename.sh
********************************************************************************
***********
#pragma loop_count min=<level>, max=<level>, factor=<level>, avg=<level>
for this loop you can just use #pragma loop_count factor=8
********************************************************************************
***********
profiling:
xt-run --client_cmds="profile --disable gmon.out"
.exe
al)
xt-gprof
exe
profiling result

-frames=n(option

Incase of unexpected results:


Enable "NOSTRIP=1" in make file for all types of builds
then profile it
It will give proper results
********************************************************************************
***********
p4
p4
p4
p4
p4
p4
p4
p4
p4
p4
p4

login
opened
edit filename
submit filename / ...
opened ...
diff -fse ...
revert filename
revert ... // all file names
changes ...
sync ... @
describe

version nums

p4 filelog -l
p4 edit -t text filename
- to change permissions
********************************************************************************
***********
insert == :i
quit == :q
write&quit == :wq
quitewosaving == :q!
>& dump.txt &
to run in background
xt-run --client_cmds="profile --all --disable gmon.out" .exe
-frames=n(option
al)
profiling
xt-gprof
exe
profiling result
ps -ef | grep bpra
to check all running processes
kill %
to kill process running in background
grep " U " or df
extract
tail -f result.log
to see result
which xt-xcc
whoami
********************************************************************************
***********
Unix Debugging:
make clean all DEBUG=1
xt-gdb xa_dts_m6_test
1.
-filename=48-1536-ChID51.wav -frames=10
4824-MIPS-Intensive-FrntSurr.wav 4824-MIPS-Intensive-FrntSurr.wav 4824-MIPS-Inte
nsive-Clfe.wav -q1 -l3/2/.1 -o48-1536-MIPS-Intensive-51
set args -filename=48-1536-ChID51.wav -frames=10
2.
target sim --turbo
r ......command line arguments.........
b **location**
p **variable**
r
c
q
n

run
continue
quit
next
fflush(stdout);

(xt-gdb) p &pSynthesisInstance->uHistory.HISTORYINT[channel][0]
********************************************************************************
***********
XT:
xt-run --turbo
turbo mode
xt-run --client_cmds="profile --disable gmon.out"
.exe
-frames=n(option
al)
profiling
cksum xa_m6_player_exe check sum
xt-size --format=xtensa objs/dts_ca_dec/*.o > 1.txt
Find Tables size in module

xt-size --format=xtensa ../../dts_ca_decode/build/objs/dts_ca_decode/* > ca_dev_


size.txt
Find Tables size in module:
Setpath for tool
sx_rd12
checking - which xt-xcc
./wavcmpr
compare two files(b3)
./rms_max_diff cmd args filename1 name2 precision(24)
make clean
make CPU=gcc EXTRA_CFLAGS=-DEXCLUDE_HIFI2_LBR
make clean all EXTRA_CFLAGS=--save-temps
make
>& dump.txt &
********************************************************************************
*********
FERRET check:
make clean all DEBUG=1
xt-gdb
target sim --client_cmds=ferret --nosummary --mem_model
file xa_dts_m6_test
r filename : r HD01-MIPS-4424-1152k-51.dtshd
c
c
c
bt - back trace
break filename:linenum
********************************************************************************
*********
stack measurement:
1. check MEASURE_STACK support
2. Define MEASURE_STACK and build lib and application.
3. Execute following command.
xt-run --turbo --client_commands=stackuse xa_mp3_dec_test -ifile:l2-fl11.mp2
-ofile:now.wav
[xt-run --turbo --client_commands=stackuse <DUT application>]
4. We get following output prints.
Stack Position Before Execute call : 0x43ff94d0
Stack Ranges
-----------------------[0x43ff9330..0x43ffff80] 27728 bytes
5. Stack used by DUT library is computed as follows.
Stack use = (Stack position Before Execute call) - (lowest stack position)
= 0x43ff94d0 - 0x43ff9330
= 0x1a0
= 416 byt
es.
********************************************************************************
*********
To copy from p4 to windows:
PSCP -r (bprakash@spiti:path) (destination_path)
********************************************************************************
*********

add -keep to compile option to generate .s


********************************************************************************
*********
cat
xargs
-Ivar
********************************************************************************
*********
Pragma
#pragma loop_count min=<level>, max=<level>, factor=<level>, avg=<level>
for this loop you can just use #pragma loop_count factor=8
********************************************************************************
*********
processors - dsp
http://www.slideshare.net/fcharlot/digital-signal-processor-evolution-over-the-l
ast-30-years
********************************************************************************
*********
dump objects
xt-objdump -S -t -D binary_name
xt-objdump -S -t -D ./objs/*.o - to check which object has data section
full assembly : xt-nm .a | grep 'U'
xt-objdump ./objs/ss_src.o -s -t -D >>tmp.txt
********************************************************************************
*********
trimming: ftrim
hexdump -C 48-256kbps-ChID51.dtshd > dmp
fdetpattrn 48-256kbps-ChID51.dtshd 64582025 32
ftrim 48-256kbps-ChID51.dtshd trim.dtshd 0 8192
********************************************************************************
********
Cycles calculation:
#include <xtensa/tie/xt_hifi2.h>
#include <sys/times.h>
struct tms full_timestart, full_timestop;
times(&full_timestart);
times(&full_timestop);
clock_t full_cycles = full_timestop.tms_utime - full_timestart.tms_utime;
********************************************************************************
********
cmake:
cmake -G "Visual Studio 9 2008" -DBUILD=MSVS ..\sdk-dts-m8-src
cmake -G "Visual Studio 9 2008" -DBUILD=MSVS ..\sdk-dts-m6-src
********************************************************************************
********
p4 client

vi .p4env
********************************************************************************
********
xt-run --mem_model --dcline=64 --icline=64 --wbsize=8 --dcsize=16k --icsize=8k -read_delay=200 --write_delay=200 --prefetch=0x44
xt-run --mem_model --dcline=64 --icline=64 --wbsize=8 --dcsize=16k --icsize=8k -read_delay=200 --write_delay=200 --prefetch=0x88
xt-run --mem_model --prefetch=0x44 --wbsize=16 --dcsize=32K --icsize=8K --dcline
=128 --icline=128 --dcways=2 --icways=2 --read_delay=225
xt-run --mem_model --prefetch=0x88 --wbsize=16 --dcsize=32K --icsize=8K --dcline
=128 --icline=128 --dcways=2 --icways=2 --read_delay=225
xt-run --mem_model --prefetch=0x44 --wbsize=16 --dcline=128 --icline=128 --dcway
s=4 --icways=2 --dcsize=32k --icsize=8k --read_delay=200 --write_delay=200
xt-run --mem_model --prefetch=0x88 --wbsize=16 --dcline=128 --icline=128 --dcway
s=4 --icways=2 --dcsize=32k --icsize=8k --read_delay=200 --write_delay=200
icsize = instruction cache
dcsize = data cache size
dcline =
icline =
wbsize =
prefetch =
xt-run --mem_model --icsize=16K --dcsize=64K --icways=2 --dcways=2 --dcline=64 -icline=64 --read_delay=200 --write_delay=20 --prefetch=0x44 xa_dts_m8_test LL_
Stream_5_1_192kHz_22Mbps_Peak.dtshd -frames=100
********************************************************************************
*********
Finding float variables:
xt-nm library name | grep 'U'
It gives you float list
then xt-objdump -s -t -D exe name > dump_obj
search those functions : it will show you from which function those are called
********************************************************************************
*********
Create source list in packaging
find . -name "*.[c,cpp,h]"
find . -name "*.cpp" >> file_list
%s/\.c\n/\.c ::\r/g
%s/\.cpp\n/\.cpp ::\r/g
%s/\.h\n/\.h ::\r/g
********************************************************************************
*********
HQ server:
dts path : fac/vol6/dts
********************************************************************************
*********
\\vlpune-samba2\downloads\ide\INSTALLABLES\XPLORER
C:\usr\xtensa\XtDevTools\install\builds\RF-2014.1-win32\hifi3_bd5\html\ISA\ISAht
mlprotos.html
********************************************************************************
*********

icache analysis
pre_build:
$(MAKE) -f makefile_ms12_lib all install EXTRA_CFLAGS="-mtext-section-literals ffunction-sections" NOSTRIP=1
$(MAKE) -f makefile_ms12_test all ROOTDIR=.. TESTDIR=test EXTRA_CFLAGS="-mtext-s
ection-literals -ffunction-sections" EXTRA_LDFLAGS="-Wl,--xt-map"
xt-link-order -e xa_evs_enc_test -g gmon.out.cyc -g gmon.out.icmiss -o swb_enc_i
cache_sec_order.txt
xt-link-order -e xa_evs_dec_test -g gmon.out.cyc -g gmon.out.icmiss -o swb_dec_i
cache_sec_order.txt
post_build:
$(MAKE) -f makefile_ms12_lib all install EXTRA_CFLAGS="-mtext-section-literals ffunction-sections" NOSTRIP=1
$(MAKE) -f makefile_ms12_test all ROOTDIR=.. TESTDIR=test EXTRA_CFLAGS="-mtext-s
ection-literals -ffunction-sections" EXTRA_LDFLAGS="-Wl,--sections-placement=ord
er_file.txt"
different memmap file : xmm file change
post_build:
$(MAKE) -j8 -f makefile_evs_codec_lib_hf3 all install EXTRA_CFLAGS="-mte
xt-section-literals -ffunction-sections" NOSTRIP=1
$(MAKE) -f makefile_evs_codec_enc_test all EXTRA_CFLAGS="-mtext-sectionliterals -ffunction-sections" EXTRA_LDFLAGS="-mlsp=/home/bhanup/mylsp/ -Wl,--sec
tions-placement=swb_enc_icache_sec_order.txt,-Map=enc.map"
$(MAKE) -f makefile_evs_codec_dec_test all EXTRA_CFLAGS="-mtext-sectionliterals -ffunction-sections" EXTRA_LDFLAGS="-mlsp=/home/bhanup/mylsp/ -Wl,--sec
tions-placement=swb_dec_icache_sec_order.txt,-Map=dec.map"
Eg:
prebuild:
$(MAKE) -f makefile_$(CODEC_NAME)_lib install -j8 EXTRA_CFLAGS="-mtext-section-l
iterals -ffunction-sections" NOSTRIP=1
$(MAKE) -f makefile_testbench_sample all EXTRA_CFLAGS="-mtext-section-literals ffunction-sections" EXTRA_LDFLAGS="-Wl,--xt-map"
post_build:
$(MAKE) -f makefile_$(CODEC_NAME)_lib install -j8 EXTRA_CFLAGS="-mtext-secti
on-literals -ffunction-sections" NOSTRIP=1
$(MAKE) -f makefile_testbench_sample evs_enc EXTRA_CFLAGS="-mtext-sectio
n-literals -ffunction-sections" EXTRA_LDFLAGS="-Wl,--sections-placement=<enc>.tx
t,-Map=enc.map"
$(MAKE) -f makefile_testbench_sample evs_dec EXTRA_CFLAGS="-mtext-sectio
n-literals -ffunction-sections" EXTRA_LDFLAGS="-Wl,--sections-placement=<dec>.tx
t,-Map=dec.map"
********************************************************************************
*********
Changing mem config (LSP)
/home/bhanup/mylsp
//not required - cp -r \xtensa\XtDevTools\install\builds\RF-2015.2-win32\HiFi3_K
3V6_LX6\xtensa-elf\lib\sim\ .
cd /home/bhanup/mylsp/
"xt-regenlsps -mlsp=min-rt -b ." or "xt-regenlsps -mlsp=sim -b ." //depends on d
irectory
update memmap.xmm //move the sections which you want to move to other sections
\
"xt-genldscripts -b ."

In make file:
For xt-xcc : EXTRA_LDFLAGS +=-mlsp=/home/bhanup/mylsp/
For xt-ld : "-Wl,--multilib-dir /home/bhanup/mylsp/"
//this is not working fo
r me
check map file generates in build or build/obj folder... to see where stack, ira
m and dram goes into
xt-xcc -mlsp=min-rt --print-lsp
********************************************************************************
*********
move function to iram:
extern void func(void)__attribute__((section(".iram0.text")));
move global variable to dram
int __attribute__((section(".dram1.data"))) globvar;
********************************************************************************
*********
Ferret Line Number Identify:
xt-addr2line -e testdriver-HF4integrIThc-Xtensa-release -f 0x600677fe
********************************************************************************
*********
Alignment definition:
#ifdef WIN32
#define __attribute__(x)
#define ALIGN(x) _declspec(align(x))
#else
#define __declspec(x)
#define ALIGN(x) __attribute__((aligned(x)))
#endif
********************************************************************************
*********
path: common docs
/servers/scratch50/bhanup/projects/dev/hf2/tie/common/doc
********************************************************************************
*********
Packing:
./packscript pg=
./packscript
efile system
./packscript ws
nsa solution

: copy PG
: Create tgz - one for lib and one for testbench, create mak
: Create XWS - one for lib and one for testbench, create xte

projects/dev/hf2/tie/common/doc/how2pack_xws.txt
********************************************************************************
*********
trace:
//#include <xtensa/sim.h>
Add to command line : --client_cmds="trace --level=0 trace.log"

//xt_iss_trace_level(5);
//xt_iss_trace_level(0);
It will create log, where you can find data misses
********************************************************************************
*********
Optimization level specific to funciton:
__attribute__((optimize ("-Os")))
********************************************************************************
*********
How to Find Unused Functions and Variables
1.
Compile the library as follows (change codec library makefile)- Add in CFLAGS -ipa as a compile option
- Add the following line as link option :
-ipalib -ipaentry=<function_entry_point_name> -ipaentry= -Wj,-tt19:0x1
where
means list all entry points to library.
(Note: use xt-xcc not xt-ld for linking)
(Note: this is to link the library, not the testbench)
2.
Make sure there is no space between -Wj and tt19:0x1 they should only be
separated by ','(comma)
3.
The compiler generates a file <library_name>.o.ipa.t in the same directo
ry where the binary (.o) is generated
4.
Inside the file, look for Dead Function elimination. Ignore the lines t
hat are suffixed with a long number (e.g. extract_h..B_1406483683). These are i
nline functions that always get deleted anyway. All the remainder functions can
be deleted.
5.
Look for Global Variable Optimization begin. In the following lines loo
k for "is marked NOT USED". These are unused variables.
6.
This method only works well for c
code. Do not use this for c++ code.
7.
Example voice codec: Voice code has multiple library entry points.
link option look like:
$(GSMEFROBJ): $(COMOBJS) $(DECOBJS) $(ENCOBJS)
$(CC) -o $@ $^ --no-standard-libraries \
-ipalib -ipaentry=xa_gsmefr_enc -ipaentry=xa_gsmefr_enc_init
\
-ipaentry=xa_gsmefr_dec -ipaentry=xa_gsmefr_dec_init \
-ipaentry=xa_gsmefr_enc_get_handle_byte_size \
-ipaentry=xa_gsmefr_enc_get_scratch_byte_size \
-ipaentry=xa_gsmefr_dec_get_handle_byte_size \
-ipaentry=xa_gsmefr_dec_get_scratch_byte_size \
-ipaentry=xa_gsmefr_get_lib_name_string \
-ipaentry=xa_gsmefr_get_lib_version_string \
-ipaentry=xa_gsmefr_get_lib_api_version_string \
-Wj,-tt19:0x1
$(OBJCOPY) --keep-global-symbols=$(SYMFILE) $@ $(TEMPOBJ)
$(OBJCOPY) --strip-unneeded $(TEMPOBJ) $@
$(RM) $(TEMPOBJ)
********************************************************************************
******
Cross COmpile hifi2 on hifi3:
If HiFi-2 code is required to be changed for HiFi-3 processor then,
Firstly, make sure to include following header file in corresponding c/c++ file.
#include <xtensa/config/core.h>
Following #defines can be used to isolate HiFi-2 and HiFi-3 codes.
#if XCHAL_HAVE_HIFI2 If code is to be compiled for HiFi-2
#if XCHAL_HAVE_HIFI3 If code is to be compiled for HiFi-3
Note: Never use above defines using #ifdef.
********************************************************************************

******

You might also like