User avatar
khisanth
Posts: 36
Joined: Thu Jan 19, 2012 11:49 pm
Location: Farnborough
Contact: Website

Cambridge OS tutorial

Sun Sep 30, 2012 3:43 pm

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:

trinigooner
Posts: 6
Joined: Sun Sep 30, 2012 12:07 am

Re: Cambridge OS tutorial

Mon Oct 01, 2012 9:26 pm

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!

Dasaan
Posts: 7
Joined: Mon Sep 24, 2012 6:34 pm

Re: Cambridge OS tutorial

Mon Oct 01, 2012 11:02 pm

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.

User avatar
khisanth
Posts: 36
Joined: Thu Jan 19, 2012 11:49 pm
Location: Farnborough
Contact: Website

Re: Cambridge OS tutorial

Tue Oct 02, 2012 11:03 am

downloaded it but it wasnt in that directory, thanks!

User avatar
khisanth
Posts: 36
Joined: Thu Jan 19, 2012 11:49 pm
Location: Farnborough
Contact: Website

Re: Cambridge OS tutorial

Tue Oct 02, 2012 10:08 pm

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

markymarc35
Posts: 10
Joined: Tue Oct 02, 2012 11:09 pm

Re: Cambridge OS tutorial

Tue Oct 02, 2012 11:18 pm

You have to create a directory called source and put the main.s file in there.

Dasaan
Posts: 7
Joined: Mon Sep 24, 2012 6:34 pm

Re: Cambridge OS tutorial

Tue Oct 02, 2012 11:25 pm

Your source files should be in the source directory.
You run make from the directory that has the Makefile in it.

User avatar
khisanth
Posts: 36
Joined: Thu Jan 19, 2012 11:49 pm
Location: Farnborough
Contact: Website

Re: Cambridge OS tutorial

Tue Oct 02, 2012 11:42 pm

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?

badut
Posts: 20
Joined: Tue Sep 11, 2012 12:49 pm

Re: Cambridge OS tutorial

Wed Oct 03, 2012 12:06 am

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.

Solstice
Posts: 1
Joined: Wed Oct 03, 2012 11:33 am

Re: Cambridge OS tutorial

Wed Oct 03, 2012 11:44 am

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

Vassius
Posts: 25
Joined: Sun Jun 03, 2012 7:56 pm

Re: Cambridge OS tutorial

Wed Oct 03, 2012 11:51 am

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.

User avatar
khisanth
Posts: 36
Joined: Thu Jan 19, 2012 11:49 pm
Location: Farnborough
Contact: Website

Re: Cambridge OS tutorial

Wed Oct 03, 2012 8:41 pm

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 :)

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Cambridge OS tutorial

Thu Oct 04, 2012 7:41 am

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

Return to “Bare metal, Assembly language”