Search code examples
clinuxembeddedembedded-linuxu-boot

How to add user defined function in U-Boot?


Here i just want to add one function in u-boot. I need to call one function in start_armboot(). For example,

This is hell.h header file.

extern void hello(void);

This is hell.c file.

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

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

This hell.c is added into the common folder,and hell.h is added into the include folder. And then i include this hell.h into lib_arm/board.c. Finally i called hello() function from start_armboot() in lib_arm/board.c. Whenever i compiling it will show the error.

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

Is there any other procedure to add function in u-boot other than this? please help me out.


Solution

  • You must modify the makefile inside common folder.

    You can simply add

    obj-y += hell.o