2013年12月30日 星期一

AWTK framebuffer gui

Refer to
https://github.com/zlgopen/awtk-linux-fb
https://www.zlg.cn/index/pub/awtk.html

1.
apt install scons
###if you want to debug SCons###
pip3 install SCons

2.
~~~AWTK source code only 264.2MB 
mkdir -p gui
cd gui
git clone https://github.com/zlgopen/awtk.git
git clone https://github.com/zlgopen/awtk-examples.git
git clone https://github.com/zlgopen/awtk-linux-fb.git

3.
cd awtk-linux-fb
gedit ./awtk_config.py
#for prebuild tslib
#TSLIB_LIB_DIR='/opt/28x/tslib/lib' #by stone
#TSLIB_INC_DIR='/opt/28x/tslib/include'
#TOOLS_PREFIX='/opt/28x/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-linux-'
TSLIB_LIB_DIR=''
TSLIB_INC_DIR=''
TOOLS_PREFIX='/opt/ivot/aarch64-ca53-linux-gnueabihf-8.4/bin/aarch64-ca53-linux-gnu-'
#TOOLS_PREFIX='/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-'
#for qemu
#TOOLS_PREFIX='/opt/qemu/buildroot-2021.02.2/output/host/bin/arm-linux-'
#TSLIB_LIB_DIR=''

note: here is no touch panel using so we fill empy
TSLIB_LIB_DIR=''
TSLIB_INC_DIR=''

4.
gedit ./awtk-port/main_loop_linux.c
#define FB_DEVICE_FILENAME "/dev/fb0"
~my target output is fb1 so change to
#define FB_DEVICE_FILENAME "/dev/fb1"

5.
gedit ./awtk-port/lcd_linux/lcd_linux_fb.c
#define __FB_WAIT_VSYNC    1
~my target do not need vsync so change to
#define __FB_WAIT_VSYNC    0

6.
gedit ./SConstruct
env = DefaultEnvironment(
ENV = os.environ, #########add this by stone#########
CCFLAGS = awtk.CCFLAGS + APP_CCFLAGS,
CFLAGS = awtk.CFLAGS,
CC=awtk.CC,
CXX=awtk.CXX,
LD=awtk.LD,
AR=awtk.AR,
RANLIB=awtk.RANLIB,
STRIP=awtk.STRIP,
LIBS = awtk.LIBS,
LIBPATH = awtk.LIBPATH,
CPPPATH = awtk.CPPPATH + [awtk.joinPath(awtk.TK_ROOT, 'res')],
LINKFLAGS = awtk.LINKFLAGS,
OS_SUBSYSTEM_CONSOLE=awtk.OS_SUBSYSTEM_CONSOLE,
OS_SUBSYSTEM_WINDOWS=awtk.OS_SUBSYSTEM_WINDOWS
)

7.
CPU_NUM=$(grep processor /proc/cpuinfo | awk '{field=$NF};END{print field+1}')
echo "CPU number = "$CPU_NUM
export PATH=$PATH:/opt/ivot/aarch64-ca53-linux-gnueabihf-8.4.01/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ivot/aarch64-ca53-linux-gnueabihf-8.4.01/lib
scons -j$CPU_NUM
./release.sh

8.
cd release
tar zcvf release.tar.gz assets bin
~copy release.tar.gz to target
tar -xvf release.tar.gz
cd bin
./demoui

9. gdb debugging (option)
gedit ./awtk_config.py
OS_FLAGS='-Wall -Os -fno-strict-aliasing '
~change to
OS_FLAGS='-Wall -fno-strict-aliasing '

gedit ./SConstruct
env = DefaultEnvironment(
  ENV = os.environ,
  CCFLAGS = awtk.CCFLAGS + APP_CCFLAGS + ' -O0 -g', ######add this by stone
  CFLAGS = awtk.CFLAGS + ' -O0 -g',                                    ######add this by stone
  CC=awtk.CC,
  CXX=awtk.CXX,
  LD=awtk.LD,
  AR=awtk.AR,
  RANLIB=awtk.RANLIB,
  STRIP=awtk.STRIP,
  LIBS = awtk.LIBS,
  LIBPATH = awtk.LIBPATH,
  CPPPATH = awtk.CPPPATH + [awtk.joinPath(awtk.TK_ROOT, 'res')],
  LINKFLAGS = awtk.LINKFLAGS,
  OS_SUBSYSTEM_CONSOLE=awtk.OS_SUBSYSTEM_CONSOLE,
  OS_SUBSYSTEM_WINDOWS=awtk.OS_SUBSYSTEM_WINDOWS
)

check Makefile
CFLAGS add -O0 -g
STRIP is disable

10.
~in target
root@NVTEVM:~/release/bin$ arm-ca9-linux-gnueabihf-gdbserver :5039 ./demoui

~in x86 pc
(gdb) target remote 192.168.0.4:5039

11. IDE debugging (option)
http://fatalfeel.blogspot.com/2017/08/android-eclipse-debug-jni-of-system-app.html

12. scons compile debug
preinstall pycharm
export PATH=$PATH:/opt/ivot/aarch64-ca53-linux-gnueabihf-8.4.01/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ivot/aarch64-ca53-linux-gnueabihf-8.4.01/lib
/opt/pycharm-2019.2.6/bin/pycharm.sh
run -> edit configurations -> templates -> python -> add new configurations
script path: /usr/bin/scons
parameters: -j8
working directory: /root/awtk-linux-fb
ok

Debug demo:
https://www.mediafire.com/view/fejwgj5bkvoozxy/scons_debug00.png/file
https://www.mediafire.com/view/jxh3f0cy5bt4wxj/scons_debug01.png/file
https://www.mediafire.com/view/hgmrz0yd5ohdglz/scons_debug02.png/file

Download:
https://www.mediafire.com/file/z70c4gr4c8lapaj/nt98xxx_gdb_server.sh
https://www.mediafire.com/file/7ji7j4rldzddpzt/nt98336_gdb_server.sh
https://www.mediafire.com/file/rgjoug7ry45nrv2/gdb-nt98323.cmds
https://www.mediafire.com/file/uvnj8jpxmb5u74v/gdb-nt98336.cmds
https://www.mediafire.com/file/5688y4asdxxuu1k/awtk_main.inc

Demo: when run demoui that fps is 46 on arm64
https://www.mediafire.com/view/nbqx3bc61wi8r2q/awtk_demoui.jpg
https://www.mediafire.com/view/m92h31jepa7iaou/awtk_debug.png

Video:
https://drive.google.com/file/d/1eYVxClv52OoqP4bou9zGZsaywkw1DZwz

沒有留言:

張貼留言