Download PDF

C&M Development Team
Calm Series DOS SIM/EMUL
Title
Document
Number
Abstract
Calm Series DOS Sim/EMUL
TN_CNM_TclCalmV2_20100629
The document gives details regarding the CalmSHINE16Plus V2 DOS emulator /
simulator environment, its invocation and command line options.
C&M Development Team / System LSI Division
Confidential Property of C&M Development Team
C&M Development Team
Copyright © 2003 Samsung Electronics Co, Ltd. All Rights Reserved.
Though every care has been taken to ensure the accuracy of this document, Samsung Electronics
Co, Ltd. cannot accept responsibility for any errors or omissions or for any loss occasioned to any
person, whether legal or natural, from acting, or refraining from action, as a result of the
information contained herein. Information in this document is subject to change at any time
without obligation to notify any person of such changes.
Samsung Electronics Co, Ltd. may have patents or patent pending applications, trademarks
copyrights or other intellectual property rights covering subject matter in this document. The
furnishing of this document does not give the recipient or reader any license to these patents,
trademarks copyrights or other intellectual property rights.
No part of this document may be communicated, distributed, reproduced or transmitted in any
form or by any means, electronic or mechanical or otherwise, for any purpose, without the prior
written permission of Samsung Electronics Co, Ltd.
The document is subject to revision without further notice.
All brand names and product names mentioned in this document are trademarks or registered
trademarks of their respective owners.
Contact Address
Samsung Electronics Co., Ltd.
San#24 Nongseo-Ri, Giheung-Eup,
Yongin-City, Gyeonggi-Do,
Korea 449-711
Tel: (82)-(31)-209-3199
Fax: (82)-(31)-209- 6494
Home Page:
Contact us:
http://www.samsung.com/calmsdk
[email protected]
MCU Tool Work Group
C&M Business enabling P/J
C&M Development Team
System LSI Division,
Device Solution Network
C&M Development Team
Confidential Property of Samsung Electronics Co., Ltd.
II
C&M Development Team
Revision History
Date
June 29, 2010
C&M Development Team
Version
1.0
Author
CalmSupport
Amendment
Created
Confidential Property of Samsung Electronics Co., Ltd.
III
C&M Development Team
Contents
1
2
3
4
5
Overview .................................................................................................. 1
Organization .............................................................................................. 1
User interface ............................................................................................ 2
3.1 calm_set_memspec ................................................................................. 2
3.2 calm_target_create ................................................................................. 2
3.3 calm_target_delete ................................................................................. 4
3.4 calm_target_reset ................................................................................. 4
3.5 calm_load_hex
................................................................................. 5
3.6 calm_load_dbg
................................................................................. 5
3.7 calm_read_dmem ................................................................................... 6
3.8 calm_read_cmem ................................................................................. 6
3.9 calm_write_dmem ................................................................................. 7
3.10 calm_write_cmem ................................................................................. 7
3.11 calm_set_dmem ................................................................................. 8
3.12 calm_set_cmem ................................................................................. 9
3.13 calm_read_all_reg ................................................................................. 9
3.14 calm_write_a_reg ................................................................................. 9
3.15 calm_step
............................................................................... 10
3.16 calm_run
............................................................................... 10
3.17 calm_bp_run
............................................................................... 10
3.18 calm_set_bp
............................................................................... 11
3.19 calm_remove_bp ............................................................................... 11
3.20 calm_set_wp_attribute
..................................................................... 12
3.21 calm_puts_wp_attribute ..................................................................... 12
3.22 calm_list ......................................................................................... 13
3.23 calm_goto_main ............................................................................. 13
3.24 calm_help ......................................................................................... 13
Sending Stop Signal to running TclCalmV2 ......................................................... 14
Examples ................................................................................................. 14
C&M Development Team
Confidential Property of Samsung Electronics Co., Ltd.
IV
C&M Development Team
1 Overview
TclCalmV2 is small debugging utility for CalmRISC16/Secucalm based on
console.
Explain here how TclCalm16 Plus can connect to Emulator / Simulator.
Also mention about how user can debug the HEX file.
2 Organization
- Calm16Bin
/TclCalmV2.exe
/Calm16Control.exe
/SimDLL_CalmRISC16.dll
/SimDLL_SecuCalm.dll
/TclEmuDLL16.dll
/hdbufull16.dll
/hdbumid_cr16.dll
/hdbumid_sc.dll
/hdbufull3200.dll
/DosCoffDebug.dll
/EFF.dll
/InstructionDecoder.dll
/tcl83.dll
/MFC42D.dll
/MFCD42D.dll
/MFCN42D.dll
/MFCO42D.dll
/MSVCIRTD.dll
/MSVCRTD.dll
/stlport_vc645.dll
- Calm16Doc
- Calm16Test
- Lib
: Binary and DLLs
: Tcl extension for debugging
: Utility for TclCalmV2 process control
: DLL for CalmRISC16 instruction set simulator
: DLL for SecuCalm instruction set simulator
: DLL for CalmRISC16/SecuCalm emulator
: DLL for JATG interfacing
: DLL for JATG interfacing
: DLL for JATG interfacing
: DLL for JATG interfacing
: DLL for processing debug information
: DLL for processing debug information
: DLL for decoding for instruction
: TCL core DLL
: MFC Library
: MFC Library
: MFC Library
: MFC Library
: MS Visual C Library
: MS Visual C Library
: STLport Library
: document file
: Sample tests
: TCL library folder
*Caution : Calm16Bin’s binaries are not compatible with those in CalmSHINE16Plus V2.
C&M Development team
Confidential Property of C&M Development Team.
1
C&M Development Team
3 User interface
TclCalmV2 is Tcl extension for debugging CalmRISC16/SecuCalm.
Tcl is a script language that can run on Windows 95/98/NT/2000/XP, but also on nearly all UNIX
machine. TclCalmV2 is Tcl extension program and can be run on Windows 2000/XP.
TclCalmV2 [input_batch_script_file] [user program’s standard output_dump_file]
TclCalmV2 supports all Tcl core commands, and you can use following additional commands
NAME
3.1 calm_set_memspec
- Inform memory specification to debugger
SYNOPSIS
calm_set_memspec -d dvm_file
DESCRIPTION
Before create target, you should specify the same memory information file(*.mem,
*.dvm) that used in project building process. If the debugger successfully read the input
files, command will return 1, unless it will stop the interpreting.
EXAMPLE
% calm_set_memspec –d ../../mem/s3ct9kw.dvm
NAME
3.2 calm_target_create
- Create target(sim or emul)
SYNOPSIS
calm_target_create <sim/emul> ?-p <com#/parallel/usb>?
?-icetype <full/usbfull/im500>? -device device_name
DESCRIPTION
Create one of the target simulator or emulator. If you want to create emulator, you
should specify additional information about connection method. If the debugger
successfully create target, command will return 1, unless it will stop the interpreting in
simulator.
The icetype option each means full is OPENice-C1600, usbfull is OPENice-C3200 and
im500 is IM-500(S) that is YIC company’s emulators.
EXAMPLE
% calm_target_create sim -device s3ct9kw
#create simulator
#create emulator, and use USB port
% calm_target_create emul –p usb -icetype im500 -device s3ct9kw
C&M Development team
Confidential Property of C&M Development Team.
2
C&M Development Team
Supported Device name list
Devices
S3CC9AB
S3CC9A9,
S3FC9BJ,
S3CC9CB, S3CC9DB
S3CC9C9, S3CC9D9, S3CC9N9, S3CC9NB, S3CC929, S3CC92B
S3CC9DA, S3CC9FB, S3CC9P9, S3CC9PB, S3CC9RB, S3CC9W9
S3CC9E4, S3CC9E8, S3CC9EB, S3CC9EC, S3CC9ED, S3CC9EF, S3CC9G4, S3CC9G8, S3CC9GC,
S3CC9GW, S3CC9H4, S3CC9NA, S3CC9NC, S3CC9NF, S3CC9NE, S3CC9NW, S3CC9QD, S3CC9TC,
S3CC9TF, S3CC9TW, S3CC9L5, S3CC9LA, S3CC9LC, S3CC91A, S3CC915, S3CC917, S3CC918,
S3CC924, S3CC928, S3CC92C, S3CC98A, S3CC98C, S3CC96A, S3CC96W
S3FC92D, S3FC9CB, S3FC9DC, S3FC9DD, S3FC9DE, S3FC9DF, S3FC9UB
S3CC9AW, S3CC9PF, S3CC9PW, S3CC91C, S3CC92W, S3CC94C, S3CC95F, S3CC96C
S3FC9AE, S3FC9AD, S3FC9AC
S3CT9KW
S3FT9KG
C&M Development team
Confidential Property of C&M Development Team.
3
C&M Development Team
NAME
3.3 calm_target_delete - Delete target
SYNOPSIS
calm_target_delete
DESCRIPTION
You can delete target created by “calm_target_create”. If you want to change target
type, Delete the previous target, and recreate the target you want.
EXAMPLE
% calm_target_create sim
#create simulator
…
% calm_target_delete
#delete simulator
% calm_target_create emul –p usb -icetype im500 -device s3ct9kw #recreate emulator
…
NAME
3.4 calm_target_reset
- Reset target
SYNOPSIS
calm_target_reset
DESCRIPTION
Use this command, to initialize target state. The PC will be changed to reset vector address.
And system register will be reinitialized. You must use “calm_goto_main” command instead of
“calm_target_reset” command, if you using a device in list as below,
DEVICE LIST:
Devices
S3FC9BJ
S3FC92D, S3FC9CB, S3FC9DC, S3FC9DD, S3FC9DE, S3FC9DF, S3FC9UB
S3FC9AE, S3FC9AD, S3FC9AC
S3CC9E4, S3CC9E8, S3CC9EB, S3CC9EC, S3CC9ED, S3CC9EF, S3CC9G4, S3CC9G8, S3CC9GC,
S3CC9GW, S3CC9H4, S3CC9NA, S3CC9NC, S3CC9NF, S3CC9NE, S3CC9NW, S3CC9QD, S3CC9TC,
S3CC9TF, S3CC9TW, S3CC9L5, S3CC9LA, S3CC9LC, S3CC91A, S3CC915, S3CC917, S3CC918,
S3CC924, S3CC928, S3CC92C, S3CC98A, S3CC98C, S3CC96A, S3CC96W
S3CC9DA, S3CC9FB, S3CC9P9, S3CC9PB, S3CC9RB, S3CC9W9
S3CC9AW, S3CC9PF, S3CC9PW, S3CC91C, S3CC92W, S3CC94C, S3CC95F, S3CC96C
S3CT9KW, S3FT9KG
C&M Development team
Confidential Property of C&M Development Team.
4
C&M Development Team
EXAMPLE
%
%
%
%
calm_target_create emul –p usb -icetype im500 -device s3ct9kw
calm_load_hex ../../test.hex
#load program file
calm_load_hex ../../test.hxd
#load NVM file
calm_load_dbg ../../test.elf
#load debug information
% calm_target_reset
% calm_run
….
% calm_target_reset
% calm_run
#your program was finished here
#reset target to re-run
NAME
3.5 calm_load_hex
- Load HEX file to target memory
SYNOPSIS
calm_load_hex hex_file
DESCRIPTION
Our CalmSHINE16 V2’s linker generates Intel HEX output file. TclCalmV2 supports only
the Intel HEX format file for program downloading.
EXAMPLE
See the example of calm_target_reset
NAME
3.6 calm_load_dbg
- Load debugging information
SYNOPSIS
calm_load_dbg ../../test.elf
DESCRIPTION
The CalmSHINE16 V2’s linker will generates “your_project.ELF” file, when you use “-g”
option in building time. “.ELF” has C-source symbolic debuging information. After
londing “ELF”, you can use symbolic debugging capability.
EXAMPLE
%
%
%
%
calm_load_dbg ../tset.ELF
calm_set_bp testFunc
calm_run
calm_remove_bp testFunc
C&M Development team
# load ELF file
# set break-point to function testFunc’s start addr
# remove break-point
Confidential Property of C&M Development Team.
5
C&M Development Team
NAME
3.7 calm_read_dmem
- Read data memory
SYNOPSIS
calm_read_dmem start_addr'h ?byte_size'd?
DESCRIPTION
Read byte_size data memory at start_addr. Default byte_size is 16 bytes. You can set
the byte_size by a maximum 100 bytes.
EXAMPLE
% calm_read_dmem 0x00100
# default 16 bytes data memory read
000040C000003E3C7FA73FDE3FD340AD
% calm_read_dmem 100 4
# 4 bytes data memory read at 0x100
000040C0
% calm_read_dmem 100 10
# 10 bytes
000040C000003E3C7FA7
% set dmem(102) [calm_read_dmem 102 1]
% puts $dmem(102)
40
% calm_read_dmem 0x00100 101
# Truncation message
byte size 101 is to big. truncated byte_size to 100
000040C000003E3C7FA73FDE3F .... 000040C000003E3C7FA73FDE3F
NAME
3.8 calm_read_cmem
- Read code memory
SYNOPSIS
calm_read_cmem start_addr'h ?word_size'd?
DESCRIPTION
Read word_size code memory at start_addr. Default word_size is 8. You can set the
byte_size by a maximum 50 words.
EXAMPLE
% calm_read_cmem 0x00100
# default 8 words code memory read
A3F385E289E3D3FDA3E387E6ABF2AEFE
% calm_read_cmem 100 4
# 4 words code memory read at 0x100
A3F385E289E3D3FD
% calm_read_cmem 100 10
# 10 words
A3F385E289E3D3FDA3E387E6ABF2AEFEA2F2A3F3
% set cmem(102) [calm_read_cmem 102 1]
% puts $cmem(102)
A3F3
% calm_read_cmem 0x0 51
# Truncation message
word size 51 is too big. truncated word_size to 50
00A0002B ... 84E040ED7F4E8F0007D
C&M Development team
Confidential Property of C&M Development Team.
6
C&M Development Team
NAME
3.9 calm_write_dmem
- Write data memory
SYNOPSIS
calm_write_dmem start_addr'h byte_size'd byte_values
DESCRIPTION
Write byte_size data memory to start_addr.
EXAMPLE
% calm_read_dmem 0x00100
# default 16 bytes data memory read
000040C000003E3C7FA73FDE3FD340AD
% calm_write_dmem 0x100 2 1234
# 2 bytes write
% calm_read_dmem 100
123440C000003E3C7FA73FDE3FD340AD
% calm_write_dmem 0x100 10 12345678901234567890 # 10 bytes write
% calm_read_dmem 0x100
123456789012345678903FDE3FD340AD
NAME
3.10 calm_write_cmem
- Write code memory
SYNOPSIS
calm_write_cmem start_addr'h word_size'd word_values
DESCRIPTION
Write word_size code memory to start_addr.
EXAMPLE
% calm_read_cmem 0x00100
# default 8 words code memory read
A3F385E289E3D3FDA3E387E6ABF2AEFE
% calm_write_cmem 0x100 2 12345678 # 2 words write
% calm_read_cmem 100
1234567889E3D3FDA3E387E6ABF2AEFE
% calm_write_cmem 0x100 5 12345678901234567890
# 5 words write
% calm_read_cmem 100
1234567890123456789087E6ABF2AEFE
C&M Development team
Confidential Property of C&M Development Team.
7
C&M Development Team
NAME
3.11 calm_set_dmem
- Set data memory
SYNOPSIS
calm_set_dmem start_addr'h end_addr'h byte_value’h
DESCRIPTION
Fill memory region with byte_value, where the start address is start_addr’h and end
address is end_addr’h
EXAMPLE
% calm_read_dmem 0x100
000A0002B6DF2000B8DDD7FDD7FCD7FB
% calm_set_dmem 0x100 0x104 0xFF
#fill mem from 0x100 to 0x103 with 0xFF
% calm_read_dmem 0x100
FFFFFFFFB6DF2000B8DDD7FDD7FCD7FB
NAME
3.12 calm_set_cmem
- Set code memory
SYNOPSIS
calm_set_cmem start_addr'h end_addr'h word_value'h
DESCRIPTION
Fill memory region with word_value, where the start address is start_addr’h and end
address is end_addr’h
EXAMPLE
% calm_read_cmem 0x0
000A0002B6DF2000B8DDD7FDD7FCD7FB
% calm_set_cmem 0x0 0x4 0xEAEA
#fill mem from 0x0 to 0x3 with 0xEAEA
% calm_read_cmem 0x0
EAEAEAEAB6DF2000B8DDD7FDD7FCD7FB
C&M Development team
Confidential Property of C&M Development Team.
8
C&M Development Team
NAME
3.13 calm_read_all_reg
- Read all core registers
SYNOPSIS
calm_read_all_reg
DESCRIPTION
Display core register values
EXAMPLE
% set reg_values [calm_read_all_reg]
# read all core registers
% puts $reg_values
CCCC 0000 0000 0202 0000 CCCC 0000 CCCC 0000 0000 0003 A4DA CCCC CCCC 2036
FFFE 3F 00 00 00 00 3C 00 00 0000 0000 0000 0000 0000 0000 0000 0040 00203C
#R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R0 R11 R12 R13 R14 R15
#E8 E9 E10 E11 E12 E13 E14 E15
#SSR_FIQ SPCL_FIQ SPCH_FIQ SSR_IRQ SPCL_IRQ SPCH_IRQ SSR_SWI SR PC
% set PC [lindex $reg_values 32]
% puts $PC
% 00203C
# PC is 32’th data
NAME
3.14 calm_write_a_reg
SYNOPSIS
calm_write_a_reg
- Write a core register
reg_index'd reg_value'h
DESCRIPTION
Write a core register.
EXAMPLE
% set reg_values [calm_read_all_reg]
# read all core registers
% puts $reg_values
CCCC 0000 0000 0202 0000 CCCC 0000 CCCC 0000 0000 0003 A4DA CCCC CCCC 2036
FFFE 3F 00 00 00 003C 0000 001F 00203C
% calm_write_a_reg 0 9c9c
#write a value 0x9c9c to R0
% set reg_values [calm_read_all_reg]
% puts $reg_values
9C9C 0000 0000 0202 0000 CCCC 0000 CCCC 0000 0000 0003 A4DA CCCC CCCC 2036
FFFE 3F 00 00 00 003C 0000 001F 00203C
C&M Development team
Confidential Property of C&M Development Team.
9
C&M Development Team
NAME
3.15 calm_step
- Execute single instruction
SYNOPSIS
calm_step
DESCRIPTION
Execute instruction pointed by IP.
EXAMPLE
% calm_target_reset
% set PC [getPC]
% puts $PC
001FC4
% calm_step
% puts [getPC]
001F6
# reset target, current PC is set to reset vector address
# getPC ? see 4.Example
# single step
NAME
3.16 calm_run
- Execute Program
SYNOPSIS
calm_run
DESCRIPTION
Execute till next breakpoint or end of program.
EXAMPLE
% calm_target_reset
% calm_run
NAME
3.17 calm_bp_run
- Execute Program to specified address
SYNOPSIS
calm_bp_run break_addr'h/function_name
DESCRIPTION
Execute till next breakpoint or specified address. The specified address can be a
function name or absolute address. The function name can be specified only if
corresponding ELF file is loaded.
EXAMPLE
% calm_bp_run 0x1FC6
% puts [getPC]
001FC6
% calm_step
% puts [getPC]
001FC8
C&M Development team
Confidential Property of C&M Development Team.
10
C&M Development Team
NAME
3.18 calm_set_bp
- Set break point to specified address or function
SYNOPSIS
calm_set_bp ? break_addr'h/function_name ?
DESCRIPTION
Set a breakpoint at specified position. The position can be a function name or absolute
address. If no address specified, it will display all break points
EXAMPLE
% calm_set_bp testFunc
% calm_set_bp 0x2020
% calm_set_bp
bp(0) 0x2020
bp(1) 0x3A80
# addr of testFunc
NAME
3.19 calm_remove_bp
- Remove break point at specified address or function
SYNOPSIS
calm_remove_bp break_addr'h/function_name/all
DESCRIPTION
Removes a breakpoint set with function name or direct address. Also all breakpoints
can be removed with all option.
EXAMPLE
% calm_remove_bp 0x2020
% calm_remove_bp testFunc
% calm_remove_bp all
C&M Development team
Confidential Property of C&M Development Team.
11
C&M Development Team
NAME
3.20 calm_set_wp_attribute – Set watch point attribute
SYNOPSIS
calm_set_wp_attribute channelid ?-enable <true/false>? ?-type <data/code>? ?-addr
break_addr'h? ?-addrmask addr_ mask'h? ?-data data_value'h? ?-datamask data_value_mask'h?
?-datatype <byte/word>? ?-compare <*/lt/equ/gt>? ?–state <*/r/w/rw>? ?–pass count_value?
DESCRIPTION
Set watch point attribute. You can get the detail information about “watch point
setup” in the CalmSHINE16Plus V2 Manual Chapter 5.8
EXAMPLE
# Ch0 is set to detect when accessing ROM area with LDW instruction. Break will occur
when accessing ROM area with Word manner
% calm_set_wp_attribute 0 -enable true -type data -addr 0x07ffff -addrmask 0x07ffff
-data 0000 -datamask 0xffff -datatype word -compare * -state rw -pass 1
# Ch1 is set to detect when accessing ROM area with LDB instruction. The other
conditions are same except “Data Type” as those of Ch0
% calm_set_wp_attribute 1 -enable true -type data -addr 0x07ffff -addrmask 0x07ffff
-data 0x0000 -datatype byte -datamask 0xff -compare * -state r -pass 1
# Ch2 is set to detect when writing 0xa to address 0x200000 with LDW instr
% calm_set_wp_attribute 2 -enable true -type data -addr 0x200000 -addrmask 0
-data 0x000a -datamask 0x0000 -datatype word -compare equ -state w -pass 1
NAME
3.21 calm_puts_wp_attribute
- List all watch point channel attributes
SYNOPSIS
calm_puts_wp_attribute
DESCRIPTION
List all watch point channel attributes.
EXAMPLE
% calm_puts_wp_attribute
C&M Development team
Confidential Property of C&M Development Team.
12
C&M Development Team
NAME
3.22 calm_list
- List dis-assembled code
SYNOPSIS
calm_list ? start_addr’h ?
DESCRIPTION
Lists dis-assembled code from start_addr, If no start_addr , it will list dis-assembly
code from PC. if you load debug info(ELF), you can see some useful information, like
file_name and line.
EXAMPLE
% calm_list
file = main.c, line = 38, pc = 0x00000032
 0x00000032 9E 80
