



Compile executable for linux
by ANGELOFFATE on Mar 28, 2014 |
ANGELOFFATE
Posts: 4 Joined: Jul 19, 2013 Last seen: Oct 1, 2014 |
||
Hi!
I am really new to this kind of developement, and i am in trouble with this system. I have an altera ORSoC developement board. I have downloaded the Virtualbox image i have found on the ORSoC page, and i sucseeded in uploading the SoC and the LINUX on it. It is working like it should. My problem is that i want to write some program that i can run on it, and i dont know how to compile them. Do i need a newer toolchain for it, or i can do it with the one in the vbox image? What switches i have to use for compiling? Please help me i am really newbie here. Maybe write me some example, what do i have to write in the terminal. Thank You Regards Szabolcs |
RE: Compile executable for linux
by ANGELOFFATE on Mar 28, 2014 |
ANGELOFFATE
Posts: 4 Joined: Jul 19, 2013 Last seen: Oct 1, 2014 |
||
Now actually i succeeded to compile a simple c file and it runs, but when i try to compile some more complicated, it gives the error:
fatal error: linux/module.h: No such file or directory What do i have to change, so that it finds the headers? Thank You |
RE: Compile executable for linux
by indirasulo on Mar 31, 2014 |
indirasulo
Posts: 29 Joined: Jan 12, 2012 Last seen: Sep 26, 2014 |
||
What are you trying to build? Which toolchain are you using? Normally you will need a *-linux-uclibc toolchain to compile a linux userspace application.
|
RE: Compile executable for linux
by ANGELOFFATE on Apr 11, 2014 |
ANGELOFFATE
Posts: 4 Joined: Jul 19, 2013 Last seen: Oct 1, 2014 |
||
Hi!
I use 4.5.1-or32-1.0rc4 version of the gcc for compiling. I want to create a little program with which i can manipulate a physical register. I know the address of that register. I know that this is not so simple because there is user space and kernel space and things like that, but the only example program i found is this: http://www.freesoftwaremagazine.com/articles/drivers_linux and this uses includes that i cant, because if i try to include them, the gcc tells me that they are missing. I tried to copy theese files from elsewhere to the root where the gcc seeks, but than other error message came: error: expected �=�, �,�, �;�, �asm� or �__attribute__� before �parse_early_param� but theese headers are probably good so i dont know what to do now or how to start. So my main purpos is to read and write a register wich is on the system bus. And i need to know how can i do it, what headers i have to include and what functions i have to use? Thank you |
RE: Compile executable for linux
by indirasulo on Apr 12, 2014 |
indirasulo
Posts: 29 Joined: Jan 12, 2012 Last seen: Sep 26, 2014 |
||
So my main purpos is to read and write a register wich is on the system bus. And i need to know how can i do it, what headers i have to include and what functions i have to use?
Ok. So then, for start, just make a kernel module as your article suggests. I assume that you've already compiled a linux kernel for openrisc. Then what you need to do is to add your module to your kernel source tree (add your module .c file and modify appropriate Makefile) - nothing specific to openrisc here, you will find all needed information in instructions for linux on other platforms. You can work with registers using normal C pointers. Something like this: (*volatile unsigned int)0x90000004 = 0x42; But you should NOT do this. Instead use ioread32(iowrite32) and ioread32be(iowrite32be) functions (look at drivers/net/ethernet/ethoc.c for sample). |
RE: Compile executable for linux
by indirasulo on Apr 12, 2014 |
indirasulo
Posts: 29 Joined: Jan 12, 2012 Last seen: Sep 26, 2014 |
||
So basically my idea is that, if you can compile your kernel, then just let kernel Makefiles handle includes for your kernel module.
|



