3 TARGET PROGRAM AND DEBUGGING

3. Debugging in the Flash memory

In the target system in which a Flash memory has mounted, the target program can be debugged by writing it into the Flash memory using the debugger.

Notes: • When debugging the target program in the Flash memory, the software break function (bs command) cannot be used.

The debugger db33 ver. 1.72 or later version supports data writing to the Flash memory on the target board. To debug using the Flash memory, create Flash erase and Flash write routines in the user program and write the program following the instructions below:

After starting the debugger, follow the process below before starting to debug:

1.Load and initialize the Flash erase/write routines.

2.Erase the Flash memory.

3.Set up the trap table base address.

4.Load the target program.

5.Reset the CPU.

6.Set up a hardware PC break point for the forced break function.

The following shows a debug-command file example in which the above process is described.

Example: "dmt33004\sample\led2.cmd"

lf ..\sample\flsh\am29f800.srf

; Load the Flash erase/write routines to the built-in RAM

fls

; Flash set up command

1

; 1: Set up 2: Clear

200000

; Flash memory start address = 0x200000 (2)

2fffff

; Flash memory end address = 0x2fffff (2)

FLASH_ERASE

; Flash erase routine start address (1)

FLASH_LOAD

; Flash load routine start address (1)

fle

; Flash memory erase command

0x200000

; Flash control register = 0x200000

0

; Erase start block, 0 = All area, 1–19 = Start section

0

; Erase end block, 1–19 = End section, 0 = Ignored

eb 4812d

; Set up TBRP (TTBR write protection register)

59

; Remove TTBR write protection

q

 

ew 48134

; Set up TTBR (trap table base register)

200000

; Set up base address to 0x200000 (Flash memory start address)

q

 

lf led2.srf

; Load the target program (0x200000~)

rsth

; Reset the CPU (reset vector at 0x200000 is set to PC)

bh ESC

; Set up a hardware PC break at the label ESC (for forced break)

*1: "am29f800.srf" is created so as to operate by loading into the built-in RAM (2KB).

When using this source for the S1C33104 after modifying, use the patch tool "cc33\utility\filter". *2: This sample ("dmt3 3004\sampl e\led2.srf ") assume s that a Flash memory of 1MB is locate d at

0x2000 00–0x2fff ff.

S1C33 FAMILY DEBUG MONITOR

EPSON

13

OPERATION MANUAL