Raspberry Pi C Tutorial - Compilation gives errors

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Martin
Posts: 2
Joined: Sat Nov 22, 2014 5:44 pm
Location: The Netherlands
Contact:

Raspberry Pi C Tutorial - Compilation gives errors

Post 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
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Raspberry Pi C Tutorial - Compilation gives errors

Post 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.
Martin
Posts: 2
Joined: Sat Nov 22, 2014 5:44 pm
Location: The Netherlands
Contact:

Re: Raspberry Pi C Tutorial - Compilation gives errors

Post 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'.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Raspberry Pi C Tutorial - Compilation gives errors

Post 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.
no92
Member
Member
Posts: 307
Joined: Wed Oct 30, 2013 1:57 pm
Libera.chat IRC: no92
Location: Germany
Contact:

Re: Raspberry Pi C Tutorial - Compilation gives errors

Post 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
Post Reply