OpenNuvoton / NUC970_U-Boot_v2016.11

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

NuMaker-HMI-N9H30 I am trying to spi boot #40

Open rews7709 opened 1 year ago

rews7709 commented 1 year ago

Hi Nuvoton,

https://www.nuvoton.com/support/video-zone/search/youtube-V-_VGHG7B4GUk/?listId= watched the video and followed it.

It works like below.

1

SPI_FLASH m25p80 -> w25q256

Spi_env.txt //====================================================== baudrate=115200 bootdelay=1 stderr=serial stdin=serial stdout=serial ethact=emac ethaddr=00:00:00:11:66:88 setspi=sf probe 0 50000000 loadkernel=sf read 0x7fc0 0x200000 0x2000000 bootcmd=run setspi;run loadkernel;bootm 0x7fc0 bootargs=noinitrd root=/dev/mtdblock2 rw rootfstype=jffs2 console=ttyS0 rdinit=/sbin/init mem=64M mtdparts=w25q256:0x200000@0x0(u-boot),0x2000000@0x200000(kernel),-(user) ignore_loglevel

Which part do I need to fix?

I have installed bsp /NUC970_Buildroot-master/ install_nuc970_bsp.sh

compile u-boot

include/configs/ nuc970_evb.h - Modified NUC970 N9H30 U-Boot v2016_11 User Manual EN.pdf document and set up

[N9H30_BSP]# make distclean [N9H30_BSP]# make n9h30_defconfig (for N9H30) [N9H30_BSP]# make menuconfig

NUC970 N9H30 U-Boot v2016_11 User Manual EN.pdf 1.4 Add SPI configuration spi settings define CONFIG_SYS_USE_SPIFLASH /#define CONFIG_ENV_IS_IN_NAND /

define CONFIG_ENV_IS_IN_SPI_FLASH

........... Other content has been corrected as well. [N9H30_BSP]# make

Output file u-boot.bin(509K) / u-boot-nodtb.bin(509K) / u-boot-spl.bin(17K) / u-boot-spl-nodtb.bin(17K)

compile Kernel [N9H30_BSP]# make distclean make n9h30f6_defconfig

Refer to N9H30 Linux BSP User Manual EN.pdf and set from 5.3.1 Basic Configuration of System

Boot Options – root file system is based on JFFS2 (SPI Flash) General setup ---> [ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support

Boot options ---> (root=/dev/mtdblock1 rw rootfstype=jffs2 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M) Default kernel command string Kernel command line type (Use bootloader arguments if available) --->

SPI_FLASH m25p80 -> w25q256 arch/arm/mach-nuc970/dev.c - Modified

ifdef CONFIG_MTD_M25P80

static struct mtd_partition nuc970_spi0_flash_partitions[] = {

ifdef CONFIG_BOARD_ETH2UART

{ .name = "kernel", .size = 0x0800000, .offset = 0x1000000, }, { .name = "rootfs", .size = 0x0800000, .offset = 0x1800000, }, { .name = "SPI flash", .size = 0x2000000, .offset = 0, },

else

{ .name = "kernel", .size = 0x0800000, .offset = 0, }, { .name = "rootfs", .size = 0x0800000, .offset = 0x0800000, }, { .name = "SPI flash", .size = 0x2000000, .offset = 0, },

endif

};

static struct flash_platform_data nuc970_spi0_flash_data = { .name = "w25q256", .parts = nuc970_spi0_flash_partitions, .nr_parts = ARRAY_SIZE(nuc970_spi0_flash_partitions), .type = "w25q256", };

static struct mtd_partition nuc970_spi1_flash_partitions[] = { { .name = "SPI flash", .size = 0x2000000, .offset = 0, }, };

static struct flash_platform_data nuc970_spi1_flash_data = { .name = "w25q256", .parts = nuc970_spi1_flash_partitions, .nr_parts = ARRAY_SIZE(nuc970_spi1_flash_partitions), .type = "w25q256", };

I didn't know, so I modified spi0 spi1 to be the same.

[N9H30_BSP]# make

Output file n9h30image / zImage / Image / vmlinux

Download(Are you downloading the right file?) ./nuwriter -m spi -d N9H30F61IEC.ini -t uboot -a 0xE00000 -w ../image_temp/u-boot.bin -v ./nuwriter -m spi -d N9H30F61IEC.ini -t env -a 0x80000 -w ../image_temp/Spi_env.txt -v ./nuwriter -m spi -d N9H30F61IEC.ini -t data -a 0x200000 -w ../image_temp/n9h30image –v Spi_env.txt //====================================================== baudrate=115200 bootdelay=1 stderr=serial stdin=serial stdout=serial ethact=emac ethaddr=00:00:00:11:66:88 setspi=sf probe 0 50000000 loadkernel=sf read 0x7fc0 0x200000 0x2000000 bootcmd=run setspi;run loadkernel;bootm 0x7fc0 bootargs=root=/dev/mtdblock1 rw rootfstype=jffs2 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M mtdparts=w25q256:0x200000@0x0(u-boot),0x2000000@0x200000(kernel),-(user) ignore_loglevel

---- It works like below.

Wrong Image Format for bootm command ERROR: can't get kernel image!

SPI_FLASH m25p80 -> w25q256 Which part do I need to fix?

thank you

ychuang3 commented 1 year ago

HI,

Please try:

  1. Modify m25p80.c files instead of dev.c file Path: output/build/linux-master/drivers/mtd/devices/m25p80.c

/ { "w25q256", INFO(0xef4019, 0, 64 1024, 512, SECT_4K) }, / { "w25q256", INFO(0xef4019, 0, 64 1024, 512, 0) },

  1. Use mkfs tool to generate rootfs ~Buildroot/output/images$ sudo mkfs.jffs2 -s 0x1000 -e 0x10000 -p 0x800000 -d ./rootfs -o jffs2.img

  2. Modify Auto Mount Path: board/nuvoton/rootfs-xxx/etc/mdev.conf

mtdblock([3-9]+) 0:0 660 */sbin/automount.sh $MDEV X${ACTION}