243x Filetype PDF File size 0.60 MB Source: www.add.ece.ufl.edu
Creating
a
‘C’
Code
Project
with
Code
Composer
Studio
(CCS)
Version
4
EEL4744
Introduction
to
Microprocessors
–
University
of
Florida,
Electrical
&
Computer
Eng.
Document
Revision:
2.0
November,
2009
Authors:
Dr.
K.
Gugel
&
M.
Pridgen
Introduction
The
purpose
of
this
document
is
to
quickly
illustrate
how
to
create
a
‘C’
code
program
under
CCS4.
Students
should
be
proficient
in
writing
assembly
code
for
the
TMS320F28335
DSP
and
now
can
move
on
to
use
the
CC4
‘C’
compiler
for
code
generation.
You
will
need
sprc530.zip
and
the
example
‘C’
code
file
named
LED.c
which
illustrates
the
code
required
to
turn
on
the
LED
attached
to
GPIO0.
Procedure
1. Download
sprc530.zip
from
TI.com
or
our
class’
reference
web
page.
2. Extract
the
zip
file.
3. Run
“setup_DSP2833x_v131.exe”
‐
Choose
default
installation
options.
4. Create
a
new
directory
for
your
C
code
project
and
copy
the
linker
command
file
KG_RAM_Link1.cmd
into
this
directory.
5. Start
Code
Composer
Studio.
6. Create
a
new
CCS
project.
File
>
New
>
CCS
Project
a. Type
in
the
project
name
and
use
the
defaul
project
type
C2000.
b. Continue
on
through
the
Additional
Project
Settings
window.
c. Choose
same
options
as
for
an
asm
file
until
the
CCS
Project
Settings
window.
See
the
illustration
of
this
below
and
make
sure
you
point
the
Linker
Command
file
to
KG_RAM_Link1.cmd
in
your
project
directory.
Also
ensure
that
Treat
as
Assemblyonly
Project
is
unchecked.
Finish
project
creation.
Creating
a
‘C’
Code
Project
with
Code
Composer
Studio
(CCS)
Version
4
EEL4744
Introduction
to
Microprocessors
–
University
of
Florida,
Electrical
&
Computer
Eng.
Document
Revision:
2.0
November,
2009
Authors:
Dr.
K.
Gugel
&
M.
Pridgen
7. In
the
project
browser
window,
right‐click
the
project
name,
select
Link
Files
to
Project
and
link
the
following
files
from
the
directory
created
by
the
setup_DSP2833x_v131.exe
program
using
directory
path
/tidcs/c28/DSP2833x/v131/
and
the
following
files:
a.
/DSP2833x_headers/cmd/DSP2833x_Headers_nonBIOS.cmd
b.
/DSP2833x_headers/source/DSP2833x_GlobalVariableDefs.c
c.
/DSP2833x_common/source/DSP2833x_ADC_cal.asm
d.
/DSP2833x_common/source/DSP2833x_CodeStartBranch.asm
e.
/DSP2833x_common/source/DSP2833x_DefaultIsr.c
f.
/DSP2833x_common/source/DSP2833x_PieCtrl.c
g.
/DSP2833x_common/source/DSP2833x_PieVect.c
h.
/DSP2833x_common/source/DSP2833x_SysCtrl.c
i.
/DSP2833x_common/source/DSP2833x_usDelay.asm
8. Next
go
to
Project
>
Properties.
a. Select
“C/C++
Build”
on
left
side.
b. Select
the
“Tool
Settings”
tab.
c. Under
“C2000
Compiler”
select
“Include
Options”.
d. Next
to
“Add
dir
to
#include
search
path
(‐‐include_path,
‐I)”
select
Add
(left
most
button)
and
add
the
following
directories:
a.
/tidcs/c28/DSP2833x/v131/DSP2833x_headers/include
b.
/tidcs/c28/DSP2833x/v131/DSP2833x_common/include
Creating
a
‘C’
Code
Project
with
Code
Composer
Studio
(CCS)
Version
4
EEL4744
Introduction
to
Microprocessors
–
University
of
Florida,
Electrical
&
Computer
Eng.
Document
Revision:
2.0
November,
2009
Authors:
Dr.
K.
Gugel
&
M.
Pridgen
e. Select
Apply
and
then
OK.
9. Copy
LED.c
to
your
project
directory
and
then
add
the
file
LED.c
to
your
project.
Right
click
on
your
active
project
in
the
C/C++
Projects
window
usually
on
the
left
of
the
CCS4
workspace
and
then
select
Add
Files
to
Project
and
select
LED.c
10. Create
a
new
Target
Configuration
File
(same
as
what
you
have
done
for
your
previous
assembly
projects)
for
your
lab
DSP
board
or
copy
it
from
a
previous
project
and
add
it
to
this
new
project.
11. Compile,
program
and
run
the
code
on
your
board.
Additional
Information:
1.
If
you
see
the
“.const”
warning
and/or
can
not
connect
to
your
board.
Check
the
following:
Project
>
Properties
>
CCS
Build
Settings
>
Change
Runtime
Support
Library
to
rts2800_fpu32.lib
>
Apply
>
Create
a
new
build
configuration
initialized
with
build
options
from
the
existing
configuration
>
OK
Project
>
Properties
>
C/C++
Build
>
Runtime
Model
Options
>
make
sure
Use
large
memory
model
is
checked
and
Specify
floating
point
support
is
fpu32
>
Apply
>
OK
2.
To
get
rid
of
the
.cinit
warning,
in
the
KG_RAM_Link1.cmd
file
uncomment
this
line
of
code:
.cinit
:
>
RAML0,
PAGE
=
0
This
is
a
section
directive
that
is
used
for
creating
boot
code
under
C.
We
don’t
it
in
this
example
but
may
in
the
future
so
it
is
good
to
get
rid
of
this
warning.
Creating
a
‘C’
Code
Project
with
Code
Composer
Studio
(CCS)
Version
4
EEL4744
Introduction
to
Microprocessors
–
University
of
Florida,
Electrical
&
Computer
Eng.
Document
Revision:
2.0
November,
2009
Authors:
Dr.
K.
Gugel
&
M.
Pridgen
3.
To
get
rid
of
the
.stack
warning,
select
the
project
in
the
C/C++
Projects
tab
and
perform
the
following:
Projects
>
Properties
>
select
C/C++
Build
on
the
left
>
select
Tool
Settings
tab
>
C2000
Linker
>
Basic
Options:
>
set
the
Set
C
system
stack
size
field
to
0x400
>
Apply
>
OK
4.
Take
a
peek
into
the
include
directory
/tidcs/c28/DSP2833x/v131/DSP2833x_headers/include.
There
are
header
files
(C
functions)
for
using
GPIO,
the
timers,
interrupts,
the
A/D
converter,
SCI
and
SPI
and
many
other
devices
found
in
the
DSP.
Thus
it
is
possible
to
write
simple
C
code
for
nearly
any
peripheral
found
in
the
DSP.
See
http://focus.ti.com/docs/toolsw/folders/print/sprc530.html for more
information.
On
top
of
this
there
are
several
other
libraries
available
with
even
more
complex
functions
like
sine,
cos,
FFT
and
other
signal
processing
algorithms.
An
example
is
the
C28X_FPU_Lib
(floating
point
library)
that
you
can
find
on
TI’s
website.
Additional
tutorials
on
creating
are
also
available
on
the
TI
website.
An
excellent
place
to
start
is
to
read
the
document
spraa85b.
http://www.ti.com/litv/pdf/spraa85b
no reviews yet
Please Login to review.