Ensemble de rappel
Ensemble de rappel
Ensemble de rappel
Ensemble de rappel
Ensemble de rappel
Ensemble de rappel
Ensemble de rappel
Introduction to Embedded System Design
Professor Dhananjay V. Gadre
Netaji Subhas University of Technology, New Delhi
GIT, CCS Installation and Embedded C
Hello and welcome to a new session for this online course on Introduction to Embedded System
design. I am your instructor, Dhananjay Gadre. This is a very important session in which we are
going to go through certain steps. So, that appropriate software is installed on your desktop or
laptop computer, whatever you maybe using. So, we are going to deal with two installations, one
is a software called GIT, and the other is the code composer studio, which is the C compiler from
Texas Instruments for MSP430.
In fact it supports many other macro controllers, but we are going to… restrict ourselves to
discussion about the MSP430 micro controller. After the installation of these two packages, we
are going to discuss a little about Embedded C programming. Of course, we assume that you
have some experience, you have good experience in general C programming. So, we are not
going to consider those aspects. We are going to consider specific aspects to the Embedded C
part. Alright. Now GIT is a version control system.
Now, before I explain, what a version control system is, I would like to take this opportunity and
discuss a few issues with you as a beginner student or as a student who has not yet entered the
professional domain. I as an educator with some experience, I would like to share my experience
with you. For example, suppose I. when I teach a class and I tell them, please send me a report
about today’s exercises that I covered in the class, most of the time unless I tell them to begin
with, I would get 20, 30, 40 emails with a document enclosed, and often times the document is
labeled or named report dot doc.(Refer Slide Time: 2:18)
Now, as far as the student who has sent this is concerned, he is happy he has created a document
and he has emailed it to me. But you please step into my shoes and consider that I have received
50 emails and all the 50 emails have pretty much 50 files. All of them are named report dot doc.
If I download and save them, what is going to happen? It will make me crazy. It will be
impossible for me to relate a given document with a person. And therefore, I always ensure that
when I ask my students to send me reports for a given topic on email, I ask them to follow a
In a classroom, in a as a student you would have a roll number, and therefore often times my
protocol is, you include this information in the file name. You say roll number, whatever your
roll number is. The year in which we are doing, or the subject we are doing. Suppose we are
doing EC301 and maybe if this is your first report, or if this is the first report that I have asked
this class to send me, it could be report 1 dot doc or any other file format if it is a PDF fine.
This way, the moment I get this, now roll number has to be replaced with your actual roll
number, whatever it maybe. You do not want to receive 50 emails with the same roll number as a
literal word. Here the roll number will be replaced by whatever the student’s roll number is.
Likewise, if tomorrow, now this is fine, this scheme works as long as you are part of a ecosystem
where the roll numbers can be used to distinguish person A from B and C and so on and so forth.Now, let me put you in a different perspective. Suppose tomorrow you are going to enter the job
field, job market and you are going to send your resume to somebody. And that somebody has
asked 20 other people to send their resumes. Now my question to you is, what would you send
you, what would be the name of the file that you send to that person containing your resume.
Well, if it is going to be resume dot PDF, well, you have recreated the situation which I
And therefore, what I normally do when I, when I go on speaking assignments to various
colleges for giving a lecture, I have followed a format and I recommend to you that you follow a
similar format if not the same. I always keep track of my changing activities and reflect them in
my resume as I would say DVG, my initials, but that is because these are very uncommon
initials. If you have names which end up having very common initials, please modify it. And
then I say resume or cv. And then I also have a 4 digit number, for example, it could be 0320.
And here 0320 s going to tell me that I created it in third month of the year 2020. And this way, I
am able to know, what is the latest resume that I have kept on my files. And the person who
receives it can make an idea that this is a resume for a person whose initials seem to be DVG.
You can follow a similar or a different format. But the important point is, there should be enough
variety, enough information in the file name itself for somebody who is collecting tens of
resumes to call one resume file apart from the other one.
Now, this is not the topic of our discussion here, but it is very closely related. Now imagine, so
before that I hope you will give some heed to this idea that I have thrown at you. Now, coming
back to the whole idea of version control system, imagine that you have a PC and that you are
creating a, you are creating a report like your teacher might have asked you to create. Then you
write a few pages of a Word document and then are happy with it, you save it, you go to sleep,
next day you wake up and say, no no no, I think I can improve this report a little bit.
And so you open that file and you start editing it and you spend another few hours and suppose
that report was xyz to reflect your initials, report dot doc. Alright. And then next day, you have
modified it. You have edited large parts of it and you have replaced it with some new text. And
few hours later you realized, oh god, the first version that you wrote last night was much betterthan this one, now what to do. You have deleted parts of it and you have replaced it with new
text, and you do not like that text.
How would you solve this? Well, if you are going to do manage this manually, you could say I,
the night that you sleep happy with the report that you have created, the next day when you want
to edit it, you open that file, but now first save it into a new file name. Well, at least some,
keeping some part of the filename common, but an identifier which tells you that this is new
version. So, what I could do is, I could say xyz underscore report. The next day, I will say
underscore v2 dot doc.
And now, I have my file xyz report dot doc on my folder. I have created a copy of that and I
renamed it as xyz report underscore v2 and I can edit it. And if I am happy with v2, I can retain
v2. If not, I can always go back to the original xyz underscore report. And this way you can keep
on creating newer and newer versions of your report.
Keeping the newer versions, if you are happy with it and reverting back to the older versions if
you are not happy. And so, these stages while you start from the beginning if your file to some
conclusion, conclusion of this whole exercise, you have created perhaps multiple versions of that
And this allows you to at least keep track of the changes that you have made. Now, of course, if
you did it manually, it will be a nightmare to have so many files on your system. This is where
an automatic version control system or creating documents under the supervision of a software
which keeps track of these changes, comes into picture. Now, till now what we discussed was in
the context of one person, you as an individual creating documents and you could extend this
analogy to not just creating documents but also to create software or files.
You write a piece of code, you are happy with it and you want to make changes, you make
changes which ends up making it worse than what it was earlier. So, when I say documents, it
could be Word documents, or it could be Text documents, it could be code files, it could be
anything else. This whole discussion applies to all of it. So, imagine that you were working on a
project in which there were three or four files and it was being worked on by a few people, who
were not geographically present at the same location.That is they were distributed across the town or across the city, or maybe across the world, which
is quite common these days. Now, imagine that all of you wanted to access files, make changes
to those files and it is possible that the changes that you made, made the whole new version
worse than what it was earlier. And so, you not only need to create, you not only need to take
care of these files, the changes that you are making, through a automatic piece of software, but
you also need a single source or single repository, single location where these files will be
accessible to all the people who are working on it.
And in fact, the whole Cloud based storage of files maybe a Google doc is an example of that,
but in this context we are going to use specific software created to facilitate keeping making
newer and newer versions of the project that you are working on, whether that project is writing
a book, writing a report, creating a schematic file, creating code software, no matter what, this
version control system can take care of all of it.
Now, there are of course a lot of version control systems. Some of them are paid, many of them
are paid, but there are some which are open source and free for you to use. And we have selected
one such, which is quite popular and quite common, and that is called GIT. Now, what we want
you to do is, we want you to become familiar with GIT and you can become familiar with GIT
by beginning to use it. If you already know GIT, well you can skip this initial part of my, of this
session, and head on straight to the part where we start discussing the code composer studio.
But if you are not, this is a right place to start. And GIT is a very complex software. It is, it offers
you lot of facilities. It offers you facilities as a creator. It offers you facilities as a end user. And
right now, the best way to start using it if you have not used it before is to start using it as a end
user. And you as a participant, we assume that many of you or most of you have not heard of
GIT, or version control softwares. And so, we are going to show you the use of GIT from the
perspective of a beginner.
As you start using it, there are lot of resources which will teach you about various features of
GIT, specially the features of GIT, when you want to use it as a creator and the material that you
have created, you want it to share with others, or share with other members of the team, or share
with common public, you could use the advance features. But right now, we hope that you are a
beginner and so, you would like to, we would like you to install GIT, and using this, we wouldlike you to download all the code files and in fact schematic files and other things that we have
shared on a repository that we will soon talk about, and it will allow you to download all of it on
to the computer that you are using.
(Refer Slide Time: 13:16)
Alright. So, to begin with, open a browser of your choice that you are using and type this link
which is https double slash GIT dash scm dot com slash downloads. Once the software is
download, downloaded, you can double click on it and follow the normal installation process.
Once the software is installed, you open a terminal on your Windows PC. By the way all thisdiscussion is a Windows PC centric. That is the most common operating system for people to be
using. And so we are going to discuss all of that in the context of Windows.
So, open a terminal and in that terminal, find a suitable, create a suitable folder into which you
would want to show, save all the files related to this course. So, I leave it to you to create that
folder. And using the terminal go to that folder, and then type this, type GIT config double dash
global username and then username. So, for example, if I were to do this, I would on my
command prompt on the terminal window, I would say GIT, I would type this, config space
double dash global user dot name space, and then I will write the name that I want.
Suppose I want to do it as my name, so I could say DVGADRE, I close those and I press enter.
After that, so this registers me with GIT with this username. And then I say on the command
prompt again, I say GIT config, basically repeat most of it, double dash global user dot email
double quotes, whatever is my email address.
So, if it could, if it was DVG at the rate Gmail dot com, I should type that, or if it is something
else, I should type that. By the way, this is not my email address. So, you once you do this, it will
basically register this software with this username and assign this email address to this user. Now
what do you do?
(Refer Slide Time: 15:53)Now again, in that folder that you have created, you could do one of two things. You could
execute this command on the prompt. But this would you would do if you are somebody who is
creating a repository, you are creating a set of files that you want to eventually share with the rest
of the world.
Since you are not that, you are going to execute this second line. And what do you do, you type
GIT clone, GIT clone and a URL address. So, which means basically you are going to write GIT
clone followed by this entire address. Following the letters and characters exactly. If something
is in capital, you must do that in capitals. And when you enter this, basically it is going to pull
from a, a repository on the web internet called GIT hub. We have created this repository, it will
create a local version of the files that are stored on that repository on to your local computer.
So, that you could access them even if the internet connection is not on. I will talk about more
about this. Then if you are going to make changes to the files and you would want to share the
changes with us, of course we need to agree to those changes and we need to agree to that, then
you could follow these things. But we are not going to right now do that. We will talk about this
in next slide.
(Refer Slide Time: 17:18)
Now, when you create a, a repository or you create a file, basically GIT looks at those at that file
in various ways. When you create a file, it is still not attached to that software which is, whichyou just installed on your PC, that is GIT. Now, you can from that and that such a file is called
untracked file. This is the untracked file. Now, and you obviously created in that folder, that I
mentioned. And then, you can add that file into this next stage which is called the staging area.
And from there, you commit it and, and now all this initial these three parts here, these are when
you are doing it as an experienced user who is creating a repository, first of all that repository
has to be created.
This is the repository on your local computer. And then you upload it to the internet global
repository. So, when I say install GIT, that GIT is a local repository. Now, this local repository
could be cloned as the word they use, could be replicated on a platform that is globally
Because your computer is not accessible to other users. If you as a creator wanted to share your
work with others, you could move your, or you could copy your repository from your local
computer into, onto a global GIT, or a global version control software website. And one of the
website is GIT hub. There are other websites also. But we are going to use GIT on our local
computer and GIT hub for the internet access. So, you can push all those files on to the internet
repository on the internet, which in this case is GIT hub.
(Refer Slide Time: 19:10)If you notice here, you install GIT, but you downloaded the repository that we have created on
the GIT hub website. Likewise, when you, when you did this, when you cloned that repository
that we have created on GIT hub, after that, you are set. All the files that are there on our
repository will be replicated on your, on your computer, in the folder at which you did all this.
And at this point you are ready to use them.
Now, imagine the following, that let us say you created this clone on your local computer and
you are happy with it and then you went to sleep, maybe you stopped doing work for a week.
And a week later, you wanted to resume. Well, you need not worry, you could open those files in
the way that we will talk about soon.
But what if we here make changes to those files. If we make changes to those files, you would
not know them, you would not get the changed version of the files, unless you did something.
And what do you need to do, you need to go to that command prompt in the area that you, in the
folder that you created and you need to pull those files again. Now, in case those files have not
changed, nothing will change. In case we have made changes to those files, they would be
reflected, you would get a newer version and the local repository on your computer will be
updated with the changes that we may have made, we might have made.
(Refer Slide Time: 20:53)And therefore, you need to learn to use two commands for that, usually you would run this
command. You would say GIT, exactly like this, on the command prompt, you just type GIT pull
origin master. The GIT software on your PC knows what you are talking about, what is the
remote host, from where to get it and update which files. In case you do not want to and that will
bring into the, the so called staging area, at which point you can use them in the way that you
You could also, of course when you do this, the local repository is also updated. Or you could
use GIT fetch origin master, you can type this in the command prompt. It will only bring it into
local repository. It is not yet available, these newer changed files may not be visible, will not be
visible to you in the work area. And then you need to execute another command called GIT
checkout master, for the changed versions which have now come to your local repository, but not
yet available or visible into the designated folders.
So, we suggest that each time you are working on these files, you just open your computer, make
sure that the internet is working and then go to the folder, go to the, open the terminal in the
folder that you have stored all this and just run one command which is get GIT pull origin
master. When you type it, any changes that may have happened would be reflected on the local
repository and into the work place where these files are stored.(Refer Slide Time: 22:27)
And so you say GIT fetch. It allows you to fetch these files and you can do, but we recommend
that you do GIT pull, which will not only fetch it, but also store and make the files visible in
those folders where the original files were stored. So, this is the way to ensure that any changes
that have happened on the GIT global repository, those changes are reflected in your local
repository. So, let me revise some of these terms. GIT is a version control system. There is a
local version of it running on your computer when you install GIT.
There is a global repository and there are many such global repositories and GIT can talk to any
such global repositories, but we have chosen to connect GIT to a global repository called GIT
hub. GIT hub is where we upload the files that we are creating for you. And if you want to
synchronize the files that you have already downloaded on your local repository, you need to
execute this command. So, on your terminal you just type GIT pull with this word GIT pull
original master, it will bring the latest version of the file from the global repository, that is GIT
hub, in from that file, that link that we shared.
You do not have to provide that link, it knows. It will simply pull those files from that repository
and update your local repository and then you are free to use them in any which way you want.
You can make changes to it also, does not matter. Of course, those changes will not go and
change the files on the global repository.(Refer Slide Time: 24:14)
For that you need to learn more about how to use GIT and essentially that part is covered here.
So, you could use this as a reference, learn more about GIT. There are lot of sources of learning
material related to GIT on the internet. We recommend that you read that if you want to be a
contributor, or later on if you want to create your own repositories and share it with the world, or
create it, or have a team in which multiple people need to work on such shared files. So, once
you are done this, you are ready to go to the next step, which is to install code composer studio.
(Refer Slide Time: 24:50)And just to recap, you have created a clone using this command. If you just want to download
the files once and for all, without the possibility of synchronizing with the changes, you could
download just the files using this command, type this into your browser and you get the zip file
which has all the folders and the sub-folders and the files inside those and so on.
Of course I hope that you are going to be worried about the synchronization and all that, so you
would use this command. Well, now you are ready, your GIT is installed on your computer, you
have downloaded the global repository and you are now ready to jump into the next part of this,
which is to install the code composer studio.
(Refer Slide Time: 25:37)For that, you go to this website, or you just search code composer studio, TI code composer
studio, you would get the link. Go to this or type this into your browser and when you see, you
will see this. There is lot of options, but the top version which is released 9.3.0 is what we want
you to download. And we want you to download the Windows 64 bit version. There are no other
versions available anyway, so you click on it and follow the normal software download and
(Refer Slide Time: 26:05)When you click on the downloaded part, it allows you to setup, it offers you two options. Either
you can go with the custom installation or you can go with the full installation. As I mentioned
code composer studio is C compiler, C, C plus compiler from Texas Instruments for a lot of their
micro controllers and processors. But since in this course we are only going to be talking about
MSP430, there is no need to for full installation. If you did a, if you chose the full installation, it
will install compilation ideas for all the processor that TI offers. We are only dealing with the
custom part that is one part out of so many processors. So, we recommend that you use the
(Refer Slide Time: 26:50)Then you go next, and in the next, it offers you all these options which you can check out. And
since as I mentioned, we only want to deal with MSP430, check out the first option which is
MSP430 Ultra low power MCUs. And then select next.
(Refer Slide Time: 27:08)And now you are ready, your software is going to be installed shortly. And once it is installed,
we want you to be able to write code files and compile them and download them and so on so
forth. Of course we do not want you to write code files from scratch. In the beginning we would
want you to use the files that you have just downloaded. Remember in the previous segment of
this lecture we talked about creating downloading a repository of code files and of course many
other things on to your local computer. So, all you need to tell CCS that I want to edit existing
files, you want to point where those files are located and so you need to import those files.
So, to import existing files, you go to file import and in the tab it will show general and then you
say that you want existing projects into workspace and you need to point it to the right directory
which would be in that folder that you created. And once you do that, you refresh select all
finish. Now, you are good to go. You have all the your code composer studio would know all the
code folders that we have created for you, they are already installed on your computer, but now
code computer studio knows where they are and that you want to work on them.
In case, you want to create a new project, meaning apart from all the code files in various folders
that we have shared with you, in case you wanted to create your own new project, you are of
course welcome to do it.
(Refer Slide Time: 28:45)And for that, you use in your CCS go to file, select new and you say you want to do a new CCS
project. There you need to mention that your target is this. This is the MSP430 G2553 and that
the compiler version is this. And then when you say finish, it will create, it will automatically
install some information for you into specified areas.
And one of the important things it will store is that it you have chosen MSP430 G2553. So, in
the predefined symbols, it is going to use this file. And in the header file, it is going to use this
version. This is just to illustrate what is happening, You, do not need to be worried about it. Onceyou have selected this option while installation, all the files that you create, all the code that you
write in these files will compile for the MSP430 G2553 micro controller.
Now, once you have created a file, or you have opened a existing file, you would want to
compile it. Now, of course compilation will convert the C file into assembly and from the
assembly into a machine code file. But what do you do with that machine code file. Your idea is,
your intent is that this machine code, that is the object code, the binary code should be
transferred into the memory of the MSP430 micro controller. And for that, as you know, you
would connect your MSP430 lunch box.
But just the compilation process is not going to transfer the code file into the MSP430 target. I
am using the word MSP430 target because it could be MSP430 lunchbox, or you could use any
other MSP430 evaluation kit. Right? And so we need to still tell MS, our CCS compiler that
once the code compilation is completed, what is to be done with the object code.
What we want to tell it is that we want to invoke the boot strap and we can do that in the CCS.
So, that I do not need to open ten windows and in each window I have to tell one part and the
second window I tell the second part, the third part. The code composer studio is IDE, Integrated
Development Environment, which means it allows me to edit, it allows me to make changes, it
allows me to save files, it allows me to open files, it allows me to compile them, it allows me to
look at the compiled versions and then eventually it allows me to download the software right
into the target micro controller.
And so for that, we have to tell what is our way for transferring the object code from the
compiled, from the CCS compiler into which way into the micro controller memory. And since
we are going to use the boot strap loader, we need to instruct the, the CCS that this is our
(Refer Slide Time: 31:39)And for that, you go to project properties, there you would see a tab build. In that you select
MSP430 hex utilities and you say enable MSP430 hex utility. Then you press apply and close.
And then you do the second step, where you again go to project properties, you say build
MSP430 hex utility. You are specifying the output format options and you select, here as you
see, output TI dash TXE hex format.
There are many ways in which the hex file can be saved. This is the preferred version which is
compatible with the boot strap loader, so we want you to select this. Once you are done, then you
go to step 3. And you, it basically shows you that once the build is completed that is when I say
the word build, here it means the entire process of compilation and so on and so forth. What to
do with it? It is going to create a filename like this. and remember, this part is very critical.
This is basically telling the computer and the code composer studio that the compiled file has to
be downloaded, has to be sent through the USB port which is seen as by the computer, which is
seen as com 9 in this case. Right? But of course, in your comp, on your computer the USB port
which you connect the lunchbox may appear to be a different number. So, what you need to do
is, go into the device properties and find out that the port, when you connect your lunchbox, it is
reflected as what com number.
And the way to do that is, if you have already connected the lunchbox, disconnect it. Connect it
again and you see a number pop up into the device manager. And that is the number. And youshould change that, that, you should write that number here. And this is when you are going to be
installing a new file. If you are going to open the files that we have created and which are
available to you on the repository, you might find this number and this number may be different
from the one reported by your device manager.
So, you need to go back into this BSL step 3 and edit this part to reflect that com port number
that you see now. And one idea is that if you have chosen a particular USB port to connect your
lunchbox. If you continue to use that port over the period of this course, you may not have to
worry about having to changes this over and over. Five days later also if you open your computer
and connect it to the same port, the port number would not change.
But just in case, your code does not seem to work on the lunch box, one of the reasons could be
that this port number has changed. So, it is not a bad idea to check with the device manager to
find out, is this port number has changed, since the time that you set this in this BSL settings. If
it has changed, please make appropriate changes here. So, it is very important that you find out
the port address to which you are going to connect your lunchbox and if it has and that address
must reflect into the BSL setting in this step 3. Once you are done, you are good to go.
Nous enverrons les instructions pour reinitialiser votre mot de passe à votre adresse e-mail associée. Veuillez marquer votre adresse e-mail actuelle.