I am not familiar with build.sh build flow. I guess uboot source in bpi github has something different from original one (at least config.in in home directory) . I don’t see such problem if use original uboot source with buildroot-gcc492 toolchain (type make menuconfig; make to build uboot image) and uboot partition in below image was also built by this way.
Most users don’t have buildroot-toolchain. Can you please try with ubuntu’s linaro toolchain (gcc6 arm-linux-gnueabihf)?
i have removed buildroot-toolchain from makefile and only call make with linaro-toolchain in my build.sh (also menuconfig) so it’s easier to read.
i tried official repo with 4.4 and 4.19, changed flash-type to SD with make menuconfig before and compiled with build.sh and “make CROSS_COMPILE=arm-linux-gnueabihf-”
all ended up with same error
/media/data_fast/bpi/kernel/BPI-R64-BSP-4.19_official/u-boot-mt/include/configs/mt7622_evb.h:412:45: error: ‘NFI_BASE’ undeclared here (not in a function)
#define CONFIG_SYS_NAND_BASE NFI_BASE
^
drivers/mtd/nand/nand.c:29:37: note: in expansion of macro ‘CONFIG_SYS_NAND_BASE’
#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
^~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/nand.c:52:57: note: in expansion of macro ‘CONFIG_SYS_NAND_BASE_LIST’
static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE] = CONFIG_SYS_NAND_BASE_LIST;
^~~~~~~~~~~~~~~~~~~~~~~~~
which Value should CONFIG_SYS_NAND_BASE/NFI_BASE have for SD-card? i have found 2 diferent definitions for mt7622
i wonder why different toolchain does not show this error…maybe nand-include is missing for SD? these includes are not used or after the mt7622.h
as far as i see the only include of mt7622_evb.h is in ./arch/arm/lib/bootm.c and here is no include to the nand (i guess it’s later in storage-commands)…isn’t it better to define IO_PHYS / NFI_BASE in board-header (to use it there) or some “global” header-file instead of the NAND-driver?
i wonder why it happens because the call to this value comes from the universal-nand-driver…shouldn’t it not include the nand-headers first? havn’t found out the order yet
if i add the 2 defines to the board-header, i don’t get the expected duplicate definition…instead i got an undefined reference for board_nand_init in drivers/mtd/nand/nand.c:180
both are included if CONFIG_MTK_MTD_NAND is set…this is only set if ON_BOARD_*NAND_FLASH_COMPONENT is selected…not if flashtype set to SD (OFF_BOARD_SD_CARD_COMPONENT)
so i wonder why drivers/mtd/nand/nand.c is used
i’ve seen that for flashtype=SD nand and mtd are activated including the CMD_*-options. disabled them and now i’m able to compile…strange that you can build without this change
BPI do have original/up-to-date uboot source code, but they missed some changes in above github. I guess they just extracted related patch/files from up-to-date uboot to current uboot codebase. I’ll suggest they can put original code to github as reference, thanks.
ok,as i expected you use another repo…is this public? This github-repo (v2014-04) was my only source. Or are you talking about upstream-code (actual uboot v2019-xx)?
btw. my uboot does not boot ;( compiled with gcc6 and 5.5, maybe same problem as with older r2-uboot…which does also not boot with gcc5.5+
Is your inlining-patch for this issue? edit: tried it, but same result (gcc6.5 with inline-patch)
have now compiled with gcc 4.8 (ubuntu 14.4) and here it boots, only strange message:
DRAM: 112 MiB
WARNING: Caches not enabled
dev_num = 1
***size=4096, offset=1310720, blk_start=2560, blk_cnt=8
*** Error - default environment is too large
In: serial
Out: serial
Err: serial
dev_num = 1
***size=4096, offset=1310720, blk_start=2560, blk_cnt=8
*** Error - default environment is too large
Net: mtk_eth
Uip activated
Hit any key to stop autoboot: 0
Unknown command 'No' - try 'help'
BPI-R64>
BPI-R64>
BPI-R64> printenv
Environment size: 1/4092 bytes
BPI-R64>
ok, fixed by setting CONFIG_ENV_SIZE to 8K
network works with rtl8367-switch, load from my menu currently not (because service is set to linux-4.19 instead of linux), ls works on the partition 1:1 (=sd)
btw. does anybody know memory-location of uboot? i want to add tftp-option for loading uboot, but did not find uboots memory-position (before relocation)
[PART] load "tee1" from 0x0000000000080200 (dev) to 0x43000DC0 (mem) [SUCCESS]
[PART] load speed: 2752KB/s, 62032 bytes, 22ms
load tee1 (ret=0)
[BLDR] bldr load tee part ret=0x0, addr=0x43001000
[get_part] part->nr_sects=768, part->info->name=preloader
[get_part] part->nr_sects=512, part->info->name=tee1
[get_part] part->nr_sects=1024, part->info->name=lk
[BLDR] boot part. not found
[BLDR] part_load_images ret=0x0
[BLDR] Others, jump to ATF
[BLDR] jump to 0x41E00000
[BLDR] <0x41E00000>=0xEA00000F
[BLDR] <0x41E00004>=0xE59FF014
U-Boot 2014.04-rc1-00018-g7a9081b-dirty (Sep 21 2019 - 20:15:23)
maybe 0x41E00004 is uboot’s address, but on r2 this is printed more cleanly
just a small update on gcc-issue (does not boot if compiled with linaro gcc 5.5+)
if i enable debug in mt7622_evb.h i see this:
U-Boot code: FFFFFFFF -> FFFFFFFF BSS: -> FFFFFFFF
monitor len: 00000000
ramsize: 3F000000
TLB table from 7eff0000 to 7eff4000
Top of RAM usable for U-Boot at: 7eff0000
Reserving 0k for U-Boot at: 7eff0000 <<<<<<<<<<<<<<< 0k is a little bit, right? :)
Reserving 32772k for malloc() at: 7cfef000
Reserving 32 Bytes for Board Info at: 7cfeefe0
Reserving 160 Bytes for Global Data at: 7cfeef40
New Stack Pointer is: 7cfeef30
RAM Configuration:
Bank #0: 40000000 1008 MiB
relocation Offset is: 7eff0001 <<<<<<<<<<<<<< not aligned, last 1 is strange
basicly it hangs after the dram-information, not showing uboot-version (like it does if compiled with gcc4.8)
with the great help of @ray we have fixed the gcc5.5±issue (compile but not boot) by removing object-copy filtering:
so uboot is now compilable with ubuntu 18.4 (gcc6.5) and boots up correctly
for gcc7+ we need to fix some compile-errors
common/main.c:31:6: error: 'show_boot_progress' aliased to external symbol '__show_boot_progress'
void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
^~~~~~~~~~~~~~~~~~
make[1]: *** [common/main.o] Error 1
make: *** [common] Error 2
make: *** Waiting for unfinished jobs....
arch/arm/lib/board.c:73:6: error: 'coloured_LED_init' aliased to external symbol '__coloured_LED_init'
void coloured_LED_init(void)
^~~~~~~~~~~~~~~~~
arch/arm/lib/board.c:90:6: error: 'blue_led_off' aliased to external symbol '__blue_led_off'
void blue_led_off(void) __attribute__((weak, alias("__blue_led_off")));
^~~~~~~~~~~~
arch/arm/lib/board.c:88:6: error: 'blue_led_on' aliased to external symbol '__blue_led_on'
void blue_led_on(void) __attribute__((weak, alias("__blue_led_on")));
^~~~~~~~~~~
arch/arm/lib/board.c:86:6: error: 'yellow_led_off' aliased to external symbol '__yellow_led_off'
void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off")));
^~~~~~~~~~~~~~
arch/arm/lib/board.c:84:6: error: 'yellow_led_on' aliased to external symbol '__yellow_led_on'
void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on")));
^~~~~~~~~~~~~
arch/arm/lib/board.c:82:6: error: 'green_led_off' aliased to external symbol '__green_led_off'
void green_led_off(void) __attribute__((weak, alias("__green_led_off")));
^~~~~~~~~~~~~
arch/arm/lib/board.c:80:6: error: 'green_led_on' aliased to external symbol '__green_led_on'
void green_led_on(void) __attribute__((weak, alias("__green_led_on")));
^~~~~~~~~~~~
arch/arm/lib/board.c:78:6: error: 'red_led_off' aliased to external symbol '__red_led_off'
void red_led_off(void) __attribute__((weak, alias("__red_led_off")));
^~~~~~~~~~~
arch/arm/lib/board.c:76:6: error: 'red_led_on' aliased to external symbol '__red_led_on'
void red_led_on(void) __attribute__((weak, alias("__red_led_on")));
^~~~~~~~~~
i tried to fix them like here by disabling the weak-option (not the best way,right? maybe weak is needed to overwrite these functions…)
but now i get these:
LD lib/built-in.o
lib/time.o: In function `__raw_writesb':
/media/data_fast/bpi/uboot/u-boot/arch/arm/include/asm/io.h:80: multiple definition of `__raw_writesb'
lib/display_options.o:/media/data_fast/bpi/uboot/u-boot/arch/arm/include/asm/io.h:80: first defined here
lib/time.o: In function `__raw_writesw':
/media/data_fast/bpi/uboot/u-boot/arch/arm/include/asm/io.h:88: multiple definition of `__raw_writesw'
...
ah ok, seems to work…now i get linking-errors where i have removed the weak-lines…
LD u-boot
arch/arm/lib/built-in.o: In function `clbss_l':
/media/data_fast/bpi/uboot/u-boot/arch/arm/lib/crt0.S:110: undefined reference to `coloured_LED_init'
/media/data_fast/bpi/uboot/u-boot/arch/arm/lib/crt0.S:111: undefined reference to `red_led_on'
arch/arm/lib/built-in.o: In function `bootstage_mark_name':
/media/data_fast/bpi/uboot/u-boot/include/bootstage.h:356: undefined reference to `show_boot_progress'
/media/data_fast/bpi/uboot/u-boot/include/bootstage.h:356: undefined reference to `show_boot_progress'
/media/data_fast/bpi/uboot/u-boot/include/bootstage.h:356: undefined reference to `show_boot_progress'
common/built-in.o: In function `bootstage_mark_name':
/media/data_fast/bpi/uboot/u-boot/include/bootstage.h:356: undefined reference to `show_boot_progress'
common/built-in.o: In function `bootstage_mark':
/media/data_fast/bpi/uboot/u-boot/include/bootstage.h:344: undefined reference to `show_boot_progress'
common/built-in.o:/media/data_fast/bpi/uboot/u-boot/include/bootstage.h:344: more undefined references to `show_boot_progress' follow
ah, ok, copy empty functions to mt7622_evb.c…now compile works with gcc7
BPI-R64> version
U-Boot 2014.04-rc1-00027-g2c83f9c241-dirty (Sep 26 2019 - 10:33:50)
arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0
GNU ld (GNU Binutils for Ubuntu) 2.30
BPI-R64>
for gcc8 i need a compiler-gcc8.h, i have not yet found any with google…only other versions…but i have found one in my kernel-repo compiles fine and seems to work
BPI-R64> version
U-Boot 2014.04-rc1-00028-ge7e4914e34-dirty (Sep 26 2019 - 10:43:27)
arm-linux-gnueabihf-gcc (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
GNU ld (GNU Binutils for Ubuntu) 2.30
BPI-R64>
gcc8-issue is already solved by header-file from linux-kernel
Currently i try to fix the warnings
most of them fixed…only 2 less
drivers/mmc/mediatek/mt7622/msdc.c:1603:27: warning: comparison of constant '2' with boolean expression is always true [-Wbool-compare]
if ( host->app_cmd!=2 ) { //Light 20121225, to prevent recursive call path: msdc_tune_cmdrsp->msdc_app_cmd->msdc_cmd->msdc_tune_cmdrsp
^~
drivers/mmc/mediatek/mt7622/msdc.c: In function 'msdc_dma_transfer':
drivers/mmc/mediatek/mt7622/msdc.c:2087:23: warning: comparison of constant '2' with boolean expression is always true [-Wbool-compare]
if (host->app_cmd != 2)
^~
i wonder why author of this code compares a boolean with numeric value…
so i would suggest change both to
if ( ! host->app_cmd)
will this be right?
i have compiled all 4 versions (sd/emmc,rtl8367/mt7531) with gcc8 for testing: