开发工具(git/vim/tmux/cmake...)
https://github.com/yilanjueding123/mypdf/blob/master/SingleChip/汇编语言程序设计%2B基于ARM体系结构(经典新版).pdf
https://linux-sunxi.org/images/d/d2/Dw_apb_uart_db.pdf
1、qemu:
如何使用 QEMU 中的虚拟串口:http://blog.sina.com.cn/s/blog_a1e6528101019xmm.html
Versatile Express 开发板手册: http://www.myir-tech.com/download.asp?nid=49
# qemu-arm运行hello world
# 编译
arm-linux-gnueabi-gcc helloworld.c
# 运行
qemu-arm -L /home/hx/tools/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/libc ./a.out
- 内核中通过qemu打印字符:
static int g_imme_count= 0;
static int is_log_char(char ch)
{
if (ch >= 32 || ch == '\n' || ch == '\r' || ch == '\t') {
return 1;
}
return 0;
}
static int is_add_imme_to_r6(unsigned int insn)
{
if (((insn & 0xffefff00) == 0xe2866000) && is_log_char(insn & 0xff)) {
return 1;
}
return 0;
}
static int is_sub_imme_from_r6(unsigned int insn)
{
if (((insn & 0xffefff00) == 0xe2466000) && is_log_char(insn & 0xff)) {
return 1;
}
return 0;
}
static void disas_arm_insn(DisasContext *s, unsigned int insn)
{
...
if (g_imme_count == 1) {
g_imme_count = 0;
if (is_sub_imme_from_r6(insn)) {
fprintf(stderr, "%c\n", insn & 0x7f);
}
}
if (is_add_imme_to_r6(insn)) {
g_imme_count++;
}
...
}
qemu通过u-boot启动linux vexpress-a9:
mkimage -A arm -O linux -T kernel -C none -a 0x60003000 -e 0x60003040 -d arch/arm/boot/zImage uImage
cp uImage /var/lib/tftpboot
cp arch/arm/boot/dts/vexpress-v2p-ca9.dtb /var/lib/tftpboot
qemu-system-arm -M vexpress-a9 -m 256M -kernel ./u-boot -sd ./rootfs.qcow2 -nographic -net nic -net tap,ifname=tap_ci,script=no,downscript=no
setenv ipaddr 192.168.0.101; setenv serverip 192.168.0.100; setenv gatewayip 192.168.0.1; setenv netmask 255.255.255.0; setenv bootargs "root=/dev/mmcblk0 console=ttyAMA0"; saveenv; tftp 0x60003000 uImage; tftp 0x60500000 vexpress-v2p-ca9.dtb; bootm 0x60003000 - 0x60500000
- git-blame插件: https://github.com/zivyangll/git-blame.vim
2、outlook:
//表格中链接换行:
设置文本格式 -> 段落 -> 中文板式 -> 允许西文在单词中间换行
3、ubuntu常用软件:
sudo apt install zsh tmux ripgrep cscope make cmake flex bison libssl-dev libncurses-dev ninja-build pkg-config
sudo apt install libglib2.0-dev libpixman-1-dev
4、docker:
docker stop <ID> # 停止容器
5、git:
# git remote添加另一台机器中的目录
git remote add other ssh://hx@192.168.0.2/home/hx/myrepo
# 指定端口
git remote add other ssh://hx@192.168.0.2:1234/home/hx/myrepo
# 推送所有本地tag到远程
git push origin --tags
# git添加已ignore的文件
git add file.txt -f
7、tmux:
# tmux保存指定窗口中指定窗格的输出到buffer
tmux capture-pane -t 1.1 -S -
# tmux保存指定会话的指定窗口中制定窗格的输出到buffer
tmux capture-pane -t hx:1.1 -S -
# 平铺窗格
tmux select-layout tiled
# 显示窗格编号
tmux display-panes
8、u-boot:
# u-boot启动kernel时报错:
ERROR: can't get kernel image!
setenv ipaddr 192.168.1.13
setenv ethaddr 00:04:9f:04:d2:35
setenv gatewayip 192.168.1.1
setenv netmask 255.255.255.0
setenv serverip 192.168.1.10
setenv bootargs "root=/dev/mmcblk0 rw console=ttyAMA0"
saveenv
ping 192.168.1.10
tftp 0x60003000 uImage
tftp 0x60500000 qemu-arm64.dtb
bootm 0x60003000 - 0x60500000
tftp 0x30008000 uImage
bootm 0x30008000
# qemu-system-aarch64指定的内存为1024M
# u-boot启动kernel时报错:
ERROR: can't get kernel image!
# md命令查看0x60003000处的二进制内容
md 0x60003000
# u-boot 64字节uImage头格式
#define IH_MAGIC 0x27051956 /* Image Magic Number */
#define IH_NMLEN 32 /* Image Name Length */
struct legacy_img_hdr {
uint32_t ih_magic; /* Image Header Magic Number */
uint32_t ih_hcrc; /* Image Header CRC Checksum */
uint32_t ih_time; /* Image Creation Timestamp */
uint32_t ih_size; /* Image Data Size */
uint32_t ih_load; /* Data Load Address */
uint32_t ih_ep; /* Entry Point Address */
uint32_t ih_dcrc; /* Image Data CRC Checksum */
uint8_t ih_os; /* Operating System */
uint8_t ih_arch; /* CPU architecture */
uint8_t ih_type; /* Image Type */
uint8_t ih_comp; /* Compression Type */
uint8_t ih_name[IH_NMLEN]; /* Image Name */
};
=> md 0x60003000
60003000: 56190527 ca60a28f ac4a6b63 8667aa00 '..V..`.ckJ...g.
60003010: 00300060 40300060 502d62aa 00021605 `.0.`.0@.b-P....
60003020: 00000000 00000000 00000000 00000000 ................
60003030: 00000000 00000000 00000000 00000000 ................
60003040: 00088b1f 00000000 9bec0302 5514700f .............p.U
60003050: dd7fc79e 8246493d 849ff212 82026663 ....=IF.....cf..
60003060: 49594f46 d2ea110c bd714133 88c35773 FOYI....3Aq.sW..
60003070: 266dec16 5cca55c4 7f821b95 20e93856 ..m&.U.\....V8.
60003080: bb5b162a 0a7ab4b4 bba24c57 977729da *.[...z.WL...)w.
60003090: 2a330495 ec968032 e085d562 32ee9480 ..3*2...b......2
600030a0: b2557741 90fe48ab f7dcc206 a24c9fcd AwU..H........L.
600030b0: f1bb27f8 54dfbdd4 d7eee87d 9fdfbdef .'.....T}.......
600030c0: fdef7bf7 bb5f743a 8ec8f488 f434d985 .{..:t_.......4.
600030d0: fe24abfb ff9f471d 7b5d5773 75e38ab3 ..$..G..sW]{...u
600030e0: dcdd1257 e7b88f22 5d3954a7 2de7d196 W..."....T9]...-
600030f0: 6881ebe8 aabf4dd9 ac34b9c1 a1e5ce16 ...h.M....4.....
ih_os= 0x05: linux
ih_arch = 0x16 : arm64
ih_type = 0x02 : kernel
ih_comp = 0x00 : none ?
0x00 : gzip
浙公网安备 33010602011771号