1/1

|
How to incorporate user-land c-app in the linux kernel for or1200
by avamsi on May 1, 2012 |
avamsi
Posts: 54 Joined: Apr 16, 2012 Last seen: Jul 30, 2014 |
||
|
Hi,
I complied the Linux kernel for or1200 with or-32-elf(newlib) and some simple c-program using or-32-Linux(uclinc). Now I would like to run both the kernel and c-program together on simulator.Means user app should run on boot in the simulator. For that please state the steps required to incorporate the binaries of c-app into the kernel source and what files I need to modify in the kernel source. Thanks in advance, A.vamsi |
|||
|
RE: How to incorporate user-land c-app in the linux kernel for or1200
by jeremybennett on May 1, 2012 |
jeremybennett
Posts: 815 Joined: May 29, 2008 Last seen: Jun 13, 2019 |
||
|
Hi A Vamsi Two approaches I suggest:
This should get you going. If you are stuck, I suggest you ask for help on IRC at freenode.net, channel #opencores. Jeremy
-- |
|||
|
RE: How to incorporate user-land c-app in the linux kernel for or1200
by avamsi on May 1, 2012 |
avamsi
Posts: 54 Joined: Apr 16, 2012 Last seen: Jul 30, 2014 |
||
|
Hi Jeremy,
Thank you for your reply. Actually I tried to boot Linux kernel in the simulator. After some boot process, it tried to connect to GDB. But I could not understand how to connect them through sockets. Can you kindly show me the path where it was explained clearly.Do I have to modify any debug options in the config file or any thing to do on host PC network side. These are the options I choose in the or1ksim.cfg file:: section debug enabled = 1 gdb_enabled = 0 server_port = 9999 /* rsp_enabled = 1 */ /* rsp_port = 50001 */ end Here is the log I am getting when I tried to booting the linux kernel:: avamsi@avamsi01:~/OpenRISC/gnu-src/linux$ or32-elf-sim -f arch/openrisc/or1ksim.cfg vmlinux Seeding random generator with value 0x3947d895 Insn MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Data MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Warning: ./arch/openrisc/or1ksim.cfg: Unrecognized parameter: gdb_enabled at line 543; ignored. Warning: ./arch/openrisc/or1ksim.cfg: Unrecognized parameter: server_port at line 544; ignored. Ethernet TAP type Warning: ./arch/openrisc/or1ksim.cfg: Unrecognized parameter: sockif at line 713; ignored. Verbose on, simdebug on, interactive prompt off Machine initialization... Clock cycle: 10ns No data cache. No instruction cache. BPB simulation off. BTIC simulation off. Or1ksim 2012-03-23 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: 0x002010e0 Section: .rodata, vaddr: 0xc0202000, paddr: 0x202000 offset: 0x00204000, size: 0x0001e028 Section: __ksymtab, vaddr: 0xc0220028, paddr: 0x220028 offset: 0x00222028, size: 0x00003c08 Section: __ksymtab_gpl, vaddr: 0xc0223c30, paddr: 0x223c30 offset: 0x00225c30, size: 0x00001b90 Section: __ksymtab_strings, vaddr: 0xc02257c0, paddr: 0x2257c0 offset: 0x002277c0, size: 0x0000bb6b Section: __param, vaddr: 0xc023132c, paddr: 0x23132c offset: 0x0023332c, size: 0x000001f0 Section: .data, vaddr: 0xc0232000, paddr: 0x232000 offset: 0x00234000, size: 0x0001b460 Section: __ex_table, vaddr: 0xc024d460, paddr: 0x24d460 offset: 0x0024f460, size: 0x000009f0 Section: .head.text, vaddr: 0xc024e000, paddr: 0x24e000 offset: 0x00250000, size: 0x00004000 Section: .init.text, vaddr: 0xc0252000, paddr: 0x252000 offset: 0x00254000, size: 0x00011668 Section: .init.data, vaddr: 0xc0263680, paddr: 0x263680 offset: 0x00265680, size: 0x0014b0ac ****************** counters reset ****************** cycles 72699, insn #58360 ****************** counters reset ****************** Compiled-in FDT at c02657c0 Linux version 3.4.0-rc2 (avamsi@avamsi01) (gcc version 4.5.1-or32-1.0rc4 (OpenRISC 32-bit toolchain for or32-elf (built 20120424)) ) #7 Tue May 1 11:47:45 IST 2012 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: -- debug unit -- PIC -- timer setup_memory: Memory: 0x0-0x2000000 Reserved - 0x01ffda90-0x00002570 Setting up paging and PTEs. map_ram: Memory: 0x0-0x2000000 On node 0 totalpages: 4096 free_area_init_node: node 0, pgdat c024c6b8, node_mem_map c03c4000 Normal zone: 16 pages used for memmap Normal zone: 0 pages reserved Normal zone: 4080 pages, LIFO batch:0 dtlb_miss_handler c0002000 itlb_miss_handler c0002108 OpenRISC Linux -- http://openrisc.net pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 pcpu-alloc: [0] 0 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) Memory: 28680k/32768k available (2052k kernel code, 4088k reserved, 304k data, 1416k init, 0k highmem) mem_init_done ........................................... NR_IRQS:32 40.00 BogoMIPS (lpj=200000) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 1024 devtmpfs: initialized NET: Registered protocol family 16 Switching to clocksource openrisc_timer NET: Registered protocol family 2 IP route cache hash table entries: 2048 (order: 0, 8192 bytes) TCP established hash table entries: 1024 (order: 0, 8192 bytes) TCP bind hash table entries: 1024 (order: -1, 4096 bytes) TCP: Hash tables configured (established 1024 bind 1024) 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. Unpacking initramfs Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled 90000000.serial: ttyS0 at MMIO 0x90000000 (irq = 2) is a 16550A console [ttyS0] enabled, bootconsole disabled console [ttyS0] enabled, bootconsole disabled ethoc-mdio: probed NET: Registered protocol family 17 Freeing unused kernel memory: 1416k freed init started: BusyBox v1.19.0.git (2011-02-16 08:10:12 CET) Configuring loopback device Here it is waiting, please explain the next steps to be followed. Thanks, A.Vamsi |
|||
|
RE: How to incorporate user-land c-app in the linux kernel for or1200
by jeremybennett on May 1, 2012 |
jeremybennett
Posts: 815 Joined: May 29, 2008 Last seen: Jun 13, 2019 |
||
|
Hi A Vamsi, You don't want GDB enabled for your Or1ksim. If you connect GDB, it will be to debug your application running under Linux, not directly (which would debug the kernel code). So disable GDB. You also need to make sure that you have configured a suitable connection to the UART, which will act as your Linux console. Most people use the xterm option - the Or1ksim user guide has details. I haven't looked at the Linux distribution recently, but I understand it includes an Or1ksim configuration suitable for booting Linux. Have a look in the source tree to see if you can find it. Once you have Linux up and running, you can run your application. If you wish to debug it, use gdbserver. Suppose your Linux has IP address 192.168.0.100, and you choose to debug over port 51000. If your program is called "hello-world", then on the Linux console you would run: # gdbserver :51000 hello-world You could then connect using gdb on your host work station: $ or32-elf-gdb hello-world ... (gdb) target remote 192.168.0.100:51000 (gdb) You must have a copy of your program both on the Linux simulation (see my previous post) and on the workstation (so the GDB client can read its symbols). HTH Jeremy |
|||
|
RE: How to incorporate user-land c-app in the linux kernel for or1200
by avamsi on May 3, 2012 |
avamsi
Posts: 54 Joined: Apr 16, 2012 Last seen: Jul 30, 2014 |
||
|
Hi Jeremy,
Thank you for your inputs. I followed the steps that you stated in the reply. I kept the executable files in the created folder alongside the bin folder in the initramfs. I recompiled the kernel. But the executables are not being run upon the kernel boot. I had to go to that location on the linux console and execute it. Can you explain, where exactly I have place it to run itself upon kernel boot. do I have to add any script file for running them. One more issue is when I tried to debug the user mode app using GDB, it was showing that command was not found when I gave command like gdbserver :50001 hello.elf on linux console(xterm). The or1ksim.config setting are section debug enabled = 0 /* gdb_enabled = 0 server_port = 9999 */ rsp_enabled = 1 rsp_port = 50001 end I am using the default setting what ever are provided, Do I need to modify any of those setting in the config file or in the linux kernel source. Thanks, A.vamsi |
|||
|
RE: How to incorporate user-land c-app in the linux kernel for or1200
by jeremybennett on May 4, 2012 |
jeremybennett
Posts: 815 Joined: May 29, 2008 Last seen: Jun 13, 2019 |
||
|
Hi Jeremy, Thank you for your inputs. I followed the steps that you stated in the reply. I kept the executable files in the created folder alongside the bin folder in the initramfs. I recompiled the kernel. But the executables are not being run upon the kernel boot. I had to go to that location on the linux console and execute it. Can you explain, where exactly I have place it to run itself upon kernel boot. do I have to add any script file for running them. Hi A Vamsi If you want the program to run at startup, you could invoke it at the end of the script (in initramfs) /etc/init.d/rcS, which is executed when the console starts up. One more issue is when I tried to debug the user mode app using GDB, it was showing that command was not found when I gave command like gdbserver :50001 hello.elf on linux console(xterm). The or1ksim.config setting are section debug enabled = 0 /* gdb_enabled = 0 server_port = 9999 */ rsp_enabled = 1 rsp_port = 50001 end I am using the default setting what ever are provided, Do I need to modify any of those setting in the config file or in the linux kernel source. gdbserver is a user space application. You have to build it and get it into your Linux system like your own application. Details are on the Wiki at http://opencores.org/or1k/OpenRISC_GNU_tool_chain#Building_gdbserver. HTH Jeremy |
|||
|
RE: How to incorporate user-land c-app in the linux kernel for or1200
by avamsi on May 4, 2012 |
avamsi
Posts: 54 Joined: Apr 16, 2012 Last seen: Jul 30, 2014 |
||
|
Hi Jeremy,
I followed the same steps as you suggested for building gdbserver. But it is giving following errors. avamsi@avamsi01:~/OpenRISC/gnu-src/bd-linux-gdb/gdb/gdbserver$ make gcc -c -Wall -g -O2 -I. -I../../../gdb-7.2/gdb/gdbserver -I../../../gdb-7.2/gdb/gdbserver/../common -I../../../gdb-7.2/gdb/gdbserver/../regformats -I../../../gdb-7.2/gdb/gdbserver/../../include ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:64: error: �PT_GPR31� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:64: error: �PT_SP� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:64: error: �PT_GPR2� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:64: error: �PT_GPR3� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:65: error: �PT_GPR4� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:65: error: �PT_GPR5� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:65: error: �PT_GPR6� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:65: error: �PT_GPR7� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:66: error: �PT_GPR8� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:66: error: �PT_GPR9� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:66: error: �PT_GPR10� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:66: error: �PT_GPR11� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:67: error: �PT_GPR12� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:67: error: �PT_GPR13� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:67: error: �PT_GPR14� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:67: error: �PT_GPR15� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:68: error: �PT_GPR16� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:68: error: �PT_GPR17� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:68: error: �PT_GPR18� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:68: error: �PT_GPR19� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:69: error: �PT_GPR20� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:69: error: �PT_GPR21� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:69: error: �PT_GPR22� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:69: error: �PT_GPR23� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:70: error: �PT_GPR24� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:70: error: �PT_GPR25� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:70: error: �PT_GPR26� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:70: error: �PT_GPR27� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:71: error: �PT_GPR28� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:71: error: �PT_GPR29� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:71: error: �PT_GPR30� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:72: error: �PT_PC� undeclared here (not in a function) ../../../gdb-7.2/gdb/gdbserver/linux-or32-low.c:72: error: �PT_SR� undeclared here (not in a function) make: *** [linux-or32-low.o] Error 1 I am using the tool chain which was build with uClibc only. But it seems the header file is missing. I searched for those definitions in the gdb7.2, but not found. I tried to use gdb6.8 and 7.1. But it is showing "Error: target not supported by gdbserver" during configuration itself. Can I get the binaries from you if it is available. I doubt it may not work out here. Please find the solution whether it is header file problem or not. thanks, A.vamsi |
|||
1/1

