Question

3.

Recall that the CodeWarrior generates an S19 Hex File which will be uploaded into your

board when you debug your programs.

To read this file, navigate to the bin folder in your project directory, and open the *.S19

file using your editor. You should have a successful build for your project to find this

file (you can use lab4_part1 for example as it has been built successfully)

For example, the first $1 Record in the S19 Hex File of lab4_part1 reads as follow:

S123C000FEC03DFDC03B270E35ED31EC3169700434FB310326F2FEC03FEC31270BED3118AA

This S1 record has a 1's complement checksum = 0xAA which is the last byte

To calculate this checksum, you must add all the hex bytes (excluding S1) as:

Val=0x23 + 0xC0+.......+0x18 = 0x55

Then, the 1's complement checksum = 0xFF - Val = 0xAA in this example.

Review Chapter 8 section 8.3 of your textbook for more details

Download and extract lab4_part3. This program will calculate the 1's complement

checksum of one S1 record and display the result on the 8 LEDs.

The program defines an array S1 as

char S1[ ] = "05FFFEC029";

If you build this project, you will get a link error because the function checksum is not

defined. Define this function in the util.asm file.

Note: The bytes are encoded as ASCII characters inside $1 array. For example, the first byte

0x05 in the S1 Record is stored as 0x30 followed by 0x35 in the S1 array.

In this example, the checksum subroutine must somehow extract and add the following bytes

0x05, 0xFF, 0xFE, 0xC0, and 0x29

To confirm your work, change S1 array to have other S1 Records values and re-run

your program.

Question image 1