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

How to add user defined function in 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