This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x boot from SPI FLASH, endian conversion

最近在调试  AM335x boot from SPI FLASH.

用的是最新的 SDK 和 PSP.

Uboot 可以正常启动。但是 Kernel 却不行。

看到 WiKi  上有说  SPI boot additionally requires endian conversion before flashing the image

该如何进行 endian conversion  呢?

  • 贴出你的启动信息。

  • 如果是这个endian conversion的问题,你的UBOOT为啥能启动正常呢?UBOOT和kernel不都是存在SPI FLASH里面的吗?如楼上所说,你贴下启动log,看看会不会是其他什么原因

  • 另外想确认一下,你是使用什么方式烧写SPI FLASH的

  • For easy generation of the different images, different target names have been provided in the Makefile. The different target names take care of building the appropriate image (with or without the header and with or without endian conversion).

  • TI的SDK文档就值提供这么一个命令:make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- uImage,请问一下对于从SPI FLASH加载的kernel image,应该用什么target name。

  • Hi Lee,

           请问你Boot from SPI DataFlash 成功了吗? 我也在为这事作准备,能提供点建议吗,我看到你也好像摸索了一段时间。

  • 我大部分还是参考这里:http://www.deyisupport.com/question_answer/w/faq/476.booting-from-spi-flash-based-on-gp-evm.aspx

    你现在做到哪一步了,可以把你问题贴出来,讨论一下。

  • 我想在bbb的板子上飞个w25q64,u-boot用am335x_evm_spiboot生成mlo和uboot.img,通过sd卡烧写dataflash可以吗?
  • Booting from spi ...
    SF: Detected W25Q64CV with page size 256 Bytes, erase size 4 KiB, total 8 MiB
    SPI RXS timed out, status=0x00000007
    SF: 3547136 bytes @ 0xe0000 Read: ERROR
    Bad Linux ARM zImage magic!
    ** File not found /boot/zImage **
    ## Error: "nandboot" not defined
    U-Boot# mmc rescan
    U-Boot# sf probe 0
    SF: Detected W25Q64CV with page size 256 Bytes, erase size 4 KiB, total 8 MiB
    U-Boot# sf erase 0 +80000
    SF: 524288 bytes @ 0x0 Erased: OK
    U-Boot# fatload mmc 0 ${loadaddr} MLO
    reading MLO
    76548 bytes read in 8 ms (9.1 MiB/s)
    U-Boot# sf write ${loadaddr} 0 ${filesize}
    SF: 76548 bytes @ 0x0 Written: OK
    U-Boot# fatload mmc 0 ${loadaddr} u-boot.img
    reading u-boot.img
    341928 bytes read in 23 ms (14.2 MiB/s)
    U-Boot# sf write ${loadaddr} 0x20000 ${filesize}
    SF: 341928 bytes @ 0x20000 Written: OK
    U-Boot# sf erase 80000 +${spiimgsize}
    SF: 3604480 bytes @ 0x80000 Erased: OK
    U-Boot# fatload mmc 0 ${loadaddr} rtems-app.img
    reading rtems-app.img
    60295 bytes read in 9 ms (6.4 MiB/s)
    U-Boot# sf write ${loadaddr} ${spisrcaddr} ${filesize}
    SF: 60295 bytes @ 0xe0000 Written: OK
    U-Boot# run spiboot
    Booting from spi ...
    SF: Detected W25Q64CV with page size 256 Bytes, erase size 4 KiB, total 8 MiB
    SPI RXS timed out, status=0x00000007
    SF: 3547136 bytes @ 0xe0000 Read: ERROR
    Bad Linux ARM zImage magic!
    U-Boot#

    Hi Lee 上面上我今天Mount一个W25Q64 ,按你提供的链接上的命令操作后,从SPI Boot的信息。

  • U-Boot# mmc rescan
    U-Boot# sf probe 0
    SF: Detected W25Q64CV with page size 256 Bytes, erase size 4 KiB, total 8 MiB
    U-Boot# sf erase 0 +80000
    SF: 524288 bytes @ 0x0 Erased: OK
    U-Boot# fatload mmc 0 ${loadaddr} MLO
    reading MLO
    76548 bytes read in 8 ms (9.1 MiB/s)
    U-Boot# sf write ${loadaddr} 0 ${filesize}
    SF: 76548 bytes @ 0x0 Written: OK
    U-Boot# fatload mmc 0 ${loadaddr} u-boot.img
    reading u-boot.img
    341928 bytes read in 23 ms (14.2 MiB/s)
    U-Boot# sf write ${loadaddr} 0x20000 ${filesize}
    SF: 341928 bytes @ 0x20000 Written: OK
    U-Boot# sf erase 80000 +${spiimgsize}
    SF: 3604480 bytes @ 0x80000 Erased: OK
    U-Boot# fatload mmc 0 ${loadaddr} rtems-app.img
    reading rtems-app.img
    60295 bytes read in 9 ms (6.4 MiB/s)
    U-Boot# sf write ${loadaddr} ${spisrcaddr} ${filesize}
    SF: 60295 bytes @ 0xe0000 Written: OK
    U-Boot# run spiboot
    Booting from spi ...
    SF: Detected W25Q64CV with page size 256 Bytes, erase size 4 KiB, total 8 MiB
    SPI RXS timed out, status=0x00000007
    SF: 3547136 bytes @ 0xe0000 Read: ERROR
    Bad Linux ARM zImage magic!
    U-Boot#

    完成这些指令后,我再重新上电BeagleBone Black 调试串口没有任何输出了。

  • 此时我的拔码开关配置是11000

  • 从SPI DataFlash boot RTEMS4.11成功。具体操作如下:

    1.  Download TI SDK6.0 AM335x .bin file , install them in Linux OS, run ./*.bin
     
              2.  Modify the sitara-board-port-uboot code for configure the SPI0 mux pin, and comment the read_eeprom operation code
     
              3.  Modify the #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x80000    to 0x20000
     
          4. Added "run spiboot" ,please see belows:
           
            #ifndef CONFIG_RESTORE_FLASH
    #define CONFIG_BOOTCOMMAND \
    "run spiboot;" \
    "mmc dev ${mmcdev}; if mmc rescan; then " \
    "echo SD/MMC found on device ${mmcdev};" \
    "if run loadbootenv; then " \
    "echo Loaded environment from ${bootenv};" \
    "run importbootenv;" \
     
     
              3. compile the U-BOOT, use the command make O=am335x CROSS_COMPILE=arm-rtems4.11- ARCH=arm am335x_evm_spiboot
     
          4. I through the SD/Card(MMC0) entry the u-boot command console, and do following steps:
    U-Boot # mmc rescan
    U-Boot # sf probe 0
    U-Boot # sf erase 0 +80000
    U-Boot # fatload mmc 0 ${loadaddr} MLO.byteswap
    U-Boot # sf write ${loadaddr} 0 ${filesize}
    U-Boot # fatload mmc 0 ${loadaddr} u-boot.img
    U-Boot # sf write ${loadaddr} 0x20000 ${filesize}
    U-Boot # sf erase 80000 +${spiimgsize}
    U-Boot # fatload mmc 0 ${loadaddr} uImage
    U-Boot # sf write ${loadaddr} ${spisrcaddr} ${filesize}
     
       5. Eject the SD-card, and hold on S2 button, and then will print message from debug port,
            
     
    U-Boot SPL 2013.01.01-g43a81af-dirty (Feb 10 2015 - 09:15:03)
    hhii
    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Peripheral mode controller at 47401000 using PIO, IRQ 0
    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Host mode controller at 47401800 using PIO, IRQ 0
    SF: Detected W25Q64 with page size 4 KiB, total 8 MiB
    CCCCC.
    DDDDD.
    EEEEE.
    FFFFF.
    Entry Point is:0x80800000.
    JJJJJ.
     
     
    U-Boot 2013.01.01-g43a81af-dirty (Feb 10 2015 - 09:15:03)
     
    I2C:   ready
    DRAM:  512 MiB
    WARNING: Caches not enabled
    NAND:  No NAND device found!!!
    0 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    SF: Detected W25Q64 with page size 4 KiB, total 8 MiB
    *** Warning - bad CRC, using default environment
     
    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Peripheral mode controller at 47401000 using PIO, IRQ 0
    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Host mode controller at 47401800 using PIO, IRQ 0
    Net:   <ethaddr> not set. Validating first E-fuse MAC
    cpsw, usb_ether
    Hit any key to stop autoboot:  0
    Booting from spi ...
    SF: Detected W25Q64 with page size 4 KiB, total 8 MiB
    ## Booting kernel from Legacy Image at 80200000 ...
       Image Name:   RTEMS
       Image Type:   ARM RTEMS Kernel Image (gzip compressed)
       Data Size:    60211 Bytes = 58.8 KiB
       Load Address: 80000000
       Entry Point:  80000000
       Verifying Checksum ... OK
       Uncompressing Kernel Image ... OK
    ## Transferring control to RTEMS (at address 80000000) ...
     
    RTEMS Beagleboard: am335x-based
     
     
    *** BEGIN OF TEST HELLO WORLD ***
    Hello RTEMS
    Hello Hans.Huang
    *** END OF TEST HELLO WORLD ***
    Start GPIO LED Blink task
    LED On
    #### Hello RTEMS4.11 ####
    LED Off
    #### Hello RTEMS4.11 ####
    LED On
    #### Hello RTEMS4.11 ####
    LED Off
  • 补充一点,请注意红色一行:

    void enable_board_pin_mux(struct am335x_baseboard_id *header)
    {
    /* Do board-specific muxes. */
    if (!strncmp(header->name, "A335BONE", HDR_NAME_LEN)) {
    /* Beaglebone pinmux */
    configure_module_pin_mux(i2c1_pin_mux);
    configure_module_pin_mux(mii1_pin_mux);
    configure_module_pin_mux(mmc0_pin_mux);
    #ifndef CONFIG_NOR
    configure_module_pin_mux(mmc1_pin_mux);
    #endif
    #if defined(CONFIG_NOR) && !defined(CONFIG_NOR_BOOT)
    configure_module_pin_mux(bone_norcape_pin_mux);
    #endif
    } else if (!strncmp(header->config, "SKU#01", 6)) {
    /* General Purpose EVM */
    unsigned short profile = detect_daughter_board_profile();
    configure_module_pin_mux(rgmii1_pin_mux);
    configure_module_pin_mux(mmc0_pin_mux);
    /* In profile #2 i2c1 and spi0 conflict. */
    if (profile & ~PROFILE_2)
    configure_module_pin_mux(i2c1_pin_mux);
    /* Profiles 2 & 3 don't have NAND */
    if (profile & ~(PROFILE_2 | PROFILE_3))
    configure_module_pin_mux(nand_pin_mux);
    else if (profile == PROFILE_2) {
    configure_module_pin_mux(mmc1_pin_mux);
    configure_module_pin_mux(spi0_pin_mux);
    }
    } else if (!strncmp(header->config, "SKU#02", 6)) {
    /*
    * Industrial Motor Control (IDK)
    * note: IDK console is on UART3 by default.
    * So u-boot mus be build with CONFIG_SERIAL4 and
    * CONFIG_CONS_INDEX=4
    */
    configure_module_pin_mux(mii1_pin_mux);
    configure_module_pin_mux(mmc0_no_cd_pin_mux);
    } else if (!strncmp(header->name, "A335X_SK", HDR_NAME_LEN)) {
    /* Starter Kit EVM */
    configure_module_pin_mux(i2c1_pin_mux);
    configure_module_pin_mux(gpio0_7_pin_mux);
    configure_module_pin_mux(rgmii1_pin_mux);
    configure_module_pin_mux(mmc0_pin_mux_sk_evm);
    } else if (!strncmp(header->name, "A335BNLT", HDR_NAME_LEN)) {
    /* Beaglebone LT pinmux */
    configure_module_pin_mux(i2c1_pin_mux);
    configure_module_pin_mux(mii1_pin_mux);
    configure_module_pin_mux(mmc0_pin_mux);
    configure_module_pin_mux(mmc1_pin_mux);

    configure_module_pin_mux(spi0_pin_mux);
    } else {
    puts("Unknown board, cannot configure pinmux.");
    hang();
    }
    }