From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 360B6C07E95 for ; Wed, 7 Jul 2021 11:20:38 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73C9761C88 for ; Wed, 7 Jul 2021 11:20:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73C9761C88 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4861382DFB; Wed, 7 Jul 2021 13:20:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TxkK8OQ1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4F31982DC7; Wed, 7 Jul 2021 10:45:49 +0200 (CEST) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8191382C35 for ; Wed, 7 Jul 2021 10:45:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=venkatakrishnan.sutharsan@gmail.com Received: by mail-wr1-x436.google.com with SMTP id t15so2080740wry.11 for ; Wed, 07 Jul 2021 01:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=K9CTd5xzU7FxCEDsC4mFMdSVqbP9KJBKP9ZDnZSa2vQ=; b=TxkK8OQ1zGMym5ZFh2q/JveXjKc1D9uxjrZDzPBO4kUEyLxpuFMiwaljDVHUuItGvS UKbu3GOJNLBv32kXFMajOfw4BARuKFJu61v3UT/UQO8NCDxQwB8cgf0i/Py67BxY/+TA m1B1FEiMiY7GCob32YVOX/wVBMnJcT13nVcrGsgPe/QrjRhok1tTwSeM0GAOi8aW9/Lb JxyeYp1iTXjyDuRzuJIbtUE9SvMwxP5Z6wKQ+3OR3kg8f+pll+zhncS02Ytl11SpD5Mv M5rZHFFhpYfuzjQRAlurZ6EmdvRevZHj1k7FkGCD9tyyaMQEOk1ezvhIjrQn122bjadE nPkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=K9CTd5xzU7FxCEDsC4mFMdSVqbP9KJBKP9ZDnZSa2vQ=; b=Dqep6kBznrYJVBV5f4x38XT6vh62aQhHbKlWVMI6CA5HN6tvqifQffq7S0fp7DEp/2 TLyI32nHRedLYi7iwNj7Hk0dOd9EciPSpavlbTWpvG0W9gmIvMm0yU1V0HHuK8DffvGQ /Pck97aH5mjcSTk85jLm9BA7Kx04XpV5LuQG1ZMg0tVP35tbmZs5mENbMvWdXeCfD4v7 y2278RrDP6QpUmGOSxEkhmZAbRq6PsQzgX6K473lokO6RzXXgzTDW5UZ1J8ClcfqQDnR TdBeAE65Sicw7xxd9N2zEClzYFKNIv6x3A0ppvxdPrTbirgJ8dpKLYQfQzbqR3cuSQs3 fhAg== X-Gm-Message-State: AOAM531kA+vQoeDSL4ZUdFO9DmRbk9euGT4Q8+G3XAxu0MZP+Kff5BrH McQ6DVOy45PrKvoFYDppDV9w4t4f8MDWRGcTqW7JvsMzTozfEA== X-Google-Smtp-Source: ABdhPJwQqKDaLPjYWFz8lzfAJ6RioeYZPtPiQeuMBstP7vSIhEKKtDj98LfPDYW2GXYVT7JgGrQpF8W6MYuinlRGWrg= X-Received: by 2002:a5d:66c9:: with SMTP id k9mr26465724wrw.399.1625647538542; Wed, 07 Jul 2021 01:45:38 -0700 (PDT) MIME-Version: 1.0 From: Venkatakrishnan Sutharsan Date: Wed, 7 Jul 2021 14:15:25 +0530 Message-ID: Subject: Re: Illegal instruction - While starting Linux kernel. To: u-boot@lists.denx.de X-Mailman-Approved-At: Wed, 07 Jul 2021 13:20:14 +0200 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi, I have been writing SPI Driver in U-Boot for a RISCV Board and is currently trying to use that to boot linux kernel from SD Card. Right now, I have the card detected and can view files in various partitions in the SD Card. After that I try to copy the uImage (created using mkimage command and vmlinux image file) and dtb into the memory and start the kernel using the following command (the kernel encounters illegal instruction and terminates): => ext4load mmc 0:1 ${kernel_addr_r} /boot/uImage; ext4load mmc 0:1 ${fdt_addr_r} /boot/shakti_100t.dtb; bootm ${kernel_addr_r} - ${fdt_addr_r} 16131968 bytes read in 1227747 ms (12.7 KiB/s) 2852 bytes read in 504 ms (4.9 KiB/s) ## Booting kernel from Legacy Image at 84000000 ... Image Name: Shakti-Vajra Image Type: RISC-V Linux Kernel Image (uncompressed) Data Size: 16131904 Bytes = 15.4 MiB Load Address: 84000000 Entry Point: 84000000 Verifying Checksum ... OK ## Flattened Device Tree blob at 88000000 Booting using the fdt blob at 0x88000000 Loading Kernel Image Using Device Tree in place at 0000000088000000, end 0000000088003b23 Starting kernel ... Unhandled exception: Illegal instruction EPC: 0000000084000000 RA: 000000008ff9905c TVAL: 00000000464c457f EPC: 0000000074268000 RA: 000000008020105c reloc adjusted resetting ... reset not supported yet ### ERROR ### Please RESET the board ### And to check the dump I was not able to create the dump using riscv64-unknown-elf-objdump command in my computer so I used the md.b command to get the dump from the RAM in the board. The dump were as follows : 84000000: 27 05 19 56 02 e3 5d 33 60 e2 a7 a5 00 f6 27 40 '..V..]3`.....'@ 84000010: 84 00 00 00 84 00 00 00 ee 5e 8f 20 05 1a 02 00 .........^. .... 84000020: 53 68 61 6b 74 69 2d 56 61 6a 72 61 00 00 00 00 Shakti-Vajra.... 84000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000040: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 .ELF............ 84000050: 02 00 f3 00 01 00 00 00 00 00 00 00 e0 ff ff ff ................ 84000060: 40 00 00 00 00 00 00 00 00 22 f6 00 00 00 00 00 @........"...... 84000070: 00 00 00 00 40 00 38 00 04 00 40 00 15 00 14 00 ....@.8...@..... 84000080: 01 00 00 00 05 00 00 00 00 10 00 00 00 00 00 00 ................ 84000090: 00 00 00 00 e0 ff ff ff 00 00 00 00 00 00 00 00 ................ 840000a0: f4 ab 01 00 00 00 00 00 f4 ab 01 00 00 00 00 00 ................ 840000b0: 00 10 00 00 00 00 00 00 01 00 00 00 07 00 00 00 ................ 840000c0: 00 c0 01 00 00 00 00 00 00 b0 01 00 e0 ff ff ff ................ 840000d0: 00 b0 01 00 00 00 00 00 c0 a4 e6 00 00 00 00 00 ................ 840000e0: c0 a4 e6 00 00 00 00 00 00 10 00 00 00 00 00 00 ................ 840000f0: 04 00 00 00 04 00 00 00 c0 78 e1 00 00 00 00 00 .........x...... 84000100: c0 68 e1 00 e0 ff ff ff c0 68 e1 00 00 00 00 00 .h.......h...... 84000110: 3c 00 00 00 00 00 00 00 3c 00 00 00 00 00 00 00 <.......<....... 84000120: 04 00 00 00 00 00 00 00 51 e5 74 64 06 00 00 00 ........Q.td.... 84000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000150: 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 ................ 84000160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 840001a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 840001b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 840001c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 840001d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 840001e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 840001f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 84000260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ while the FDT loading seems to happen correctly as from the dump I can see non-zero values. => md.b ${fdt_addr_r} 88000000: d0 0d fe ed 00 00 0b 24 00 00 00 38 00 00 08 54 .......$...8...T 88000010: 00 00 00 28 00 00 00 11 00 00 00 10 00 00 00 00 ...(............ 88000020: 00 00 02 d0 00 00 08 1c 00 00 00 00 00 00 00 00 ................ 88000030: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................ 88000040: 00 00 00 03 00 00 00 04 00 00 00 00 00 00 00 02 ................ 88000050: 00 00 00 03 00 00 00 04 00 00 00 0f 00 00 00 02 ................ 88000060: 00 00 00 03 00 00 00 16 00 00 00 1b 73 68 61 6b ............shak 88000070: 74 69 2c 73 70 69 6b 65 2d 62 61 72 65 2d 64 65 ti,spike-bare-de 88000080: 76 00 00 00 00 00 00 03 00 00 00 12 00 00 00 26 v..............& 88000090: 73 68 61 6b 74 69 2c 73 70 69 6b 65 2d 62 61 72 shakti,spike-bar 880000a0: 65 00 00 00 00 00 00 01 63 70 75 73 00 00 00 00 e.......cpus.... 880000b0: 00 00 00 03 00 00 00 04 00 00 00 00 00 00 00 01 ................ 880000c0: 00 00 00 03 00 00 00 04 00 00 00 0f 00 00 00 00 ................ 880000d0: 00 00 00 03 00 00 00 04 00 00 00 2c 00 00 80 00 ...........,.... 880000e0: 00 00 00 01 63 70 75 40 30 00 00 00 00 00 00 03 ....cpu@0....... 880000f0: 00 00 00 04 00 00 00 3f 63 70 75 00 00 00 00 03 .......?cpu..... 88000100: 00 00 00 04 00 00 00 4b 00 00 00 00 00 00 00 03 .......K........ 88000110: 00 00 00 05 00 00 00 4f 6f 6b 61 79 00 00 00 00 .......Ookay.... 88000120: 00 00 00 03 00 00 00 06 00 00 00 1b 72 69 73 63 ............risc 88000130: 76 00 00 00 00 00 00 03 00 00 00 09 00 00 00 56 v..............V 88000140: 72 76 36 34 69 6d 61 63 00 00 00 00 00 00 00 03 rv64imac........ 88000150: 00 00 00 0b 00 00 00 60 72 69 73 63 76 2c 73 76 .......`riscv,sv 88000160: 33 39 00 00 00 00 00 03 00 00 00 04 00 00 00 69 39.............i 88000170: 02 fa f0 80 00 00 00 01 69 6e 74 65 72 72 75 70 ........interrup 88000180: 74 2d 63 6f 6e 74 72 6f 6c 6c 65 72 00 00 00 00 t-controller.... 88000190: 00 00 00 03 00 00 00 04 00 00 00 79 00 00 00 01 ...........y.... 880001a0: 00 00 00 03 00 00 00 00 00 00 00 8a 00 00 00 03 ................ 880001b0: 00 00 00 0f 00 00 00 1b 72 69 73 63 76 2c 63 70 ........riscv,cp 880001c0: 75 2d 69 6e 74 63 00 00 00 00 00 03 00 00 00 04 u-intc.......... 880001d0: 00 00 00 9f 00 00 00 01 00 00 00 02 00 00 00 02 ................ 880001e0: 00 00 00 02 00 00 00 01 6d 65 6d 6f 72 79 40 38 ........memory@8 880001f0: 30 30 30 30 30 30 30 00 00 00 00 03 00 00 00 07 0000000......... Also, I printed the FDT using the fdt print command. => load mmc 0:1 ${fdt_addr_r} /boot/shakti_100t.dtb 2852 bytes read in 519 ms (4.9 KiB/s) => fdt print No FDT memory address configured. Please configure the FDT address via "fdt addr
" command. Aborting! => fdt addr ${fdt_addr_r} => fdt print / { #address-cells = <0x00000002>; #size-cells = <0x00000002>; compatible = "shakti,spike-bare-dev"; model = "shakti,spike-bare"; cpus { #address-cells = <0x00000001>; #size-cells = <0x00000000>; timebase-frequency = <0x00008000>; cpu@0 { device_type = "cpu"; reg = <0x00000000>; status = "okay"; compatible = "riscv"; riscv,isa = "rv64imac"; mmu-type = "riscv,sv39"; clock-frequency = <0x02faf080>; interrupt-controller { #interrupt-cells = <0x00000001>; interrupt-controller; compatible = "riscv,cpu-intc"; phandle = <0x00000001>; }; }; }; memory@80000000 { device_type = "memory"; reg = <0x00000000 0x80000000 0x00000000 0x10000000>; }; soc { #address-cells = <0x00000002>; #size-cells = <0x00000002>; compatible = "shakti,spike-bare-soc", "simple-bus"; ranges; clint@2000000 { compatible = "riscv,clint0"; interrupts-extended = <0x00000001 0x00000003 0x00000001 0x00000007>; reg = <0x00000000 0x02000000 0x00000000 0x000c0000>; }; interrupt-controller@c000000 { #interrupt-cells = <0x00000002>; compatible = "riscv,plic0"; interrupt-controller; reg = <0x00000000 0x0c000000 0x00000000 0x04000000>; interrupts-extended = <0x00000001 0x0000000b 0x00000001 0x00000009>; reg-names = "control"; riscv,max-priority = <0x00000007>; riscv,ndev = <0x0000001d>; phandle = <0x00000002>; }; ethernet@44000 { #address-cells = <0x00000002>; #size-cells = <0x00000002>; device_type = "network"; compatible = "xlnx,xps-ethernetlite-3.00.a", "xlnx,xps-ethernetlite-1.00.a"; interrupt-parent = <0x00000002>; interrupts = <0x0000001d 0x00000001>; local-mac-address = [00 0a 35 00 00 00]; phy-handle = <0x00000003>; reg = <0x00000000 0x00044000 0x00000000 0x00004000>; xlnx,duplex = <0x00000001>; xlnx,include-global-buffers = <0x00000001>; xlnx,include-internal-loopback = <0x00000001>; xlnx,include-mdio = <0x00000001>; xlnx,instance = "axi_ethernetlite_inst"; xlnx,rx-ping-pong = <0x00000001>; xlnx,s-axi-id-width = <0x00000001>; xlnx,tx-ping-pong = <0x00000001>; threshold = <0x00000040>; sensitivity = <0x00000006>; mdio { #address-cells = <0x00000001>; #size-cells = <0x00000000>; phy@1 { device_type = "ethernet-phy"; compatible = "ethernet-phy-ieee802.3-c22"; ti,rx-internal-delay = <0x3b9aca00>; ti,tx-internal-delay = <0x3b9aca00>; ti,fifo-depth = <0x00001000>; reg = <0x00000001>; status = "okay"; phandle = <0x00000003>; }; }; }; oscillator { #clock-cells = <0x00000000>; compatible = "fixed-clock"; clock-frequency = <0x02faf080>; phandle = <0x00000004>; }; spi@20100 { compatible = "shakti,spi1"; reg = <0x00000000 0x00020100 0x00000000 0x00000100>; clocks = <0x00000004>; shakti,controller = <0x00000001>; shakti,spi-frequency = <0x001e8480>; shakti,lsb-first = <0x00000000>; shakti,communication-mode = <0x00000003>; shakti,cpha = <0x00000000>; shakti,cpol = <0x00000000>; shakti,cs-high = <0x00000001>; shakti,fifo-depth = <0x0000001f>; mmc-slot@0 { compatible = "mmc-spi-slot"; reg = <0x00000000>; voltage-ranges = <0x00000ce4 0x00000ce4>; spi-max-frequency = <0x002625a0>; }; }; }; uart { compatible = "shakti,uart0"; reg = <0x00000000 0x00011300 0x00000000 0x00001000>; }; }; >From this I think that the SPI Driver is working, but I still cannot figure why the kernel is not booting. Any suggestions/comments on how to solve this issue is highly appreciated. Thanks in advance. *Regards,* *Venkatakrishnan Sutharsan*