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

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