OpenCores
no use no use 1/1 no use no use
linux on custom SOC
by rhast on Feb 10, 2014
rhast
Posts: 3
Joined: Jul 27, 2013
Last seen: Oct 27, 2016
Hello!

I am working on a SOC project for my Bachelor's thesis. As I've been struggling with linux boot for quite some time, I would be very grateful If someone could spare some time and help me out.

My SOC consists of:
- OR1200
- UART (http://opencores.org/project - uart16550)
- debugging module (made by me)
- memory controller (http://opencores.org/project - mem_ctrl)
- module for connecting it all together (also made by me)

I have setup memory controller so that I have memory:
SDRAM: from 0x0000_0000 to 0x0FFF_FFFF
FLASH: from 0x1000_0000 to 0x1FFF_FFFF

UART is on 0x9000_0000 and is using OR1200 interrupt 2.
Debugging unit is used to debug OR1200 and as RAM/FLASH loader.
OR1200 is booting from 0x1000_0100, where I configure my memory controller and jump to 0x0000_0100, where the linux code is loaded.

I am trying to boot OR linux port. These are the steps I'm using:
- I've made my own soc.dts by modifying or1ksim.dts (linux/arch/openrisc/boot/dts/). In dts I change the clock and delete the ethernet module, since I dont have it.
- make menuconfig, change builtin DTB to my soc.
- compile linux
- now I objdump vmlinux and load everything into my SDRAM by using my RAM loader (all addresses below are physical):
.text: 0x00000000
. rodata: 0x00202000
__ksymtab to : 0x00220098
__ksymtab_gpl: 0x00223cc8
__ksymtab_strings: 0x00225858
__param: 0x002313fc
.data: 0x00232000
__ex_table: 0x0024c6c0
.head.text: 0x0024e000
.init.text: 0x00252000
.init.data: 0x00263700

Am I loading linux to the right addresses? By comparing my addresses to or1ksim output, I've noticed the »offset« that I dont have.
Section: .text, vaddr: 0xc0000000, paddr: 0x0 offset: 0x00002000, size: 0x00201960
Section: .rodata, vaddr: 0xc0202000, paddr: 0x202000 offset: 0x00204000, size: 0x0001e098
...
What is the purpose of this offset? Also, is ramdisk included in the vmlinux code?

I monitor the program flow by reading the program counter, here is the result:
http://codeviewer.org/view/code:3c3e
RE: linux on custom SOC
by indirasulo on Feb 12, 2014
indirasulo
Posts: 29
Joined: Jan 12, 2012
Last seen: Sep 26, 2014
This is not uncommon to map kernel memory at some high address. OpenRISC linux port does that starting at 0xc0000000. The MMU is what translates accesses to these addresses to accesses to a physical memory.

As for the second question: yes, initramfs is included in vmlinux. Even if you don't have it you should be able to boot your linux kernel up to a meaningful error message.
RE: linux on custom SOC
by stekern on Feb 17, 2014
stekern
Posts: 84
Joined: Apr 28, 2009
Last seen: Nov 10, 2016
How do you load your kernel?
If you are not using a boot-loader that properly pass
something in r3 to the kernel as a pointer to the device-tree blob
(NULL or a real pointer), you have to manually do that before
booting the kernel.

Stefan
RE: linux on custom SOC
by rhast on Feb 17, 2014
rhast
Posts: 3
Joined: Jul 27, 2013
Last seen: Oct 27, 2016
Thanks everyone for the reply.

The problem was I didn't clean the ram between the boot retries.

Now I've encountered a new problem. Linux boot properly if I don't enable data/instruction cache. If the caches are enabled then linux hangs on:
-init started: BusyBox v1.19.0.git ... http://codeviewer.org/view/code:3c77
Program counter seems to loop at 0x00000a00.

While checking the or1200 defines I noticed that the OR1200_WB_B3 is defined. But my system doesn't support the wb_cti_o/wb_bte_o ports. If I try to undefined it I get syntax error in file or1200_wb_biu, because of the "burst_len". Since I don't want to mess up the verilog code I left the OR1200_WB_B3 defined and tried to define OR1200_NO_BURSTS but linux still hangs at the same point. (I'm using xilinx 9.1i).

Here is how I boot my system:
From FLASH at 1000_0100. I jump to 0x1000_2000 where I put all registers to 0x0000_0000.
Then I setup the memory controler. After that I copy linux code that is in FLASH to proper locations in SDRAM and I jump to SDRAM address at 0x0000_0100, where linux code is located.


RE: linux on custom SOC
by rhast on Feb 18, 2014
rhast
Posts: 3
Joined: Jul 27, 2013
Last seen: Oct 27, 2016
Ok, I've enabled only instruction cache and now it works.
no use no use 1/1 no use no use
© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.