‫Hello and welcome.
‫So we're now going to actually start writing some C code, so in our source directory, let's just create
‫a new file called Kernel Dot C.
‫OK, now we're going to go hash tag, include Colonel Dot Hage.
‫OK.
‫And we haven't created that file yet.
‫Now here we're going to go void Colonel starts OK, and that's all you need to worry about for the C
‫file at the moment.
‫Now we're going to create a new file in source called Colonel de Hage.
‫And now we're just going to go and he's going to ask you to install an extension we do on an extension.
‫So just install one.
‫Oculus installed and now here we're going to go hashtag F and F, Colonel, underscore Hajj, hashtag
‫defying, Colonel Hajj, hashtag indef.
‫OK, now here we're going to go void Colonel Main.
‫OK, so you guys, you all understand that a program in C, so you know what we've just done.
‫So we now need to adjust the makefile.
‫So compiles this code.
‫So go to the makefile.
‫OK, so the first thing we want to do, just saphir we're going to go includes equals dashi top forward
‫slash sirc.
‫So that changes the include directory to the source directory here and we'll just get rid of that space
‫here as well.
‫So it's like that.
‫OK, so we're going to create a new object file at the top here in the files, a new dependency, top
‫forward slash build kernel.
‫So here we have Colonel Asymptote out here.
‫We have Koldo now just in the Canada Ascender.
‫We're going to go forward, slash, build Colonel Dotto.
‫And this is going to depend on source Colonel Dot C so so I can see file.
‫So now we're going to actually invoke the C compiler to compile Colonel Dot C and to Colonel O for us.
‫So we do that by going east six eight six.
‫Stasch Aftershock C.
‫Includes, which makes you just copy and paste this from our make file down here and we're going to
‫go flags and we're going to find that at the top here.
‫We're going to go Flagg's equals dash.
‫Gee, that's the that's the flag we're going to do.
‫And then we're going to go dash f free-standing dash Etheline jumps dash aphelion functions.
‫Dash Etheline labels.
‫Dash f a line loops, so this just in shows where lining everything dash f strength, reduce dash f
‫ammit.
‫Dash Frain, Dash Pintor.
‫Dash f in line function's dash w no dash, unus, dash function, I know this is a lot guys, but this
‫is important.
‫It's important we set this up now.
‫Well, we're triggering warnings and stuff to make sure that we write our code neatly.
‫So here we're going to go dash f no dash built in and here we're going to go dash w aira.
‫Dash W.
‫No unused dash label dash w, no dash QP, dash w, no dash, unused dash parameter.
‫Dash nosed lib dash.
‫No stop, philes dash, no default, leps, dash wall, dash optimization zero, we don't want optimization
‫Dasch.
‫I think so.
‫That was a mouthful.
‫Please go through this.
‫Please go.
‫I ruined the lecture.
‫If you got lost and go through it slowly.
‫Make sure you got all of those flags, guys.
‫So back back to our.
‫Six, eight, six Aleksi compilation, so we're just going to go dash see top forward slash source A.C..
‫That show top forward slash belt, Colonel Dotto, and just check over this.
‫In our linker script, we're also going to do the flags here as well, guys, so uses those same flags
‫and here guys were actually also going to go dash SCD.
‫ECAs, Jianyu, 99, OK, so says the compiler, stand up for us.
‫OK, so if we now go to the terminal and we make clean to begin with, now we go build the S.H..
‫We can see it's built our Canada profile successfully, which is good.
‫OK, so now that that's being built successfully, we now need to actually try and call our colonel,
‫stop function.
‫So inside of Canada, ASRM, we're going to say extern, Colonel, start.
‫And now, just before and from the jump, we're going to go call Colonel Start.
‫OK, so we now go back here and we make clean.
‫We build that.
‫OK, so now that we've compiled that, we're going to go CWD bin GDB, we're going to add the symbol
‫file.
‫And we're going to put it at zero one one, two, three, four, five.
‫Yes, and now we're going to attach Kumu, we're going to go target remote, we're going to pipe it
‫out.
‫And now we're going to go dash GDB, studio Dash s.
‫When I press enter.
‫And now we're going to go break, Colonel starts, we're going to proceed to continue and there we go.
‫We can see we are now on our Carl Stop function, which is see if we do, but for backtrace.
‫And we can see our stack here.
‫So we go layer diesem.
‫We can just step by step by and then that brings us back out of our function and then we jump forever
‫here on zero one zero zero zero 20 so we can see are now able to call our C functions from assembly,
‫which is handy.
‫Oh, and before I forget, we called it Colonel Main and the head of our not colonel start.
‫So that was a typo.
‫However, I think it sounds better.
‫Is Colonel Maine right?
‫So here change, Colonel starts.
‫Colonel, Maine just makes more sense.
‫You know, like the main function right now in Canada is to extern Colonel Maine.
‫So just change it from Colonel starts.
‫Colonel, Maine here we do call Colonel Maine there we are a bit cleaner now, you know, makes more
‫sense.
‫So, yeah.
‫Colonel Maine is what we'll call it not.
‫Colonel, stop.