搜尋此網誌

2014年6月18日 星期三

RealView compiler setting

Optimize for [Space]: Base on Code size, [Time]: Base on Performance.

Optimization Level:
  • [0(minimum optimization, best debug view)]
  • [1(restricted optimization, good debug view)]
  • [2(high optimization, restricted debug view)]
  • [3(maximum optimization, restricted debug view)]


Equivalent Command Line: You can add your own parameter over here, for example: -Dtest_flag.

2014年6月11日 星期三

The samples are for building an embedded linux/u-boot.

/******XDB commands******/
# -target override=ap:1,debug:0xe0501000 NORESET
# set reg pc=0x100000

/******u-boot commands******/
# printenv
# setenv baudrate 115200
# setenv bootargs bootm 0xff810000
# setenv bootcmd bootm 0xff820000

# setenv bootdelay 3
# setenv ethact armd-fec0
# setenv ethaddr 00:09:01:07:06:05
# setenv fileaddr 1000000
# setenv filesize 6a1d58
# setenv ipaddr 10.19.120.80
# setenv remp 2
# setenv serverip 10.19.120.79
# setenv stderr serial
# setenv stdin serial
# setenv stdout serial
# setenv bootargs console=ttyS0,115200 coherent_pool=4m
# saveenv
# printenv

# setenv ethaddr 00:09:01:07:06:05

# setenv fileaddr 1000000
# setenv filesize 6a1d58
# setenv ipaddr 10.19.120.80
# setenv serverip 10.19.120.79
# setenv remp 2
# setenv bootcmd bootm 0xff820000
# saveenv

# mw 0x2000000 0 1000;nfs 0x2000000 10.19.132.171:/home/hayden/rootfs/boot/uImage
# setenv bootargs console=ttyS0,115200 earlyprintk=ttyS0 root=/dev/nfs rw nfsroot=10.19.132.171:/home/hayden/rootfs ip=dhcp; bootm 0x2000000

# mw 0x2000000 0 1000;nfs 0x2000000 10.19.132.171:/home/hayden/rootfs/boot/uImage
# setenv bootargs console=ttyS0,115200 earlyprintk=ttyS0 root=/dev/nfs rw nfsroot=10.19.132.171:/home/hayden/rootfs pm_disable ip=10.19.128.114:10.19.132.171:10.19.128.1:255.255.254.0:dpnfs:eth0:off; bootm 0x2000000

# setenv bootargs console=ttyS0,115200 coherent_pool=4m

/*Disable Autoload from Flash or TFTP Server*/
# setenv serverip 192.168.132.22
# setenv autoload n
# setenv bootargs "console=ttyS0,115200 earlyprintk=ttyS0 root=/dev/nfs rw nfsroot=${serverip}:/home/username/nfs,proto=tcp ip=dhcp"
# setenv bootcmd "dhcp;mw 0x1000000 0 1000;nfs 0x1000000 ${serverip}:/home/username/nfs/uImage;bootm 0x1000000"
# saveenv

/******Flash Kernel uImage******/
# tftp 1000000 uImage
# protect off ff820000 +780000
# fli
# erase ff820000 +780000
# cp.b 1000000 ff820000 780000

/******DD I/O test utility******/
〉 dd if=/dev/sda of=/dev/null bs=64k count=16384
〉 dd if=/dev/zero of=/dev/sda bs=64k count=16384

〉 dd if=/dev/sda of=/dev/null bs=128k count=16384
〉 dd if=/dev/zero of=/dev/sda bs=128k count=16384

〉 dd if=/dev/sda of=/dev/null bs=1M count=1024
〉 dd if=/dev/zero of=/dev/sda bs=1M count=1024

/******FIO I/O test utility******/
〉 fio --ioengine=libaio --iodepth=1 --prio=0 --numjobs=1 --rw=read --fadvise_hint=0 --bs=4K --bwavgtime=10 --runtime=60  --direct=1 --name=/dev/sdb --name=/dev/sdc

*--rw=read / write / randread / randwrite

/******Verify memory copy for CPU******/
〉 dd if=/dev/zero of=/dev/null bs=1M count=1024

/******Check CPU Cores on Linux******/
# cat /proc/cpuinfo
# less /proc/cpuinfo

# sudo apt-get install lscpu
# lscpu /*display information on cpu architecture.*/

# nproc /*show current CPU number.*/

