Page 1 of 1

Raspberry Pi C Tutorial - Compilation gives errors

Posted: Mon Nov 24, 2014 2:23 pm
by Martin
Hello people,

I am currently testing my workspace. I have successfully built my cross compiler, but when I try to compile the 'echokernel' from the Raspberry Pi C tutorial I am receiving some errors. The compilers tells me that the uart_init(), uart_puts(hello) and uart_puts(halting) are undefined references. I can't understand why I am receiving the errors I tested it a time with all the code from that page.

Image

I did put the corresponding C and H files into the include folder. I still do not know why I am getting this error because I am sure I have everything good.

- Martin

Re: Raspberry Pi C Tutorial - Compilation gives errors

Posted: Mon Nov 24, 2014 3:48 pm
by sortie
Please don't use screenshots. Make a textual copy of all the commands you used and the output.

I'll dare guess you simply forgot to link with uart.o (made from uart.c). I assume this should be obvious to those skilled with C and GCC.

Beware, I haven't read that tutorial closely, but it looks like it could use some clean up and be more consistent with other bare bones tutorials.

Re: Raspberry Pi C Tutorial - Compilation gives errors

Posted: Mon Nov 24, 2014 4:00 pm
by Martin
Thanks for the tip about the terminal output. :)

The tutorial needs some cleanup indeed. I found a fault in the Makefile.

I will take a look at the point why I (maybe) not be linking the files in my include-directory.

Edit: I have compiled it again, and I have not spotted any .o files in the include folder. I have succeeded in adding the folder (and its contents) to the objs variable. But now make gives me a error that it there is no make target 'include/mmio.o'.

Re: Raspberry Pi C Tutorial - Compilation gives errors

Posted: Mon Nov 24, 2014 6:25 pm
by sortie
I recommend you learn C. Headers are included, not compiled on their own. Get used to user space normal C programming, then try osdev again when you get accustomed to that.

I recommend you throw away the Makefile and just use raw shell commands to compile. When that works, I recommend you learn Make and write your own Makefile.

Re: Raspberry Pi C Tutorial - Compilation gives errors

Posted: Tue Nov 25, 2014 12:29 am
by no92
Once again, read the wiki closely before asking stupid questions here (I don't want to sound harsh, but you have to know userspace C very well to be able to start OSdeving). See Beginner_Mistakes and Required_Knowledge