首先遇到問題:
board.c:127: error: inline function 'coloured_LED_init' cannot be declared weak
board.c:129: error: inline function 'red_LED_on' cannot be declared weak
board.c:131: error: inline function 'red_LED_off' cannot be declared weak
board.c:133: error: inline function 'green_LED_on' cannot be declared weak
board.c:135: error: inline function 'green_LED_off' cannot be declared weak
board.c:137: error: inline function 'yellow_LED_on' cannot be declared weak
board.c:139: error: inline function 'yellow_LED_off' cannot be declared weak
board.c:141: error: inline function 'blue_LED_on' cannot be declared weak
board.c:143: error: inline function 'blue_LED_off' cannot be declared weak
make[1]: *** [board.o] 錯誤 1
make[1]: Leaving directory `/root/workspace/u-boot-2009.08/lib_arm'
make: *** [lib_arm/libarm.a] 錯誤 2
[root@localhost u-boot-2009.08]#
出現錯誤,內嵌函數不能被聲明爲weak屬性,打開lib_arm/board.c,定位到127行開始,將其註釋掉,修改後結果如下:
void inline __coloured_LED_init (void) {}
//void inline coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
void inline __red_LED_on (void) {}
//void inline red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
void inline __red_LED_off(void) {}
//void inline red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
void inline __green_LED_on(void) {}
//void inline green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
void inline __green_LED_off(void) {}
//void inline green_LED_off(void)__attribute__((weak, alias("__green_LED_off")));
void inline __yellow_LED_on(void) {}
//void inline yellow_LED_on(void)__attribute__((weak, alias("__yellow_LED_on")));
void inline __yellow_LED_off(void) {}
//void inline yellow_LED_off(void)__attribute__((weak, alias("__yellow_LED_off")));
void inline __blue_LED_on(void) {}
//void inline blue_LED_on(void)__attribute__((weak, alias("__blue_LED_on")));
void inline __blue_LED_off(void) {}
//void inline blue_LED_off(void)__attribute__((weak, alias("__blue_LED_off")));
隨後又出現以下問題:
main.c:1: warning: target CPU does not support interworking
main.c:51: error: inline function 'show_boot_progress' cannot be declared weak
make[1]: *** [main.o] 錯誤 1
make[1]:正在離開目錄 `/root/workspace/u-boot-2009.08/common'
make: *** [common/libcommon.a] 錯誤 2
同理,將u-boot-2009.08/common/main.c,定位到51行,註釋掉,修改結果如下:
void inline __show_boot_progress (int val) {}
//void inline show_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
問題還真是多:
cpu/arm920t/start.o: In function `start_code':
/root/workspace/u-boot-2009.08/cpu/arm920t/start.S:117: undefined reference to `coloured_LED_init'
/root/workspace/u-boot-2009.08/cpu/arm920t/start.S:118: undefined reference to `red_LED_on'
make: *** [u-boot] 錯誤 1
出現錯誤coloured_LED_init'未定義。打開cpu/arm920t/start.S,搜索“coloured_LED_init”定位到117行,找到如下代碼:
bl coloured_LED_init
bl red_LED_on
將其註釋掉
//這兩行是AT91RM9200DK開發板的LED初始化,註釋掉
//bl coloured_LED_init
//bl red_LED_on
重新編譯
make distclean
make CROSS_COMPILE=arm-linux-