c - 如何在 U-Boot 中添加用户自定义函数?

标签 c linux embedded embedded-linux u-boot

这里我只想在u-boot中添加一个功能。我需要在 start_armboot() 中调用一个函数。例如,

这是 hell.h 头文件。

extern void hello(void);

这是 hell.c 文件。

#include<stdio.h>
    #include<hell.h>

void hello(void)
{
    printf("Hello world");
}

这个hell.c添加到common文件夹,hell.h添加到include文件夹。然后我将这个 hell.h 包含到 lib_arm/board.c 中。最后,我从 lib_arm/board.c 中的 start_armboot() 调用了 hello() 函数。每当我编译它都会显示错误。

lib_arm/libarm.a(board.o): In function `start_armboot':
/home/davinci-evm/U-Boot/lib_arm/board.c:389: undefined reference to `hello'
make: *** [u-boot] Error 1

除此之外,还有其他方法可以在u-boot中添加功能吗?请帮助我。

最佳答案

您必须修改common 文件夹中的makefile。

你可以简单地添加

obj-y += hell.o

关于c - 如何在 U-Boot 中添加用户自定义函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40656073/

相关文章:

C - 从未分配给变量的函数返回的结构

c - C 中的无限循环

c - 替换c中文件中的字符

php - 我怎样才能找出一个进程在 Linux 中运行的是哪个 PHP 脚本?

mysql - 开始使用预编译的mysql,但是得到: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

c - 为什么这个程序通过引用传递参数

转换为函数指针时出现编译器错误

c - 避免重复大小写值的宏

c - 如何实现两次按键中断PIC

linux - 为Beagleboard构建嵌入式QT5