页次: 1
#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include <time.h>
int main (void)
{
long ms; // Milliseconds
struct timespec spec;
clock_gettime(CLOCK_REALTIME, &spec);
ms = spec.tv_sec*1e3 + spec.tv_nsec/1e6;
printf("sec=%ld, nsec=%ld, t=%ld\n", spec.tv_sec, spec.tv_nsec, ms);
return 0;
}
运行结果:
sec=1553072747, nsec=210361207, t=1553072747210
sec=1553072747, nsec=922195774, t=1553072747922
sec=1553072748, nsec=530646955, t=1553072748530
发现根本不引导Linux
Environment size: 4297/32764 bytes
=> sf probe 0; sf read 0x41800000 0x100000 0x10000; sf read 0x41000000 0x110000 0x600000; bootz 0x41000000 - 0x41800000
Unknown command 'sf' - try 'help'
Unknown command 'sf' - try 'help'
Unknown command 'sf' - try 'help'
=>
貌似不支持sf命令,去看看是不是编译sf编译开关没开启。
我是一步一步按照这个做的:
https://www.kancloud.cn/lichee/lpi0/331844准备uboot
下载包含spi驱动的体验版本uboot,该驱动目前尚未合并到主线
git clone -b v3s-spi-experimental https://github.com/Lichee-Pi/u-boot.git
执行make ARCH=arm menuconfig打开uboot菜单配置,进入到Device Drivers > SPI Flash Support
注意看一下自己flash的厂家名称,例如选上Macronix SPI flash support用来支持我测试用的flash:MX25L12873F。上面这些步骤都做好了.然后:
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make LicheePi_Zero_800x480LCD_defconfig
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make menuconfig
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j3烧录:
sudo sunxi-fel -p spiflash-write 0 u-boot-sunxi-with-spl.bin
上电后串口终端输出这个错误:
U-Boot SPL 2017.01-rc2-00056-ga297a99 (Oct 06 2017 - 11:37:04)
DRAM: 64 MiB
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
我记得
文章中漏写了几部
页次: 1