Files
zTC1/mico-os/makefiles/OpenOCD/MX1290/MX1290.cfg

98 lines
2.4 KiB
INI

source [find mico-os/makefiles/OpenOCD/MX1290/core.cfg]
### chip_id() -- get chip revision id
proc chip_id { } {
# make sure the CPU is stopped and in a known state
reset halt
# chip id not known, print chip id for diagnostics
echo [format "Unknown chip id 0x%08x" $chip_id(0)]
}
### chip_fix() -- do chip specific fixup
proc chip_fixup { } {
$chip_id(0)
}
### program_image() -- program flash using openocd flash commands
#
# 1. Reset and halt processor in a known state
# 2. Erase the requested flash region and write $filename data at $offset
# in the flash
proc program_image { offset filename } {
# make sure the CPU is stopped and in a known state
reset halt
# do chip fixup if any
chip_fixup
# erase the flash region and write file data at the offset
flash write_image erase $filename $offset
}
### load() -- load any generic application axf image to ram and run ###
#
# 1. Reset and halt processor in a known state
# 2. Load axf image into internal ram of target device
# 3. Verify loaded axf image
# 4. Pass control to loaded image using its entry point address
#
# NOTE: Entry point address of axf image can be found using
# command: readelf -h <image>
proc load { img entry_point } {
# make sure the CPU is stopped and in a known state
reset halt
# do chip fixup if any
chip_fixup
# load the axf image
load_image $img
# verify the loaded image
verify_image $img
# execute the loaded image
resume $entry_point
}
### sh_load() -- load flashprog.axf (flash tool) image to ram and run ###
#
# 1. Reset and halt processor in a known state
# 2. Enable arm semihosting
# 3. Load axf image into internal ram of target device
# 4. Verify loaded axf image
# 5. Pass control to loaded image using its entry point address
#
# NOTE: Entry point address of axf image can be found using
# command: readelf -h <image>
proc sh_load { img entry_point } {
# make sure the CPU is stopped and in a known state
reset halt
# do chip fixup if any
chip_fixup
# load the axf image
load_image $img
# verify the loaded image
verify_image $img
# enable semihosting by default (needed for flashprog)
arm semihosting enable
# attach handler for halt
MX1290.cpu configure -event halted {
echo "Flashprog Complete"
shutdown
}
# execute the loaded image
resume $entry_point
}