CLRSR 0
0x00000034 9E 81
CLRSR 1
0x00000036 9E 82
CLRSR 2
0x00000038 A9 80 00 00 LD A9, #0x00000000
NAME
3.23 calm_goto_main
- target reset and break point run to “main” entry
SYNOPSIS
calm_goto_main
DESCRIPTION
This command does two operations – “target reset” and “run to main” – at once.
We recommend this command instead of the series commands like “calm_target_reset”,
“calm_bp_run main”.
EXAMPLE
% calm_load_hex …
% calm_load_dbg …
% calm_goto_main
# now current PC is set to “main” entry
NAME
3.24 calm_help
- List all calm_* commands
SYNOPSIS
calm_help
DESCRIPTION
Lists all TclCalmV2 debugger commands.
EXAMPLE
% calm_help
C&M Development team
Confidential Property of C&M Development Team.
13
C&M Development Team
4 Sending Stop Signal to running TclCalmV2
TclCalmV2 is not a event driven program. Therefore, the command “calm_run” may block user
command inputs. To escape from blocked state, use “CTRL+C” or “Calm16Control.exe”
The “CTRL+C” send interrupt signal to TclCalmV2, and will just break running state. After
“CTRL+C”, you can issue command sequence to tcl-prompt. Another way to break running state
is “Calm16Control.exe” utility. You can use this utility like below.
% Calm16Control.exe stop
% Calm16Control.exe kill
# break the running state, and then show tcl-prompt
# kill the TclCalmV2.exe process
5 Examples
This is example of tcl script
######################## file name run.tcl ######################################
array set TOOL {
calm_path
project_path
}
.
.
proc runScenario {deviceName projectName} {
global TOOL
#load mem spec.
set ret [calm_set_memspec -d $TOOL(calm_path)/$deviceName.dvm]
puts "step : set memspec"
#init target
if {$targetEnv == “emul”} {
set ret [calm_target_create emul -p usb -icetype im500 -device $deviceName]
} else {
set ret [calm_target_create sim -device $deviceName]
}
if {$ret != 1} {
return 0
}
puts "step : init target"
#set wcount [calm_set_cmem 0x00100000 0x00100200 0xffff]
#set wcount [calm_set_cmem 0x00100000 0x00800000 0xffff]
#puts "step : set mem $wcount written"
set ret [calm_load_hex $TOOL(calm_path)/$projectName.hex]
if {$ret != 1} {
puts "fail to load hex file"
return 0
}
puts "step : load hex"
C&M Development team
Confidential Property of C&M Development Team.
14
C&M Development Team
set ret [calm_load_hex $TOOL(calm_path)/$projectName.hxd]
if {$ret != 1} {
puts "fail to load hxd file"
return 0
}
puts "step : load hxd"
set ret [calm_load_dbg $TOOL(project_path)/$projectName.elf]
if {$ret != 1} {
puts "fail to load elf file"
return 0
}
puts "step : load elf"
#reset target
set ret [calm_target_reset]
puts "step : target reset"
calm_run
set ret [calm_target_reset]
#set break point to function "main"
set ret [calm_set_bp main]
puts "step : set bp"
if {$targetEnv == “emul”} {
calm_set_wp_attribute 0 -enable true -type code -addr 0 0xbc -addrmask 0x0 data 0 -datamask 0x0 -datatype word -compare * -state r -pass 1
calm_puts_wp_attribute
} else {
calm_set_bp 0xbc
}
calm_run
set pc [lindex [calm_read_all_reg] 32]
puts "PC = 0x$pc"
calm_run
set pc [lindex [calm_read_all_reg] 32]
puts "PC = 0x$pc"
set mem_value [calm_read_dmem 0x200200 4]
puts "mem(0x200200) : $mem_value"
return 1
}
proc getPC {} {
set reg_values [calm_read_all_reg]
set PC [lindex $reg_values 32]
return $PC
}
C&M Development team
Confidential Property of C&M Development Team.
15
C&M Development Team
proc pc {} {
return "0X[lindex [calm_read_all_reg] 32]"
}
proc reset {} {
calm_goto_main
}
proc run {} {
calm_run
puts "PC = [pc]"
}
#set ret [runScenario s3ct9kw printhellod emul]
set ret [runScenario s3ct9kw printhellod sim]
if {$ret == 1} {
puts “Test OK!”
} else {
puts “Test Fail”
}
#restart program
reset
run
######################## end of file name run.tcl ####################################
dos_prompt%> TclCalmV2 run.tcl
C&M Development team
Confidential Property of C&M Development Team.
16
Similar pages