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.

Linux kernel not loading from SPI flash on AM335x

Other Parts Discussed in Thread: AM3352
Hi,
We are using SDK 8.0 and trying to boot a customized hardware based on AM3352 Sitara processor from the SPI flash memory.
We've been successfully able to load the the images:
- MLO.byteswap at location SPI offset 0
- u-boot.img at location SPI offset 0x20000
- am335x-evm.dtb at location SPI offset 0x80000
- zImage at location SPI offset 0x90000
Board is booting correctly from SPI flash & we are getting the u-boot prompt also. Boot parameters are:
U-Boot# setenv loadaddr 0x80800000
U-Boot# setenv kernel_addr_r 0x80800000
U-Boot# setenv fdtaddr 0x80400000
U-Boot# setenv fdt_addr_r  0x80400000 
U-Boot# setenv rdaddr 0x81950000
U-Boot# setenv ramdisk_addr_r 0x81950000
U-Boot# setenv bootm_size 0x2faf080
U-Boot# setenv spiargs 'setenv bootargs console=ttyO0,115200n8 ${optargs} root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait'
U-Boot# setenv spiboot "echo Booting from SPI ...; run spiargs; sf probe 0; sf read ${fdtaddr} 0x80000 0x10000; sf read ${loadaddr} 0x90000 0x500000; sf probe 0; bootz ${loadaddr} - ${fdtaddr}"
U-Boot# run spiboot
However the kernel booting is getting stuck at 'Starting Kernel ...', below are the logs:
Booting from SPI ...
SF: Detected N25Q128 with page size 256 Bytes, erase size 64 KiB, total 16 MiBSF: 65536 bytes @ 0x80000 Read: OK
SF: 5242880 bytes @ 0x90000 Read: OK
SF: Detected N25Q128 with page size 256 Bytes, erase size 64 KiB, total 16 MiBKernel image @ 0x80800000 [ 0x000000 - 0x2d7508 ]
## Flattened Device Tree blob at 80400000
   Booting using the fdt blob at 0x80400000
   Loading Device Tree to 82fa2000, end 82fae8d7 ... OK
 
Starting kernel ...
 
 
TTY console is fine and we have also followed the steps to debug as per below link but no luck.
Anyone having any input please let us know.
 
