Motorola SC140 user manual File I/O Exercise, Hands On, Good To Know

Page 4

1 File I/O Exercise

The file I/O exercise shows how to use standard ANSI C I/O features within the current tools suite.

Hands On

1.Create a new text file called io.c.

2.Within the io.c file, write code using the ANSI C printf function to display Welcome to StarCore SC140 Tools on the screen (remember to include the header file stdio.h),

3.Compile the file using ccsc100 io.c -o io.eld.

The -ooption specifies the output file name (for example, io.eld). If the application does not compile successfully, correct the reported mistake(s) and recompile the application until a successful compilation occurs.

4.Run the executable runsc100 io.eld to display Welcome to StarCore SC140 Tools.

The runsc100 executable is a cycle-accurate run-time simulator. It allows you to run an application to completion and print out intermediate/final results. You can use this executable for quick code verification and/or debugging purposes.

Congratulations, you have completed Exercise 1.

Good To Know

The SC140 core supports both Big Endian and Little Endian data representations. Therefore, the SC140 tools support both modes. By default, ccsc100 and runsc100 use Little Endian mode.

Big Endian mode can be selected by:

specifying the -be option for ccsc100

specifying the -e option for runsc100

If the code is built using Big Endian mode, it must be run using Big

Endian mode.

Reminder: (memory storage of a = 0x12345678)

Big Endian Mode

Little Endian Mode

p:00

1234

p:00

7856

p:02

5678

p:02

3412

4

Introduction to the SC140 Tools

Image 4
Contents Motorola Typical development process is represented in Figure Compiler Hands On File I/O ExerciseGood To Know Integer and Fractional Arithmetic Exercise Interpretation of 16-bit Integer and Fractional Data ValuesCompiler Support on StarCore Integer ArithmeticFractional Arithmetic Good To Know Local Versus Global Optimization Exercise Local OptimizationCompiler Support on StarCore StarCore C Compiler Local Optimization Global OptimizationMemory Alignment Exercise AA BB CC DD First Code Section Second Code Section Split Summation Exercise Code Generated Assembly Code Multi-Sample Exercise = ∑ a i x n For 0 ≤ n LIntermediate Version Compromise Between Memory and Speed Further Speed Optimization Control Code The True Bit Exercise Save Ex7.c as Ex71.c Calling an Assembly Routine From C Exercise Current Following output should be displayed Challenge Solutions to Exercises Introduction to the SC140 ToolsExercise AlignedExpected Motorola INC Intermediate version Compromise between Memory and Speed Compiler Support on StarCore Further Optimizing the Speed Compiler Support on StarCore Compiler Support on StarCore Motorola INC Zoffset equ Moffset equ Exercise Compiler Support on StarCore Compiler Support on StarCore AN2009/D