13 hours 15 minutes
Hello. This is Dr Miller, and this is Episode 1.5 some of assembly.
Today we're gonna talk about the template and how it works.
So the assembly template that I have developed
So what this does is it creates a new directory for each project that you're working on,
and then it creates a make file for your project. And this is using the standard tool called make, which allows you to build your project.
So when you download the make template dot r dot gz and you unzip it
inside of there, you'll find a directory called Template make and inside of it or a bunch of different files
that are used for our process.
And so we're gonna look at some of those files so you can kind of understand what's going on.
So first is fixed. That s H. So this is the program that allows you to automatically add this to your path.
And so the way it does it is it creates a BIN directory for you, and then a copies the gen make dot s H file into that bin directory.
And then what it does is it adds on to the path. So the path is how your shell knows how to find
where commands are. And so it adds on to the path by a pending to the dot bashar see file.
And this allows it so that your your
shell will be able to see the program Bashar see is what it reads by default with bash views the different shell. You'd have to modify that in order for it to work.
And then it creates a folder called Projects. And this is where all of your projects are gonna go
now inside the make file,
we got a couple of different things. If you've never seen a make file, we can kind of start at the end. So clean just removes files,
and here you're going to see *** all over the place. That is the name of your project. So that's actually gonna get replaced with the name of your project so clean will just delete that.
And then all says we're going to make Project ***. So if you take make it automatically looks for a file called make file in a gnomic looks for
a target called all
and so it's gonna try and build this? Well, *** requires *** 0.0, and s m I Oda. Oh, so *** 00.0 is generated with this one which requires our A s M file
and then sm I oda Oh, depends on this sm ioo dot sm file.
And so to build these, it's the command that comes directly after it.
And so here we have
a Nazem minus f elf Manistee elf type, and then it's gonna build this
so it's got an absolute path to that and then it builds the 0.0, file for you.
I'm gonna put that in your in your current directory
and then for our project. Our project is going to be called Whatever *** dot S m it's gonna build that file and it's going again. Use Nazem to compile it for us and then if those air successful than it used GCC to compile the driver and then
*** 0.0 or whatever anymore, Project is in a semi Oda. Oh,
and so it uses those that's the
in here and so go ahead and compile it for us using GCC. So that way, all of the GCC libraries are included in our project and so
that allows us to build the project and make is just inefficient tool to do that. So instead of having to type all these commands in individually,
you can just use make in order to build it for your project.
And then what's in a sm ioo dot sm these air a bunch of different functions that we're gonna use either an hour in the future. So, for example, read into print and print string read char
um, dump rags, print NL print car.
So all of those are gonna be defined inside of here. So here's an example. Read int is to find in here, and you can actually see the definition in assembly
of what Regent is and does. And so, if you want, you can peruse that.
And then the part that we always use is going to be gen make that s age. So what it does is the first argument is dollar sign one.
And so it's going to create. Here is the directory. It's gonna be dollar sign home, which is your home directory slash projects because we created that directory and then whatever your project name is,
and then if it doesn't exist If it does exist, it'll print out. Director exists, not created if it doesn't exist,
and I go ahead and create that directory, and then it copies the template dot sm into their, but it renames at whatever name your project is, so I'm gonna use example 5.1.
So if it's 5.1 has all the sign one. Then it's going to create the directory 5.1 and copy this file to create 5.1 dot sm in the directory under there.
Then it also copies this include file, which is required for that make file to build it,
and then it's gonna copy are make file. But what it's going to do is it's it's gonna take the text of our make file. And then you said to replace everywhere inside of our file that has ***. It's going to replace it with dollar sign one or 5.1,
and then that's going to get sent out to your make file
so we can see an example of the hat. Hold on.
Oh, here's our template. We'll see the example in a little bit. So this is a template that's in the, um make template directory. And so this is what it starts off with when you start programming.
If you don't like this, you can modify it. You can delete lines, you can add lines. But this is what will be used every project in the future when you create a project.
And then here's the example. So he did 5.1 so we can see inside of the make file. It replaced everywhere that we had *** previously. We now have 5.1 and so we have a file called 5.1 day sm 5.1 day. Oh, and so it's going to compile 5.1 That s m
into an object file called 5.1
0.0, using Nazem minus f f is the file type. We're going to use elf in this example.
So elf is the type of file format that Lennox uses for binaries,
and you will create that and then our GCC command will actually use that Oh file when it's building it. So it's gonna the driver actually looks for a function called Ask them underscore mean
and then it will include all of the libraries will get included in there also.
So today we looked at the template and kind of how some of the parts of it works, so that if you want to go on your own and do this, you can go do that and you don't have to rely on the template.
But the reason that we have the template is that helps to make it so that it's easy to create a new project. So you can start coding in that without having to do all of the set up and all the copying. And also it organizes our stuff into projects and directories. And so it's a lot easier for us to,
um, write code. That way,
if you have questions, you can email me Miller MJ at you and Kate I e. To you. You can find me on Twitter at Milhouse 30
How to Use GDB (BSWJ)
The GNU Debugger (GDB) is one of the most commonly-used debugging tools in the world. ...
Certificate of Completion Offered
How to Use IDA (BSWJ)
The IDA is used throughout the IT and cybersecurity industries by exploit developers, vulnerability analysts, ...
Certificate of Completion Offered