Best
Shubhro
  • Hi,

    I will forward this to the SW team.

  • Thanks Biser.

    Hi Members,
    Anyone having any input or have faced similar issue before, please share your finding !!

    Regards
    Shubhro
  • All,

    I am working with Shubhro on this issue and would like to provide few more updates regarding this problem. We confirmed that the Processor is undergoing a reset while executing the Linux Kernel initialization code. Using CCS and XDS emulator, we tried halting the ARM core while it is executing the above assembly routine and find that during the execution of the above assembly routine, the reset occurs on the processor.

    The Linux Kernel initialization code is present under arch/arm/kernel/Head.s assembly file. In this assembly file, there is a assembly routine named stext which puts the ARM core in Supervisor mode, initializes the Page Tables, MMU Tables and so on.

    We put a simple busy loop inside the stext assembly routine. Even while executing the simple busy loop, we see that the processor is getting reset. The stext assembly routine has the following function execution sequence.

    stext calls 

    0. busy loop  --> This is the new assembly code that we have added inside the stext assembly routine. 

    1. __lookup_processor_type 

    2. __vet_args               Virtual Address 0xC0008270  

    3. __fixup_pv_table      Virtual Address 0xC0008220

                __fixup_a_pv_table  Virtual Address 0xC0008700

    4. __create_page_tables     Virtual Addresss 0xC0008050

    5. __enable_mmu

    Even when the processor is freely executing the busy loop code that we have added, we see that it experiences a reset. If we remove the busy loop, and single-step through the __vet_args, __fixup_pv_table assembly routines, there also the processor experiences a reset.

    Our busy loop implementation is very simple and shown below:

    lptest:

    mov r6, #0

    mov r7, #0

    b lptest

     

    We are using AM3352 in our design. Is there any specific reset signals that we need to cross-check or disable from the boot-loader while executing. If we allow the u-boot prompt *as is* without loading the kernel, then there is no reset occurring on the board.  

    Regards,
    Ravi

  • Hi All,

    Am also involved in debugging the same and found out that disabling the watchdog solved the issue of reset or reboot. But then also we are stuck at starting kernel.

    From CCS  disassembly step in and referring the System.map file we found that it is entering the start_kernel() fucntion.

    We have put few logs using printk and even enabled the low level debug in kernel. But nothing is getting printed.

    Following are the bootarguments which we are giving.

    setenv loadaddr 0x82000000
    setenv kernel_addr_r 0x82000000
    setenv fdtaddr 0x88000000
    setenv fdt_addr_r 0x88000000
    setenv rdaddr 0x88080000
    setenv ramdisk_addr_r 0x88080000
    setenv bootm_size 0x7a1200 //8mb
    setenv spiargs 'setenv bootargs console=ttyO0,115200n8 ${optargs} root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait'
    setenv spiboot "echo Booting from SPI ...; run spiargs; sf probe 0; sf read ${fdtaddr} 0x80000 0x10000; sf read ${loadaddr} 0x90000 0x500000;sf probe 0;bootz ${loadaddr} - ${fdtaddr}"
    mw.l 0x44e35048 0x0000aaaa 1
    mw.l 0x44e35048 0x00005555 1
    run spiboot

    Even we tried with earlyprintk=serial and earlyprintk options in boot arguments.

    Enabled following in config file 

    #
    # Kernel hacking
    #

    #
    # printk and dmesg options
    #
    CONFIG_PRINTK_TIME=y
    CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4
    # CONFIG_BOOT_PRINTK_DELAY is not set
    CONFIG_DYNAMIC_DEBUG=y

    #
    # Compile-time checks and compiler options
    #
    CONFIG_DEBUG_INFO=y
    # CONFIG_DEBUG_INFO_REDUCED is not set
    CONFIG_ENABLE_WARN_DEPRECATED=y
    CONFIG_ENABLE_MUST_CHECK=y
    CONFIG_FRAME_WARN=1024
    # CONFIG_STRIP_ASM_SYMS is not set
    # CONFIG_READABLE_ASM is not set
    # CONFIG_UNUSED_SYMBOLS is not set
    CONFIG_DEBUG_FS=y
    # CONFIG_HEADERS_CHECK is not set
    # CONFIG_DEBUG_SECTION_MISMATCH is not set
    CONFIG_FRAME_POINTER=y
    # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
    CONFIG_MAGIC_SYSRQ=y
    CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
    CONFIG_DEBUG_KERNEL=y

    #
    # Memory Debugging
    #
    # CONFIG_DEBUG_PAGEALLOC is not set
    # CONFIG_DEBUG_OBJECTS is not set
    # CONFIG_DEBUG_SLAB is not set
    CONFIG_HAVE_DEBUG_KMEMLEAK=y
    # CONFIG_DEBUG_KMEMLEAK is not set
    # CONFIG_DEBUG_STACK_USAGE is not set
    # CONFIG_DEBUG_VM is not set
    # CONFIG_DEBUG_MEMORY_INIT is not set
    # CONFIG_DEBUG_HIGHMEM is not set
    # CONFIG_DEBUG_SHIRQ is not set

    #
    # Debug Lockups and Hangs
    #
    # CONFIG_LOCKUP_DETECTOR is not set
    # CONFIG_DETECT_HUNG_TASK is not set
    # CONFIG_PANIC_ON_OOPS is not set
    CONFIG_PANIC_ON_OOPS_VALUE=0
    CONFIG_PANIC_TIMEOUT=0
    # CONFIG_SCHED_DEBUG is not set
    # CONFIG_SCHEDSTATS is not set
    # CONFIG_TIMER_STATS is not set

    #
    # Lock Debugging (spinlocks, mutexes, etc...)
    #
    # CONFIG_DEBUG_RT_MUTEXES is not set
    # CONFIG_RT_MUTEX_TESTER is not set
    # CONFIG_DEBUG_SPINLOCK is not set
    # CONFIG_DEBUG_MUTEXES is not set
    # CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set
    # CONFIG_DEBUG_LOCK_ALLOC is not set
    # CONFIG_PROVE_LOCKING is not set
    # CONFIG_LOCK_STAT is not set
    # CONFIG_DEBUG_ATOMIC_SLEEP is not set
    # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
    CONFIG_DEBUG_KOBJECT=y
    CONFIG_DEBUG_BUGVERBOSE=y
    # CONFIG_DEBUG_WRITECOUNT is not set
    # CONFIG_DEBUG_LIST is not set
    # CONFIG_DEBUG_SG is not set
    # CONFIG_DEBUG_NOTIFIERS is not set
    # CONFIG_DEBUG_CREDENTIALS is not set

    #
    # RCU Debugging
    #
    # CONFIG_SPARSE_RCU_POINTER is not set
    # CONFIG_RCU_TORTURE_TEST is not set
    # CONFIG_RCU_TRACE is not set
    # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
    # CONFIG_NOTIFIER_ERROR_INJECTION is not set
    # CONFIG_FAULT_INJECTION is not set
    # CONFIG_LATENCYTOP is not set
    CONFIG_HAVE_FUNCTION_TRACER=y
    CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
    CONFIG_HAVE_DYNAMIC_FTRACE=y
    CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
    CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
    CONFIG_HAVE_C_RECORDMCOUNT=y
    CONFIG_TRACE_CLOCK=y
    CONFIG_RING_BUFFER=y
    CONFIG_RING_BUFFER_ALLOW_SWAP=y
    CONFIG_TRACING_SUPPORT=y
    # CONFIG_FTRACE is not set

    #
    # Runtime Testing
    #
    # CONFIG_LKDTM is not set
    # CONFIG_TEST_LIST_SORT is not set
    # CONFIG_KPROBES_SANITY_TEST is not set
    # CONFIG_BACKTRACE_SELF_TEST is not set
    # CONFIG_RBTREE_TEST is not set
    # CONFIG_INTERVAL_TREE_TEST is not set
    # CONFIG_PERCPU_TEST is not set
    # CONFIG_ATOMIC64_SELFTEST is not set
    # CONFIG_TEST_STRING_HELPERS is not set
    # CONFIG_TEST_KSTRTOX is not set
    # CONFIG_DMA_API_DEBUG is not set
    # CONFIG_TEST_MODULE is not set
    # CONFIG_TEST_USER_COPY is not set
    # CONFIG_SAMPLES is not set
    CONFIG_HAVE_ARCH_KGDB=y
    # CONFIG_KGDB is not set
    # CONFIG_ARM_PTDUMP is not set
    # CONFIG_STRICT_DEVMEM is not set
    # CONFIG_ARM_UNWIND is not set
    # CONFIG_DEBUG_USER is not set
    CONFIG_DEBUG_LL=y
    CONFIG_DEBUG_OMAP2UART1=y
    # CONFIG_DEBUG_OMAP2UART2 is not set
    # CONFIG_DEBUG_OMAP2UART3 is not set
    # CONFIG_DEBUG_OMAP3UART3 is not set
    # CONFIG_DEBUG_OMAP4UART3 is not set
    # CONFIG_DEBUG_OMAP3UART4 is not set
    # CONFIG_DEBUG_OMAP4UART4 is not set
    # CONFIG_DEBUG_TI81XXUART1 is not set
    # CONFIG_DEBUG_TI81XXUART2 is not set
    # CONFIG_DEBUG_TI81XXUART3 is not set
    # CONFIG_DEBUG_AM33XXUART1 is not set
    # CONFIG_DEBUG_ZOOM_UART is not set
    # CONFIG_DEBUG_ICEDCC is not set
    # CONFIG_DEBUG_SEMIHOSTING is not set
    # CONFIG_DEBUG_LL_UART_8250 is not set
    # CONFIG_DEBUG_LL_UART_PL01X is not set
    CONFIG_DEBUG_OMAP2PLUS_UART=y
    CONFIG_DEBUG_LL_INCLUDE="debug/omap2plus.S"
    # CONFIG_DEBUG_UART_PL01X is not set
    # CONFIG_DEBUG_UART_8250 is not set
    CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
    CONFIG_EARLY_PRINTK=y
    # CONFIG_ARM_KPROBES_TEST is not set
    # CONFIG_PID_IN_CONTEXTIDR is not set
    # CONFIG_DEBUG_SET_MODULE_RONX is not set

    Please let us know if we are missing anything.

    Regards,

    Nagaraj

  • Hi,

    where the rootfs is located in your case?
    Have you tried to load kernel from tftp?

    Have you tried it with SDK7?


    BR,
    Georgi

  • Hi Georgi,

    We haven't gone up to that level where we are loading the rootfs yet, we are still stuck at kernel initialization and booting only.

    Also the configuration which we are using we've only UART & SPI boot option enabled. TFTP boot is not enabled.

    Regards

    Shubhro

  • Hi,

    sorry for delay. Managed to reproduce this issue on am335x EVM.
    Really very strange behavior. I copied zImage and am335x-evm.dtb to SD card, then write them to SPI memory.
    When I load zImage and dtb from mmc to RAM, kernel starts smoothly (by the way, it stuck at "Starting kernel", when dtb file was not pointed in uboot environment, but it does not seem to be our case).
    When I load the SAME zImage and dtb from SPI to RAM and define dtb in uboot environment, it sticks at "Starting kernel" and no more messages flow in console. By now have not found the solution.
    I will continue working on this issue.

    Georgi
  • Hi,

    managed to boot sdk6 zImage (linux 3.2.) from spi flash with log flowing. zImage from sdk8 still sticks on "Starting kernel".

    Georgi