// 一位工程师写的示例代码
// 向这位工程师致敬!
//
int a = 0; //全局初始化区
int a = 0; //全局初始化区
char *p1; //全局未初始化区
main() {
int b; //栈
char s[] = "abc"; //栈
char *p2; //栈
char *p3 = "123456"; //123456\0在常量区,p3在栈上。
static int c = 0; //全局(静态)初始化区
p1 = (char *)malloc(10);
p2 = (char *)malloc(20);
//分配得来得10和20字节的区域就在堆区。
strcpy(p1, "123456"); //123456\0放在常量区,编译器可能会将它与p3所指向的"123456"优化成一个地方。
}
1 板子通过usb2uart连接到ubuntu虚拟机(可移动设备名称为:Google Salxxxxxx)。
并启动android。
2 虚拟机上首先要安装VMware Tools(否则,会看不到共享文件夹)。
3 启用windows下共享文件夹、
(1)要传输的文件,例如,test.txt
(2)android img文件夹——含adb命令
以上两者均位于该共享文件夹。
1 虚拟机上,进入终端,并进入上述共享文件夹下,或软连接目录。
2 shell下,
$ ./adb root
restarting adbd as root
$ ./adb shell (可以进入板上目录)
salvator:/ # ls
acct dev init.zygote64_32.rc sdcard
bin etc lost+found storage
bugreports init mnt sys
cache init.environ.rc odm system
charger init.rc oem ueventd.rc
config init.recovery.salvator.rc postinstall vendor
d init.usb.configfs.rc proc
data init.usb.rc product
default.prop init.zygote32.rc sbin
salvator:/sdcard/Movies # exit
$ ./adb push /home/titron/test.txt /sdcard/Download
$ ./adb push /home/m3n_imgs/aaa.mp3 /data/media/0/Download
$ ./adb push /home/m3n_imgs/bbb.apk /data/media/0/Download
# 说明:
# 推送到/data/media/0/Download,
# 相当于推送到/sdcard/Download
#
# "/data/media/0"是安卓手机内置存储的真实目录,
# 而"/sdcard"是内置存储被安卓系统挂载的快捷方式(指向"/data/media/0");
# 通常需要存储空间权限的手机app会访问后者,前者需要ROOT权限才能访问,因此这两个文件夹是一个目录
# 有关android内部存储和外部存储,请参看下面的附录连接。
附录:
Mini-Monitor for Third-Generation R-Car Products command Lists:
D - memory Dump
DM - set&disp Dump Mode
F - Fill memory
FL - Fill memory(Long)
FX - Fill memory(Long Long)
M - set Memory(byte)
MW - set Memory(Word)
ML - set Memory(Long)
MX - set Memory(Long Long)
MV - Move memory
RAMCK - RAM read write Check
DDRCK - DDR Memory read write Check
DDRCK_8GB - DDR Memory read write ChecK_8Gbyte
L - load program
G - Go program
LF - load Program to Flash memory
CF - Clear Flash memory
XLS - Load program to SpiFlash or HyperFlash
XLS2 - SpiFlash or HyperFlash address input version of XLS command
XCS - Clear SpiFlash or HyperFlash
XINFO - read SA3 Information
XINFO_S - set SA3 Information
XINFO_SA0 - read SA0 Information
XINFO_SA0_S - set SA0 Information
SUP - Scif speed UP
READ_PMIC - read PMIC Firmware from EEPROM
SET_PMIC - set PMIC Firmware to EEPROM
SET_IIC0 - set IIC0 Slave Address
IIC0_M - set IIC0 memory(BYTE)
SET_I2C0 - set I2C0 Slave Address
I2C0_M - set I2C0 memory(BYTE)
H - Help
Flash writer command Lists:
XLS2 - Write to the S-record format images to the Serial Flash.
XLS3 - Write to the raw binary images to the Serial Flash.
XCS - Erase the Serial Flash.
EM_DCID - Display the CID registers of eMMC.
EM_DCSD - Display the CSD registers of eMMC.
EM_DECSD - Display the EXT_CSD registers of eMMC.
EM_SECSD - Modify the EXT_CSD registers of eMMC.
EM_W - Write to the S-record format images to the user data area of eMMC, and the boot partition of eMMC.
EM_WB - Write to the raw binary images to the user data area of eMMC, and the boot partition of eMMC.
EM_E - Erase the user data area of eMMC, and the boot partition of eMMC.
SUP - Change the SCIF baud rate setting.
H - Display the command help.