# task "/proc/cpuinfo file - collection of cpu and system architecture items."
# less /proc/cpuinfo
# grep -i vendor /proc/cpuinfo | uniq
# grep -i --color "model name" /proc/cpuinfo
# grep -i --color "model name" /proc/cpuinfo | sort
# grep -i --color "model name" /proc/cpuinfo | uniq
# whatis lscpu
# lscpu
# man lscpu ### for more info type this ###

/******Assigned CPU IRQ******/
echo yy > proc/irq/xx/smp_affinity

〉 echo 2 > proc/irq/95/smp_affinity
CPU 0/1/2/3 map to 1/2/4/8

/******Check CPU utilization******/
/*Top command to find out Linux cpu usage, Type the top command:*/
# top

/*Find Linux CPU utilization using mpstat and other tools*/
# apt-get install sysstat
# up2date sysstat
# mpstat
# mpstat -P ALL

/*Report CPU utilization using sar command*/
# sar
# sar -u 2 5
# sar -o output.file 12 8 >/dev/null 2>&1 &
# nohup sar -o output.file 12 8 >/dev/null 2>&1 &
# sar -f data.file

/*Task: Find out who is monopolizing or eating the CPUs*/
# ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
# ps -eo pcpu,pid,user,args | sort -r -k1 | less

/*iostat command*/
# iostat
$ iostat -xtc 5 3

/*GUI tools for your laptops/desktops*/
$ gnome-system-monitor

/******Message dump******/
# dmesg -C /*--read-clear: clear the ring buffer contect after printing.*/
# dmesg -c /*--clear: clear the ring buffer.*/
# cat /var/log/syslog /*Dump system log.*/
# syslogd /*log systems messages*/
/etc/syslog.conf       /*The configuration file.*/
/var/run/syslog.pid    /*The process id of current syslogd.*/
/dev/log               /*Name of the UNIX domain datagram log socket.*/
/dev/klog, /proc/kmsg  /*The kernel log device.*/
# apt-get install sysklogd
# logger /*a shell command interface to the syslog(3) system log module.*/

/******tftpd-hpa TFTP server installation******/
$ sudo apt-get install tftpd-hpa
# apt-get install tftpd-hpa
# vi /ect/default/tftpd-hpa
TFTP_USERNAME="tftp"
TETP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"

# service tftpd-hpa status
# service tftpd-hpa stop
# service tftpd-hpa start
# service tftpd-hpa restart
# service tftpd-hpa force-reload

/******How do I test my tftpd server?******/
$ sudo apt-get install tftp
# apt-get install tftp
$ tftp tftp-server-ip-here
$ tftp 10.15.132.32
tftp〉 status
tftp〉 get "file name"
tftp〉 quit

/******About load/unload drivers or check driver info******/
# lsmod /*list loaded modules.*/
# insmod "driver name" /*install loadable kernel module*/
# rmmod "module name" /*unload loadable modules*/
# modprobe /*high level handling of loadable modules*/
# depmod /*handle dependency descriptions for loadable kernel modules*/
# modinfo /*display information about a kernel module*/
# ksyms /*display exported kernel symbols*/
# vi /etc/modules.conf /*configuration file for loading kernel modules*/

/******Dump PCI Configuration space******/
/******Dump PCI Configuration space******/
$ lspci -s 04:00.0 -xxxx -v

/* lspci is the standard tool to query the devices connected to any PCI compatible bus. Type “lspci --help” for more details. */
$ lspci –v
$ lspci -x

/* To list vendor and device IDs */
$ cat /proc/bus/pci/devices

/* To access the PCI resources on platform */
$ cat /sys/devices/pci0000:00

/******Shutdown system commands******/
# shutdown -h now /*The system is going down for halt NOW.*/
# shutdown -r now /*The system is going down for reboot NOW.*/
# shutdown -h now 'System is going down for replacement of primary memory'
# shutdown -h 20:00 /*The system is going down for halt in 573 minutes.*/
# shutdown -r 20:00 /*The system is going down for reboot in 573 minutes.*/
# shutdown -c /*Cancel a running shutdown*/
# reboot
# init

/******Samba Server setup******/
# sudo apt-get install samba
# vi /etc/samba/smb.conf
/*Create a new section at the bottom of the file, or uncomment one of the examples, for the directory to be shared*/
[share]
    comment = Ubuntu File Server Share
    path = /srv/samba/share
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755

# sudo mkdir -p /srv/samba/share
# sudo chown nobody.nogroup /srv/samba/share/   /*change file owner and group*/
# sudo restart smbd
# sudo restart nmbd