Page 1 of 1

Cambridge OS tutorial

Posted: Sun Sep 30, 2012 3:43 pm
by khisanth
Whilst this is a superb course, is great for explaining how everything works and I have learnt a lot already I have fallen over at the first hurdle i.e. the make command!

You follow everything, install software it asks you to (did this on both Mac OS and Windows), created the main.s file with everything copied in as instructed. It then says to use the make command. Now entering make asks for a target file and destination file, pointing it at main.s gives an error saying no makefile information etc etc.

What am I missing? Anyone recommend a clear tutorial on the make command? I have seen plenty but they are not very beginner friendly or useful :cry:

Re: Cambridge OS tutorial

Posted: Mon Oct 01, 2012 9:26 pm
by trinigooner
I'm also new to Make. I found this very basic tutorial helpful: http://www.cs.colby.edu/maxwell/courses ... maketutor/

I'm sure there are much better ones out there! I just happened to need this yesterday and it came up pretty early in my google search.
HTH!

Re: Cambridge OS tutorial

Posted: Mon Oct 01, 2012 11:02 pm
by Dasaan
If you downloaded the Template file structure then you need to run make in the same directory that the Makefile is in.

If you didn't download the Template file structure then I'd highly recommend that you do.

Re: Cambridge OS tutorial

Posted: Tue Oct 02, 2012 11:03 am
by khisanth
downloaded it but it wasnt in that directory, thanks!

Re: Cambridge OS tutorial

Posted: Tue Oct 02, 2012 10:08 pm
by khisanth
I have the template, put main.s in that directory with the makefile and get this:

arm-none-eabi-ld --no-undefined -Map kernel.map -o build/output.elf -T kernel.ld
make: arm-none-eabi-ld: No such file or directory
make: *** [build/output.elf] Error 1

Re: Cambridge OS tutorial

Posted: Tue Oct 02, 2012 11:18 pm
by markymarc35
You have to create a directory called source and put the main.s file in there.

Re: Cambridge OS tutorial

Posted: Tue Oct 02, 2012 11:25 pm
by Dasaan
Your source files should be in the source directory.
You run make from the directory that has the Makefile in it.

Re: Cambridge OS tutorial

Posted: Tue Oct 02, 2012 11:42 pm
by khisanth
i have done that and still get a similar error. main.s in a source directory, run make in the directory with makefile in it.

does the source directory have to be anywhere in particular?

Re: Cambridge OS tutorial

Posted: Wed Oct 03, 2012 12:06 am
by badut
The source directory is at the same level as the makefile.

One thing you could try is to download the solution to observe how Alex has set up the directory structure.

Re: Cambridge OS tutorial

Posted: Wed Oct 03, 2012 11:44 am
by Solstice
I encountered the same problem.

When I moved one folder up, so not /template/source/ but /template/ it seemed to work.

I only got 2 of the 3 files. the list file was missing.

rgds,
David

Re: Cambridge OS tutorial

Posted: Wed Oct 03, 2012 11:51 am
by Vassius
khisanth wrote:I have the template, put main.s in that directory with the makefile and get this:

arm-none-eabi-ld --no-undefined -Map kernel.map -o build/output.elf -T kernel.ld
make: arm-none-eabi-ld: No such file or directory
make: *** [build/output.elf] Error 1
This indicates that the make script can't find the linker. Make sure all parts of the toolchain is in your $PATH.

Re: Cambridge OS tutorial

Posted: Wed Oct 03, 2012 8:41 pm
by khisanth
badut wrote:The source directory is at the same level as the makefile.

One thing you could try is to download the solution to observe how Alex has set up the directory structure.
That worked though my directory structure was as far as I can see the same. Anyway thanks for the help chaps, can focus on the learning now :)

Re: Cambridge OS tutorial

Posted: Thu Oct 04, 2012 7:41 am
by tufty
Vassius' reply is the one you need to look at.

1 - You need a toolchain installed to compile to bare metal. Usually the tools have names of the form arm-none-eabi-<tool>.
2 - You need your $PATH variable set up to point at that toolchain.

The error you are getting shows that either you don't have a toolchain installed, your toolchain has its tools named something other than arm-none-eabi-<tool>, or your path does not include the tools.

I'll assume you're running on some sort of *n*x. Not because it's the most likely, but because I know fsck all about Windows. If you're on windows, the sequence should be similar, but the commands won't be.

So. Step by step instructions for troubleshooting this.

1 : Have you installed bare metal compilation tools for ARM?
No? Install them, try again
Yes? Continue to step 2

2 : Are your tools aimed at the arm-none-eabi triplet (i.e. are they called 'arm-none-eabi-<x>?)
No? Go to step 3
Yes? Go to step 4

3 : Are you /sure/ you installed tools for bare metal development on ARM?
No? Double check, return to step 1 if necessary.
Yes? Modify the makefile to use the relevant triplet instead of arm-none-eabi, try again

4 : run `which arm-none-eabi-ld` from a command line. Did you get a result?
No? Go to step 5
Yes? You should be good to go.

5 : Are you /really/, /really/, /sure/ you've installed tools for bare metal development on ARM?
No? Triple-check, return to step 1 if necessary
Yes? Go to step 6

6 : Do you know exactly what directory your tools are installed to?
No? Either check the documentation for the package you installed, or run the following command : `find / -name "arm-none-eabi-ld" -exec dirname {} \;`
Yes? Add the directory containing the executables (either the directory name found above, or the base installation directory with '/bin/ appended to your $PATH, and try again.

As a hint, your tools are probably installed to a subtree under /usr/local/arm-none-eabi (which is the default installation directory if you build the GNU tools from source for target arm-none-eabi, but some packagers insist on shoving stuff in all sorts of esoteric places. YMMV, basically). The tools themselves live in the directory 'bin' under that directory structure, so sour $PATH must, therefore, include

/usr/local/arm-none-eabi/bin

or, whatever the actual path to your top level installation directory is, with '/bin' appended onto it.

Simon