Motorola once sc140 User Manual

Page of 40
In
trod
uct
ion
 to 
the
 SC
140
 To
ols
MOTOROLA
Semiconductor Products Sector Application Note
Order Number: AN2009/D
Rev. 1, 9/2001
© Motorola, Inc. 2000
Introduction to the StarCore SC140 
Tools: An Approach in Nine Exercises
Emmanuel Roy and David Crawford
This document presents a quick, comprehensive hands-on 
introduction to the StarCore SC140 DSP core using programming 
examples and exercises. The goal is to help the software 
developer start writing high-level language applications in C. 
Included are software-related tips on how to get the most from the 
StarCore hardware architecture.
We recommend that you complete the exercises in sequential 
order. The exercises require the use of the SC140 C tools 
(including compiler, assembler, linker, and simulator) to generate 
executable files from C and assembly language source files and to 
verify the code performance. The tools are invoked from a 
command prompt (DOS or UNIX). If you desire, you can use an 
Integrated Development Environment (IDE). Be sure to consult 
the appropriate IDE manuals. This document provides 
step-by-step instructions to walk you through the exercises 
included in the file 
SC140_exercises.zip
. You can download 
this zip file from the MSC8101 or MSC8102 product page at the 
following Web address:
http://www.mot.com/SPS
Solutions to the exercises are provided at the end of this 
application note.
Recommended Reading
SC140 Core Reference Manual
MNSC140CORE/D
SC100 C/C++ Compiler User’s Manual
MSC100CCUM/D
StarCore140 Family DSP Core Instruction Set, 
STCR140ISRM/D
Multisample Programming Technique
STCR140MLTAN/D
Contents
1
Preliminaries ........................... 2
2
File I/O Exercise  ..................... 4
3
Integer and Fractional
Arithmetic Exercise  ................ 5
3.1
Hardware Support on StarCore........ 5
3.2
Compiler Support on StarCore ........ 6
4
Local Versus Global
Optimization Exercise  ............ 9
5
Memory Alignment Exercise 12
6
Split Summation Exercise .... 16
7
Multi-Sample Exercise  ......... 18
8
Control Code: The True Bit
Exercise .................................. 21
9
Calling an Assembly Routine
From C Exercise  ................... 23
10
The Challenge ........................ 26
11
Solutions to Exercises ...........  27