移植linux到zedboard过程中杂项错误总结

本文档详细解析了嵌入式系统开发过程中常见的错误,包括固件加载失败、模块信息读取错误、 printk 参数配置不当、Perl脚本语法错误、Vivado烧写QSPI Flash失败、tty设备打印问题、Source Insight文件类型识别错误、make uImage生成失败等,并提供了详尽的解决策略。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(1)Direct firmware load failed with error -2
查看-2代表的错误码可知,-2代表找不到文件。
固件必须放在/lib/firmware下面。
在driver/base/firmware_class.c文件中定义合法路径。

(2)modinfo: can’t open ‘/lib/modules//modules.dep’: No such file or directory
解决办法:
# depmod
# mv modules.dep.bb modules.dep

(3) printk参数错误。
解决办法:
写成如下定义的标准格式。
#define KERN_EMERG “<0>” /* systemis unusable /
#define KERN_ALERT “<1>” /
actionmust be taken immediately */
#define KERN_CRIT “<2>” /*critical conditions /
#define KERN_ERR “<3>” /
errorconditions /
#define KERN_WARNING “<4>” /
warning conditions /
#define KERN_NOTICE “<5>” /
normalbut significant */
#define KERN_INFO “<6>” /*informational */
#define KERN_DEBUG “<7>” /*debug-level messages */

(4)Can’t use ‘defined(@array)’ (Maybe you should just omit the defined()?)错误。
解决方法:
这里,我们打开 kernel/timeconst.pl
@val = @{KaTeX parse error: Expected '}', got 'EOF' at end of input: canned_values{hz}};
if (!defined(@val)) {
@val = compute_values(KaTeX parse error: Expected 'EOF', got '}' at position 6: hz); }̲ output(hz, @val);
将if (!defined(@val)) 改为if (!(@val)),再次编译就可以通过了。

(5)VIVADO 2017.4烧写QSPI FLASH失败
解决方法:AR#70548 AR#70148
QSPI programming requires the device to boot in JTAG mode, as mentioned by the program_flash output log.

BOOT_MODE REG = 0x00000001
WARNING: [Xicom 50-100] The current boot mode is QSPI.
Starting in 2017.3, programming flash for Zynq-7000 requires that you specify an FSBL
This FSBL is required to initialize the system (mainly to run the ps7_init() function).

If booting in QSPI boot mode, this FSBL will try to load partitions from the flash causing misbehavior of the flash programming.

With the following modification we limit this FSBL (used only for flash programming) to basically only run the initialization (ps7_init()).

Create a new FSBL project and add the following change (main.c) to use it for Flash programming in SDK.
/*

  • Read bootmode register
    */
    BootModeRegister = Xil_In32(BOOT_MODE_REG);
    BootModeRegister &= BOOT_MODES_MASK;
    //add this line to trick boot mode to JTAG
    BootModeRegister = JTAG_MODE;

(6)printf在ttyPS0中不能换行。
解决办法:
回车换行(\r\n):每次光标移到下一行的行首位置处,然后再换行停到之前的column。由于之前的column就是行首,所以换行后,光标在行首。

(7)SI中无法高亮S文件。
解决办法:
点击Option->Syntax Formatting->File Types->C Source File,可以看到在File filter下面只显示了*.c;.h,这时,我们加上.s;.S,然后点击Close,
点击Option->Syntax Formatting->File Types->x86 ASM Source File,可以看到在File filter下面只显示了
.asm;.inc,这时,我们加上.s;*.S,然后点击Close,

(8) SI无法显示全路径
解决办法:
Options->Preferences->Display,
不选 “Trim long path names with ellipses”

(9)__devexit_p() implicit declared
解决办法:
找include/linux/init.h中,找到相关定义,改成合法的定义。

(10)make uImage无法生成,地址无效
解决办法:
在/arch/arm/boot/Makefile中,定义
LOADADDR=00008000

注意:ARM启动时的几个关键地址
ZTEXTADDR
解压代码运行的开始地址。没有物理地址和虚拟地址之分,因为此时MMU处于关闭状态。这个地址不一定时RAM的地址,可以是支持读写寻址的flash等存储中介。
在arch/arm/boot/compressed/Makefile中说的很明确
ZRELADDR
内核启动在RAM中的地址。压缩的内核映像被解压到这个地址,然后执行。
一般定义在mach-zynq目录下
在arch/arm/boot/Makefile中被赋值:
ZRELADDR := $(zreladdr-y)
PARAMS_PHYS := $(params_phys-y)
INITRD_PHYS := $(initrd_phys-y)
如果没有在代码中指定zreladdr-y,也可以在编译的命令行中指定LOADADDR来确定内核加载的实际物理地址。
TEXTADDR
内核启动的虚拟地址,与ZRELADDR相对应。一般内核启动的虚拟地址为RAM的第一个bank地址加上0x8000。
TEXTADDR = PAGE_OFFSET + TEXTOFFST
TEXTOFFSET
内核偏移地址。在arch/arm/makefile中设定。
PHYS_OFFSET
RAM第一个bank的物理起始地址。
PAGE_OFFSET
RAM第一个bank的虚拟起始地址。这个值由make menuconfig进行配置

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值