Illegal instruction - While starting Linux kernel.
Venkatakrishnan Sutharsan
venkatakrishnan.sutharsan at gmail.com
Wed Jul 7 10:45:25 CEST 2021
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 .... at .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 at 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 at 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 <address>" 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 at 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 at 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 at 2000000 {
compatible = "riscv,clint0";
interrupts-extended = <0x00000001 0x00000003 0x00000001 0x00000007>;
reg = <0x00000000 0x02000000 0x00000000 0x000c0000>;
};
interrupt-controller at 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 at 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 at 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 at 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 at 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*
More information about the U-Boot
mailing list