OpenNuvoton / NUC970_U-Boot_v2016.11

U-Boot v2016.11 for NUC970, N9H30, and NUC980
28 stars 45 forks source link

Problems booting from SD #27

Closed ladecadence closed 3 years ago

ladecadence commented 3 years ago

I'm having problems booting from the SD0 on my NUC980 custom board. I used the ROM bootloader and NuWriter to send uboot to the SD card, and it manages to run uboot from the SD, so it looks the SD hardware is working. But then uboot is not finding anything on the SD interface. uboot is compiled with the CONFIG_MMC=y CONFIG_SD_BOOT=y CONFIG_NUC980_MMC=y and CONFIG_NUC980_SD_PORT0=y options. The uboot commands "mmc info" and "mmc part" don't return anything, and the SD is inserted and has a MBR format and one FAT partition.

The uboot screen shows:

U-Boot 2016.11 (Nov 28 2020 - 12:55:29 +0100)

CPU: NUC980
Board: NUC980
DRAM:  64 MiB
NAND:  NAND Flash not found !
NUC980 NAND CONTROLLER IS NOT SUPPORT THE PAGE SIZE. (0, 0)
0 MiB
SF: Unsupported flash IDs: manuf ff, jedec ffff, ext_jedec 0000
spi_nand: Id could not be mapped
MMC:   NUC980 SD: 0
*** Warning - readenv() failed, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Net Initialization Skipped
No ethernet found.
=> 

(I don't have any NAND or SPI flash on my board)

but then:


=> mmc list
NUC980 SD: 0
=> mmc part

And stops there.

yachen commented 3 years ago

Hi, Are you using port C or port F to connect with SD card?

ladecadence commented 3 years ago

Port C

yachen commented 3 years ago

Hi,

CONFIG_NUC980_SD_PORT0 is for port F. Please try to enable CONFIG_NUC980_EMMC instead.

Sincerely,

Yi-An Chen

ladecadence commented 3 years ago

The problem then is that if I enable CONFIG_NUC980_EMMC, I get this error compiling uboot:

board/nuvoton/nuc980/nuc980.c: In function ‘board_mmc_init’:
board/nuvoton/nuc980/nuc980.c:194:3: error: #error Do not enable eMMC(CONFIG_NUC980_EMMC) and NAND(CONFIG_NAND_NUC980) at the same time!
 # error Do not enable eMMC(CONFIG_NUC980_EMMC) and NAND(CONFIG_NAND_NUC980) at the same time!
   ^
board/nuvoton/nuc980/nuc980.c:209:2: warning: implicit declaration of function ‘nuc980_mmc_init’ [-Wimplicit-function-declaration]
  nuc980_mmc_init(1); // init for eMMC
  ^
board/nuvoton/nuc980/nuc980.c:167:15: warning: unused variable ‘i’ [-Wunused-variable]
  volatile int i;
               ^
scripts/Makefile.build:280: recipe for target 'board/nuvoton/nuc980/nuc980.o' failed

But if I disable CONFIG_NAND_NUC980 then I get this one:

drivers/mtd/nand/built-in.o: In function `nand_init_chip':
/home/user/NUC970_Buildroot-master/output/build/uboot-master/drivers/mtd/nand/nand.c:86: undefined reference to `board_nand_init'
/home/user/NUC970_Buildroot-master/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-ld.bfd: BFD (GNU Binutils) 2.26.1 assertion fail elf32-arm.c:8437
/home/user/NUC970_Buildroot-master/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script
/home/user/NUC970_Buildroot-master/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-ld.bfd: final link failed: Invalid operation
Makefile:1210: recipe for target 'u-boot' failed

Any ideas?

yachen commented 3 years ago

You also have to

  1. Disable command line interface->device access commands->nand
  2. Disable spl /tpl ->enable spl
  3. Depending on the configuration header you use (one of nuc980_*.h) in include/configs, comment out NAND related settings and uncomment eMMC related settings.

Sincerely,

Yi-An Chen

ladecadence commented 3 years ago

Hello again, I already did all that steps, but I get the same error:

drivers/mtd/nand/built-in.o: In function `nand_init_chip':
/home/user/NUC970_Buildroot-master/output/build/uboot-master/drivers/mtd/nand/nand.c:86: undefined reference to `board_nand_init'
/home/user/NUC970_Buildroot-master/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-ld.bfd: BFD (GNU Binutils) 2.26.1 assertion fail elf32-arm.c:8437
/home/user/NUC970_Buildroot-master/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script
/home/user/NUC970_Buildroot-master/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-ld.bfd: final link failed: Invalid operation
Makefile:1210: recipe for target 'u-boot' failed
make[1]: *** [u-boot] Error 1

and in uboot .config:

# CONFIG_NAND_BOOT is not set
CONFIG_SD_BOOT=y
...
CONFIG_SUPPORT_SPL=y
CONFIG_SPL=y
...
CONFIG_CMD_MMC=y
# CONFIG_CMD_NAND is not set
...
CONFIG_NUC980_MMC=y
# CONFIG_NUC980_SD_PORT0 is not set
CONFIG_NUC980_EMMC=y
...

I'm using nuvoton_nuc980_chili_defconfig, and in uboot include/config/nuc980_chili.h I have:

/*#define CONFIG_SYS_USE_NANDFLASH */
/*#define CONFIG_ENV_IS_IN_NAND */
//#define CONFIG_ENV_IS_IN_SPI_FLASH
#define CONFIG_ENV_IS_IN_MMC
...
/* Following block is for MMC support */
#ifdef CONFIG_NUC980_MMC
#define CONFIG_CMD_FAT
#define CONFIG_MMC
#define CONFIG_GENERIC_MMC
#define CONFIG_DOS_PARTITION
/*#define CONFIG_MMC_TRACE */
/*#define CONFIG_NUC980_SD_PORT0 */
#define CONFIG_NUC980_EMMC      /* Don't enable eMMC(CONFIG_NUC980_EMMC) and NAND(CONFIG_NAND_NUC980) at the same time! */
#ifdef CONFIG_ENV_IS_IN_MMC
#define CONFIG_SYS_MMC_ENV_DEV  0
#define CONFIG_ENV_OFFSET       0x80000
#define CONFIG_ENV_SIZE         /*2048*/0x10000
#define CONFIG_ENV_SECT_SIZE    512
#define CONFIG_ENV_OVERWRITE
#endif
#endif
yachen commented 3 years ago

NAND is not enabled in Chili board's configuration. You must've touched something to trigger this error. Please undo the modifications you made, reload Chili board's configuration, enable eMMC in menuconfig/header file and then rebuild uboot.

ladecadence commented 3 years ago

Yes, sorry, I started from scratch and now I can build an uboot binary that reads from SD card. Thank you very much.