Discussion:
[ORLinux] enable framebuffer console in linux for atlys
Daniel Herrington
2014-10-29 17:40:20 UTC
Permalink
Greetings.

I'm playing with orpsocv2 on the Digilent Atlys. I've been following the
excellent orpsocv2 tutorial by Sven Andersson over at
http://www.rte.se/blog/blogg-modesty-corex/using-orpsoc. I've got it
working using u-boot to load applications. I've also got Jonas Bonn's Linux
(git clone git://git.openrisc.net/jonas/linux) booting on my atlys board.
It presents a serial console. Now I'd like to turn on the vga framebuffer
driver to output to the HDMI port on the Atlys board (like Stefan
Kristiansson shows on
http://www.chokladfabriken.org/projects/orpsoc-atlys/news).

I tried downloading Stefan's Linux repo, but it doesn't seem to have
framebuffer support turned on (e.g., there's no defconfig for atlys, no
atlys.dts with fb0 defined, etc.). I tried manually editing the files and
rerunning "make menuconfig;make" to get framebuffer support, but the
resulting vmlinux still doesn't enable the framebuffer. I still only have
serial console support.

Is there an openrisc linux repo somewhere that has all of the relevant
updates/settings for enabling framebuffer console support on atlys?

Thanks,
Daniel
김찬
2014-10-30 06:04:32 UTC
Permalink
Did you turn on the ‘framebuffer console’ in the menuconfig? (device drivers / graphics support / console display driver support / framebuffer console support)
And you need to press Alt+F2 (or F3, F4,..) to switch to frame buffer console on the LCD.
Hope this was the case..
Chan

From: linux-***@lists.openrisc.net [mailto:linux-***@lists.openrisc.net] On Behalf Of Daniel Herrington
Sent: Thursday, October 30, 2014 2:40 AM
To: ***@lists.openrisc.net
Subject: [ORLinux] enable framebuffer console in linux for atlys

Greetings.

I'm playing with orpsocv2 on the Digilent Atlys. I've been following the excellent orpsocv2 tutorial by Sven Andersson over at http://www.rte.se/blog/blogg-modesty-corex/using-orpsoc. I've got it working using u-boot to load applications. I've also got Jonas Bonn's Linux (git clone git://git.openrisc.net/jonas/linux) booting on my atlys board. It presents a serial console. Now I'd like to turn on the vga framebuffer driver to output to the HDMI port on the Atlys board (like Stefan Kristiansson shows on http://www.chokladfabriken.org/projects/orpsoc-atlys/news).

I tried downloading Stefan's Linux repo, but it doesn't seem to have framebuffer support turned on (e.g., there's no defconfig for atlys, no atlys.dts with fb0 defined, etc.). I tried manually editing the files and rerunning "make menuconfig;make" to get framebuffer support, but the resulting vmlinux still doesn't enable the framebuffer. I still only have serial console support.

Is there an openrisc linux repo somewhere that has all of the relevant updates/settings for enabling framebuffer console support on atlys?

Thanks,
Daniel
Daniel Herrington
2014-10-31 05:23:48 UTC
Permalink
Thanks, Chan. I looked for the framebuffer console support option, but it seems to be missing from the menus when I run “make menuconfig” using the openrisc linux repo from Jonas Bonn. Is the framebuffer console menu disabled by some other option?

Daniel
Post by 김찬
Did you turn on the ‘framebuffer console’ in the menuconfig? (device drivers / graphics support / console display driver support / framebuffer console support)
And you need to press Alt+F2 (or F3, F4,..) to switch to frame buffer console on the LCD.
Hope this was the case..
Chan
Sent: Thursday, October 30, 2014 2:40 AM
Subject: [ORLinux] enable framebuffer console in linux for atlys
Greetings.
I'm playing with orpsocv2 on the Digilent Atlys. I've been following the excellent orpsocv2 tutorial by Sven Andersson over at http://www.rte.se/blog/blogg-modesty-corex/using-orpsoc. I've got it working using u-boot to load applications. I've also got Jonas Bonn's Linux (git clone git://git.openrisc.net/jonas/linux) booting on my atlys board. It presents a serial console. Now I'd like to turn on the vga framebuffer driver to output to the HDMI port on the Atlys board (like Stefan Kristiansson shows onhttp://www.chokladfabriken.org/projects/orpsoc-atlys/news).
I tried downloading Stefan's Linux repo, but it doesn't seem to have framebuffer support turned on (e.g., there's no defconfig for atlys, no atlys.dts with fb0 defined, etc.). I tried manually editing the files and rerunning "make menuconfig;make" to get framebuffer support, but the resulting vmlinux still doesn't enable the framebuffer. I still only have serial console support.
Is there an openrisc linux repo somewhere that has all of the relevant updates/settings for enabling framebuffer console support on atlys?
Thanks,
Daniel
Stefan Kristiansson
2014-10-31 05:45:56 UTC
Permalink
Post by Daniel Herrington
Thanks, Chan. I looked for the framebuffer console support option, but it
seems to be missing from the menus when I run “make menuconfig” using the
openrisc linux repo from Jonas Bonn. Is the framebuffer console menu
disabled by some other option?
A note on that, Jonas repo doesn't have the most up-to-date version of
the framebuffer driver from upstream.

Stefan
Daniel Herrington
2014-10-31 14:05:30 UTC
Permalink
Stefan,

Thanks for the replies. I had hoped to get back to you yesterday, but ran out of time. Which repo should I be starting from? I tried to download yours (git clone git://git.chokladfabriken.org/linux-openrisc/linux), but I got an error: “fatal: remote error: access denied or repository not exported: /linux-openrisc/linux." I assumed it was older than the one from Jonas.

Regarding the dts file, I put together an atlys.dts from the patch I saw mentioned here:
http://git.chokladfabriken.org/?p=orpsocv2.git;a=blobdiff;f=boards/xilinx/atlys/sw/device_tree/atlys.dts;fp=boards/xilinx/atlys/sw/device_tree/atlys.dts;h=86e6e8698d4566eb8d6aeccd5b62fa7d0906d50a;hp=27404570db6bc59367a3626e1e2a88d52459cb3d;hb=d47baa6a8cf52eba470b0735858b1bd473b184b6;hpb=717877fec46948bfa795684cf4cb8884cd2605e0

I added the bootargs you suggested and made sure to set the CONFIG_FB_OC option during “make menuconfig.”

I’ve included my atlys.dts below. When I try running the resulting linux kernel, I still don’t get the messages about the frame buffer being enabled, and no output on the HDMI. Any ideas on what else is needed?

Again, please let me know what repo I should be starting from. I even tried downloading the linux-3.17.2 tar ball directly from kernel.org and using that, but it just seemed to open up even more questions.

Thanks,
Daniel


atlys.dts:
=========
/dts-v1/;
/ {
compatible = "opencores,atlys";
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&pic>;

chosen {
bootargs = "console=tty0 console=uart,mmio,0x90000000,115200 video=ocfb:640x480-***@60";
};

***@0 {
device_type = "memory";
reg = <0x00000000 0x02000000>;
};

cpus {
#address-cells = <1>;
#size-cells = <0>;
***@0 {
compatible = "opencores,or1200-rtlsvn481";
reg = <0>;
clock-frequency = <50000000>;
};
};

/*
* OR1K PIC is built into CPU and accessed via special purpose
* registers. It is not addressable and, hence, has no 'reg'
* property.
*/
pic: pic {
compatible = "opencores,or1k-pic";
#interrupt-cells = <1>;
interrupt-controller;
};

serial0: ***@90000000 {
compatible = "opencores,uart16550-rtlsvn105", "ns16550a";
reg = <0x90000000 0x100>;
interrupts = <2>;
clock-frequency = <50000000>;
};

enet0: ***@92000000 {
compatible = "opencores,ethmac-rtlsvn338";
reg = <0x92000000 0x100>;
interrupts = <4>;
};

fb0: ***@97000000 {
compatible = "opencores,ocfb-rtlsvn64";
reg = <0x97000000 0x1000>;
};


ps2_0: ***@94000000 {
compatible = "opencores,ocps2-1.1";
reg = <0x94000000 0x2>;
interrupts = <5>;
};

ac97: ***@93000000 {
compatible = "opencores,ac97-rtlsvn21";
reg = <0x93000000 0x40>;
interrupts = <12>;
};

};
Post by Stefan Kristiansson
Post by Daniel Herrington
Thanks, Chan. I looked for the framebuffer console support option, but it
seems to be missing from the menus when I run “make menuconfig” using the
openrisc linux repo from Jonas Bonn. Is the framebuffer console menu
disabled by some other option?
A note on that, Jonas repo doesn't have the most up-to-date version of
the framebuffer driver from upstream.
Stefan
Stefan Kristiansson
2014-10-31 14:28:03 UTC
Permalink
Post by Daniel Herrington
Again, please let me know what repo I should be starting from. I even tried
downloading the linux-3.17.2 tar ball directly from kernel.org and using
that, but it just seemed to open up even more questions.
You can try the smp branch from my repo, I know that the framebuffer
works with that at least
http://git.openrisc.net/cgit.cgi/stefan/linux/tree/arch?h=smp

It's currently based on linux-3.17.
Post by Daniel Herrington
compatible = "opencores,ocfb-rtlsvn64";
reg = <0x97000000 0x1000>;
};
This is not what I pasted earlier, it should be
compatible = "opencores,ocfb";

to find out the correct compatible strings, you can search the
drivers/ directory for them .´

Stefan
김찬
2014-10-31 08:37:41 UTC
Permalink
Hi, Daniel,

When I print ‘H’ at CONFIG_FRAMEBUFFER_CONSOLE, Isee

CONFIG_FRAMEBUFFER_CONSOLE:

Low-level framebuffer-based console driver.

Symbol: FRAMEBUFFER_CONSOLE [=y]
Type : tristate
Prompt: Framebuffer Console support
Defined at drivers/video/console/Kconfig:90
Depends on: HAS_IOMEM [=y] && VT [=y] && FB [=y]
Location:
-> Device Drivers
-> Graphics support
-> Console display driver support
Selects: CRC32 [=y]
Selected by: DRM_KMS_HELPER [=n] && HAS_IOMEM [=y] && DRM [=n] && !EXPERT [=y] || DRM_NOUVEAU [=n] && STAGING [=n] && DRM [=n]\
&& PCI [=y] && !EXPERT [=y]

This means, you should turn on HAS_IOMEM, VT(virtual terminal, this may be missing in your case I guess) and FB(frame buffer, you already have in on).
Hope this helps.

Chan


From: Daniel Herrington [mailto:***@iherr.com]
Sent: Friday, October 31, 2014 2:24 PM
To: 김찬
Cc: ***@lists.openrisc.net
Subject: Re: [ORLinux] enable framebuffer console in linux for atlys

Thanks, Chan. I looked for the framebuffer console support option, but it seems to be missing from the menus when I run “make menuconfig” using the openrisc linux repo from Jonas Bonn. Is the framebuffer console menu disabled by some other option?

Daniel

On Oct 30, 2014, at 12:04 AM, 김찬 <***@etri.re.kr<mailto:***@etri.re.kr>> wrote:


Did you turn on the ‘framebuffer console’ in the menuconfig? (device drivers / graphics support / console display driver support / framebuffer console support)
And you need to press Alt+F2 (or F3, F4,..) to switch to frame buffer console on the LCD.
Hope this was the case..
Chan

From: linux-***@lists.openrisc.net<mailto:linux-***@lists.openrisc.net> [mailto:linux-***@lists.openrisc.net] On Behalf Of Daniel Herrington
Sent: Thursday, October 30, 2014 2:40 AM
To: ***@lists.openrisc.net<mailto:***@lists.openrisc.net>
Subject: [ORLinux] enable framebuffer console in linux for atlys

Greetings.

I'm playing with orpsocv2 on the Digilent Atlys. I've been following the excellent orpsocv2 tutorial by Sven Andersson over at http://www.rte.se/blog/blogg-modesty-corex/using-orpsoc. I've got it working using u-boot to load applications. I've also got Jonas Bonn's Linux (git clone git://git.openrisc.net/jonas/linux) booting on my atlys board. It presents a serial console. Now I'd like to turn on the vga framebuffer driver to output to the HDMI port on the Atlys board (like Stefan Kristiansson shows onhttp://www.chokladfabriken.org/projects/orpsoc-atlys/news).

I tried downloading Stefan's Linux repo, but it doesn't seem to have framebuffer support turned on (e.g., there's no defconfig for atlys, no atlys.dts with fb0 defined, etc.). I tried manually editing the files and rerunning "make menuconfig;make" to get framebuffer support, but the resulting vmlinux still doesn't enable the framebuffer. I still only have serial console support.

Is there an openrisc linux repo somewhere that has all of the relevant updates/settings for enabling framebuffer console support on atlys?

Thanks,
Daniel
Stefan Kristiansson
2014-10-30 09:01:13 UTC
Permalink
Post by Daniel Herrington
Greetings.
I'm playing with orpsocv2 on the Digilent Atlys. I've been following the
excellent orpsocv2 tutorial by Sven Andersson over at
http://www.rte.se/blog/blogg-modesty-corex/using-orpsoc. I've got it working
using u-boot to load applications. I've also got Jonas Bonn's Linux (git
clone git://git.openrisc.net/jonas/linux) booting on my atlys board. It
presents a serial console. Now I'd like to turn on the vga framebuffer
driver to output to the HDMI port on the Atlys board (like Stefan
Kristiansson shows on
http://www.chokladfabriken.org/projects/orpsoc-atlys/news).
I tried downloading Stefan's Linux repo, but it doesn't seem to have
framebuffer support turned on (e.g., there's no defconfig for atlys, no
atlys.dts with fb0 defined, etc.). I tried manually editing the files and
rerunning "make menuconfig;make" to get framebuffer support, but the
resulting vmlinux still doesn't enable the framebuffer. I still only have
serial console support.
Is there an openrisc linux repo somewhere that has all of the relevant
updates/settings for enabling framebuffer console support on atlys?
You'll need someting like the following in your .dts

bootargs = "console=tty0 console=uart,mmio,0x90000000,115200
video=ocfb:640x480-***@60";

...

fb0: ***@97000000 {
compatible = "opencores,ocfb";
reg = <0x97000000 0x1000>;
};

and ensure that CONFIG_FB_OPENCORES is set.
Daniel Herrington
2014-10-31 23:01:38 UTC
Permalink
Stefan,

I got the smp branch of your repo ("git clone --branch smp
git://git.openrisc.net/stefan/linux") and then ran the following steps:
1. Made sure I had added "CROSS_COMPILE=or32-elf-" and "export
CROSS_COMPILE" to my .bashrc.
2. Ran "make defconfig" to generate the or1ksim-compatible configs.
3. Ran "make" to get a vmlinux that should work with or1ksim.
4. Edited arch/openrisc/or1ksim.cfg, section uart:
a. Commented out channel = "tcp:10084"
b. Uncommented channel = "xterm:"
5. Ran "or32-elf-sim -f arch/openrisc/or1ksim.cfg vmlinux", but I got a
kernel panic (see below).

Are there other things I should've configured differently first using "make
menuconfig" before running or1ksim? Should I have skipped running "make
defconfig" and just run "make menuconfig" instead? (I wasn't sure about all
the options.)

Thanks,
Daniel

Output from or32-elf-sim:
---------------------------------
or32-elf-sim -f arch/openrisc/or1ksim.cfg vmlinux
Seeding random generator with value 0x5feea4d1
Insn MMU 0KB: 1 ways, 64 sets, entry size 1 bytes
Data MMU 0KB: 1 ways, 64 sets, entry size 1 bytes
Ethernet TAP type
Warning: ./arch/openrisc/or1ksim.cfg: Unrecognized parameter: sockif at
line 713; ignored.
Verbose on, simdebug off, interactive prompt off
Machine initialization...
Clock cycle: 10ns
No data cache.
No instruction cache.
BPB simulation off.
BTIC simulation off.
Or1ksim 2012-04-07
Building automata... done, num uncovered: 0/213.
Parsing operands data... done.
Warning: Failed to set TAP device tap0: Operation not permitted
UART at 0x90000000
Resetting Tick Timer.
Resetting Power Management.
Resetting PIC.
Starting at 0x00000000
loadcode: filename vmlinux startaddr=00000000 virtphy_transl=00000000
Not COFF file format
ELF type: 0x0002
ELF machine: 0x005c
ELF version: 0x00000001
ELF sec = 28
Section: .text, vaddr: 0xc0000000, paddr: 0x0 offset: 0x00002000, size:
0x0025b2e4
Section: .rodata, vaddr: 0xc025c000, paddr: 0x25c000 offset: 0x0025e000,
size: 0x000269b0
Section: __ksymtab, vaddr: 0xc02829b0, paddr: 0x2829b0 offset: 0x002849b0,
size: 0x00004290
Section: __ksymtab_gpl, vaddr: 0xc0286c40, paddr: 0x286c40 offset:
0x00288c40, size: 0x00002910
Section: __ksymtab_strings, vaddr: 0xc0289550, paddr: 0x289550 offset:
0x0028b550, size: 0x0000ea7e
Section: __param, vaddr: 0xc0297fd0, paddr: 0x297fd0 offset: 0x00299fd0,
size: 0x00000240
Section: .data, vaddr: 0xc029a000, paddr: 0x29a000 offset: 0x0029c000,
size: 0x0001c640
Section: __ex_table, vaddr: 0xc02b6640, paddr: 0x2b6640 offset: 0x002b8640,
size: 0x00000a00
Section: .head.text, vaddr: 0xc02b8000, paddr: 0x2b8000 offset: 0x002ba000,
size: 0x00004000
Section: .init.text, vaddr: 0xc02bc000, paddr: 0x2bc000 offset: 0x002be000,
size: 0x00013cc4
Section: .init.data, vaddr: 0xc02cfce0, paddr: 0x2cfce0 offset: 0x002d1ce0,
size: 0x00184e5c
WARNING: sim_init: Debug module not enabled, cannot start remote service to
GDB
****************** counters reset ******************
cycles 107223, insn #85980
****************** counters reset ******************
Compiled-in FDT at c02d1cc0
Linux version 3.17.0-or1ksim-14036-g32505ca (***@daniel-VirtualBox) (gcc
version 4.5.1-or32-1.0rc4 (OpenRISC 32-bit toolchain for or32-elf (built
20140930)) ) #1 Fri Oct 31 16:34:34 MDT 2014
CPU: OpenRISC-12 (revision 1) @20 MHz
-- dcache disabled
-- icache disabled
-- dmmu: 64 entries, 1 way(s)
-- immu: 64 entries, 1 way(s)
-- additional features:
-- power management
-- timer
setup_memory: Memory: 0x0-0x2000000
Reserved - 0x01fff270-0x00000d57
Setting up paging and PTEs.
map_ram: Memory: 0x0-0x2000000
itlb_miss_handler c0002160
dtlb_miss_handler c0002000
OpenRISC Linux -- http://openrisc.net
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 4080
Kernel command line: console=uart,mmio,0x90000000,115200
Early serial console at MMIO 0x90000000 (options '115200')
bootconsole [uart0] enabled
PID hash table entries: 128 (order: -4, 512 bytes)
Dentry cache hash table entries: 4096 (order: 1, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 0, 8192 bytes)
Sorting __ex_table...
Memory: 27992K/32768K available (2412K kernel code, 116K rwdata, 248K
rodata, 1656K init, 82K bss, 4776K reserved)
mem_init_done ...........................................
NR_IRQS:32
40.00 BogoMIPS (lpj=200000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 0, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes)
devtmpfs: initialized
NET: Registered protocol family 16
Switched to clocksource openrisc_timer
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 0, 8192 bytes)
TCP bind hash table entries: 2048 (order: 0, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
UDP hash table entries: 512 (order: 0, 8192 bytes)
UDP-Lite hash table entries: 512 (order: 0, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
futex hash table entries: 256 (order: -2, 3072 bytes)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
90000000.serial: ttyS0 at MMIO 0x90000000 (irq = 2, base_baud = 1250000) is
a 16550A
console [ttyS0] enabled
console [ttyS0] enabled
bootconsole [uart0] disabled
bootconsole [uart0] disabled
libphy: ethoc-mdio: probed
NET: Registered protocol family 17
Freeing unused kernel memory: 1656K (c02b8000 - c0456000)
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000007

---[ end Kernel panic - not syncing: Attempted to kill init!
exitcode=0x00000007


-------Original Message-------
From: Stefan Kristiansson <***@saunalahti.fi>
To: Daniel Herrington <***@iherr.com>
Cc: 김찬 <***@etri.re.kr>, ***@lists.openrisc.net
<***@lists.openrisc.net>
Subject: Re: [ORLinux] enable framebuffer console in linux for atlys
Sent: Oct 31 '14 8:28am
Again, please let me know what repo I should be starting from. I even
tried
downloading the linux-3.17.2 tar ball directly from kernel.org and using
that, but it just seemed to open up even more questions.
You can try the smp branch from my repo, I know that the framebuffer
works with that at least
[LINK: http://git.openrisc.net/cgit.cgi/stefan/linux/tree/arch?h=smp]
http://git.openrisc.net/cgit.cgi/stefan/linux/tree/arch?h=smp

It's currently based on linux-3.17.
compatible = "opencores,ocfb-rtlsvn64";
reg = ;
};
This is not what I pasted earlier, it should be
compatible = "opencores,ocfb";

to find out the correct compatible strings, you can search the
drivers/ directory for them .Ž

Stefan
Stefan Kristiansson
2014-11-01 07:49:58 UTC
Permalink
Post by Daniel Herrington
Stefan,
I got the smp branch of your repo ("git clone --branch smp git://
1. Made sure I had added "CROSS_COMPILE=or32-elf-" and "export
CROSS_COMPILE" to my .bashrc.
2. Ran "make defconfig" to generate the or1ksim-compatible configs.
3. Ran "make" to get a vmlinux that should work with or1ksim.
a. Commented out channel = "tcp:10084"
b. Uncommented channel = "xterm:"
5. Ran "or32-elf-sim -f arch/openrisc/or1ksim.cfg vmlinux", but I got a
kernel panic (see below).
Oh, right sorry, this slipped my mind.
The userspace (busybox) that comes with my smp branch makes use of the
atomic instructions, and I assume that your or1ksim is not built from git
HEAD?
Anyway, you can either update your or1ksim (and remember to use a recent
version of mor1kx that has support for these instructions when you try on
the actual HW),
or just copy the userspace from e.g. Jonas repo (everything in
arch/openrisc/support/).

Stefan
Daniel Herrington
2014-11-01 19:01:05 UTC
Permalink
Stefan,

I copied the userspace from Jonas' repo and reran the make process. The resulting run of my original or1ksim is shown below (it errors out and can’t open ‘/‘). So then I reran the make process with the original userspace, downloaded and installed the git HEAD version of or1ksim, and reran the simulator, and this time it worked. Now if I want to use a more recent version of mor1kx for the HW build as you suggested, how can I do that using the orpsocv2 file set? Or do I have to start over with orpsocv3?

Thanks,
Daniel
Post by Daniel Herrington
or32-elf-sim -f arch/openrisc/or1ksim.cfg vmlinux
Seeding random generator with value 0x01699a42
Insn MMU 0KB: 1 ways, 64 sets, entry size 1 bytes
Data MMU 0KB: 1 ways, 64 sets, entry size 1 bytes
Ethernet TAP type
Warning: ./arch/openrisc/or1ksim.cfg: Unrecognized parameter: sockif at line 714; ignored.
Verbose on, simdebug off, interactive prompt off
Machine initialization...
Clock cycle: 10ns
No data cache.
No instruction cache.
BPB simulation off.
BTIC simulation off.
Or1ksim 2012-04-27
Building automata... done, num uncovered: 0/213.
Parsing operands data... done.
Warning: Failed to set TAP device tap0: Operation not permitted
UART at 0x90000000
Resetting Tick Timer.
Resetting Power Management.
Resetting PIC.
Starting at 0x00000000
loadcode: filename vmlinux startaddr=00000000 virtphy_transl=00000000
Not COFF file format
ELF type: 0x0002
ELF machine: 0x005c
ELF version: 0x00000001
ELF sec = 28
Section: .text, vaddr: 0xc0000000, paddr: 0x0 offset: 0x00002000, size: 0x0025b314
Section: .rodata, vaddr: 0xc025c000, paddr: 0x25c000 offset: 0x0025e000, size: 0x000269d8
Section: __ksymtab, vaddr: 0xc02829d8, paddr: 0x2829d8 offset: 0x002849d8, size: 0x00004290
Section: __ksymtab_gpl, vaddr: 0xc0286c68, paddr: 0x286c68 offset: 0x00288c68, size: 0x00002910
Section: __ksymtab_strings, vaddr: 0xc0289578, paddr: 0x289578 offset: 0x0028b578, size: 0x0000ea7e
Section: __param, vaddr: 0xc0297ff8, paddr: 0x297ff8 offset: 0x00299ff8, size: 0x00000240
Section: .data, vaddr: 0xc029a000, paddr: 0x29a000 offset: 0x0029c000, size: 0x0001c640
Section: __ex_table, vaddr: 0xc02b6640, paddr: 0x2b6640 offset: 0x002b8640, size: 0x00000a00
Section: .head.text, vaddr: 0xc02b8000, paddr: 0x2b8000 offset: 0x002ba000, size: 0x00004000
Section: .init.text, vaddr: 0xc02bc000, paddr: 0x2bc000 offset: 0x002be000, size: 0x00013cc4
Section: .init.data, vaddr: 0xc02cfce0, paddr: 0x2cfce0 offset: 0x002d1ce0, size: 0x0014b45c
WARNING: sim_init: Debug module not enabled, cannot start remote service to GDB
****************** counters reset ******************
cycles 107223, insn #85980
****************** counters reset ******************
Compiled-in FDT at c02d1cc0
Linux version 3.17.0-or1ksim-14036-g32505ca-dirty (***@ubuntugnome1404lts) (gcc version 4.5.1-or32-1.0rc4 (OpenRISC 32-bit toolchain for or32-linux (built 20140929)) ) #1 Sat Nov 1 10:04:22 MDT 2014
CPU: OpenRISC-12 (revision 1) @20 MHz
-- dcache disabled
-- icache disabled
-- dmmu: 64 entries, 1 way(s)
-- immu: 64 entries, 1 way(s)
-- additional features:
-- power management
-- timer
setup_memory: Memory: 0x0-0x2000000
Reserved - 0x01fff270-0x00000d57
Setting up paging and PTEs.
map_ram: Memory: 0x0-0x2000000
itlb_miss_handler c0002160
dtlb_miss_handler c0002000
OpenRISC Linux -- http://openrisc.net
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 4080
Kernel command line: console=uart,mmio,0x90000000,115200
Early serial console at MMIO 0x90000000 (options '115200')
bootconsole [uart0] enabled
PID hash table entries: 128 (order: -4, 512 bytes)
Dentry cache hash table entries: 4096 (order: 1, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 0, 8192 bytes)
Sorting __ex_table...
Memory: 28224K/32768K available (2412K kernel code, 116K rwdata, 248K rodata, 1424K init, 82K bss, 4544K reserved)
mem_init_done ...........................................
NR_IRQS:32
40.00 BogoMIPS (lpj=200000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 0, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes)
devtmpfs: initialized
NET: Registered protocol family 16
Switched to clocksource openrisc_timer
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 0, 8192 bytes)
TCP bind hash table entries: 2048 (order: 0, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
UDP hash table entries: 512 (order: 0, 8192 bytes)
UDP-Lite hash table entries: 512 (order: 0, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
futex hash table entries: 256 (order: -2, 3072 bytes)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
90000000.serial: ttyS0 at MMIO 0x90000000 (irq = 2, base_baud = 1250000) is a 16550A
console [ttyS0] enabled
console [ttyS0] enabled
bootconsole [uart0] disabled
bootconsole [uart0] disabled
libphy: ethoc-mdio: probed
NET: Registered protocol family 17
Freeing unused kernel memory: 1424K (c02b8000 - c041c000)
init: can't open '/': Function not implemented
Post by Daniel Herrington
Stefan,
1. Made sure I had added "CROSS_COMPILE=or32-elf-" and "export CROSS_COMPILE" to my .bashrc.
2. Ran "make defconfig" to generate the or1ksim-compatible configs.
3. Ran "make" to get a vmlinux that should work with or1ksim.
a. Commented out channel = "tcp:10084"
b. Uncommented channel = "xterm:"
5. Ran "or32-elf-sim -f arch/openrisc/or1ksim.cfg vmlinux", but I got a kernel panic (see below).
Oh, right sorry, this slipped my mind.
The userspace (busybox) that comes with my smp branch makes use of the atomic instructions, and I assume that your or1ksim is not built from git HEAD?
Anyway, you can either update your or1ksim (and remember to use a recent version of mor1kx that has support for these instructions when you try on the actual HW),
or just copy the userspace from e.g. Jonas repo (everything in arch/openrisc/support/).
Stefan
Stefan Kristiansson
2014-11-03 12:47:53 UTC
Permalink
Post by Daniel Herrington
Stefan,
I copied the userspace from Jonas' repo and reran the make process. The
resulting run of my original or1ksim is shown below (it errors out and can’t
open ‘/‘).
Right, sorry, again things slipped my mind. That old userspace
wouldn't work with the upstream kernel.
Post by Daniel Herrington
So then I reran the make process with the original userspace,
downloaded and installed the git HEAD version of or1ksim, and reran the
simulator, and this time it worked.
Great.
Post by Daniel Herrington
Now if I want to use a more recent
version of mor1kx for the HW build as you suggested, how can I do that using
the orpsocv2 file set? Or do I have to start over with orpsocv3?
Using fusesoc/orpsoc-cores is recommended, but you should be able to
use the latest mor1kx with orpsocv2 as well.
All you need to do is copy the files into the mor1kx directory (and
maybe update some makefiles with potential new files).

That said, your issues with the old or1ksim and my repo made me
pick-up an item from my TODO-list, to add emulation for the atomic
instructions in the kernel.
This is what I've got so far:
http://git.openrisc.net/cgit.cgi/stefan/linux/commit/?h=smp&id=54d6703876d7b30fa98f9210a324f9c066a6
It seems to work as far as I've tested, but some more usage would be
appreciated.
I.e., it should be possible to run that branch on implementations
without the atomic instructions.

Stefan
Daniel Herrington
2014-11-06 16:14:23 UTC
Permalink
Stefan,

Thanks for all the help. I realized I didn't really need Linux, just bare
metal. I was able to use your git HEAD repo of orpsocv2 on
chokladfabriken.org (I made a few edits to enable the upper gpio bits for
the switches and buttons on the atlys board). Last night I was able to
write a simple vga test program to put the vga/lcd core into
8-bit-grayscale 640x480 mode and write a gradient to the pixels. It's
working!!! Now I can get back to my real goal... adding a custom peripheral
for some co-processing in hardware.

Best regards,
Daniel


vga_test.c:
----------------------------
#include <stdlib.h>
#include "stdio.h"
#include "board.h"
#include "oc_vga_lcd.h"

#define write8(addr,val) (*(unsigned char*) (addr) = (val))
#define read8(addr) (*(unsigned char*) (addr))
#define write32(addr,val) (*(int*) (addr) = (val))
#define read32(addr) (*(int*) (addr))
typedef unsigned int u32;

int main(int argc, char *argv[]) {

unsigned char *fb_phys;

/* 640x480 @ 60 Hz, 31.5 kHz hsync */
u32 xres = 640;
u32 yres = 480;
u32 pixclock = 39721;
u32 left_margin = 40;
u32 right_margin = 24;
u32 upper_margin = 32;
u32 lower_margin = 11;
u32 hsync_len = 96;
u32 vsync_len = 2;

u32 hlen, vlen;
u32 fb_x, fb_y;

unsigned char val = 0;

fb_phys = (unsigned char *) calloc(xres*yres, sizeof(unsigned char));

if (fb_phys == NULL) {
printf("Could not allocate memory for framebuffer!\n");
while (1);
return 1;
} else {
printf("Allocated framebuffer successfully at address=%8.8x\n", fb_phys);
}

printf("Writing image to framebuffer...\n");
for (fb_y = 0; fb_y < yres; fb_y++) {
for (fb_x = 0; fb_x < xres; fb_x++) {
write8(fb_phys+fb_y*xres+fb_x, val++);
}
}

printf("Setting up vga/lcd regs...\n");
write32(VGA0_BASE+OC_VGA_HTIM,
(hsync_len - 1) << 24 |
(right_margin - 1) << 16 |
(xres - 1)
);
write32(VGA0_BASE+OC_VGA_VTIM,
(vsync_len - 1) << 24 |
(lower_margin - 1) << 16 |
(yres - 1)
);

hlen = left_margin + right_margin + hsync_len + xres;
vlen = upper_margin + lower_margin + vsync_len + yres;

write32(VGA0_BASE+OC_VGA_HVLEN,
(hlen - 1) << 16 | (vlen - 1)
);

write32(VGA0_BASE+OC_VGA_VBARA, (u32) fb_phys);
write32(VGA0_BASE+OC_VGA_VBARB, (u32) fb_phys);

printf("Enabling VGA now...\n");
write32(VGA0_BASE+OC_VGA_CTRL, OC_VGA_VEN);

while(1);

free(fb_phys);
return 0;
}



-------Original Message-------
From: Stefan Kristiansson <***@saunalahti.fi>
To: Daniel Herrington <***@iherr.com>
Cc: Stefan Kristiansson <***@saunalahti.fi>, 김찬
<***@etri.re.kr>, ***@lists.openrisc.net <***@lists.openrisc.net>
Subject: Re: [ORLinux] enable framebuffer console in linux for atlys
Sent: Nov 03 '14 5:48am
Post by Daniel Herrington
Stefan,
I copied the userspace from Jonas' repo and reran the make process. The
resulting run of my original or1ksim is shown below (it errors out and can’t
open ‘/‘).
Right, sorry, again things slipped my mind. That old userspace
wouldn't work with the upstream kernel.
Post by Daniel Herrington
So then I reran the make process with the original userspace,
downloaded and installed the git HEAD version of or1ksim, and reran the
simulator, and this time it worked.
Great.
Post by Daniel Herrington
Now if I want to use a more recent
version of mor1kx for the HW build as you suggested, how can I do that using
the orpsocv2 file set? Or do I have to start over with orpsocv3?
Using fusesoc/orpsoc-cores is recommended, but you should be able to
use the latest mor1kx with orpsocv2 as well.
All you need to do is copy the files into the mor1kx directory (and
maybe update some makefiles with potential new files).

That said, your issues with the old or1ksim and my repo made me
pick-up an item from my TODO-list, to add emulation for the atomic
instructions in the kernel.
This is what I've got so far:
[LINK:
http://git.openrisc.net/cgit.cgi/stefan/linux/commit/?h=smp&id=54d6703876d7b30fa98f9210a324f9c066a6]
http://git.openrisc.net/cgit.cgi/stefan/linux/commit/?h=smp&id=54d6703876d7b30fa98f9210a324f9c066a6
It seems to work as far as I've tested, but some more usage would be
appreciated.
I.e., it should be possible to run that branch on implementations
without the atomic instructions.

Stefan

Loading...