jt_arm.c File Reference

#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_cortex.h"
#include "jt_mmu.h"
#include "jt_instr.h"

Functions

Variables


Detailed Description

ARM7TDMI,ARM9TDMI and ARM Cortex-M3 Interface

Note: We support ARM7TDMI, ARM9TDMI and ARM Cortex-M3 only.
The ARM7TDMI core uses scan chain 1 with a wide of 33 bits to send instructions and exchange data values to the debug unit.
The ARM9TDMI core uses scan chain 1 with a wide of 67 bits (32 bit instr. 32 bit data and 3 bit control).
The ARM10TDMI core does not have this kind of unit at chain 1. (It's using a different mechanism.)
The ARM Cortex-M3 core not uses a scan chain.
It is using the 35 bit Debug Port and the 35 bit Access Port.


Function Documentation

void jtag_arm_ReadCpuRegs ( int  reset_inst_counter  ) 

Read out ARM CPU core registers R0..R15 and CPSR.
The values are stored inside of the global structure named CPU.

Parameters:
reset_inst_counter try to reset the PC (maybe useful, maybe not)
Returns:
-

References arm_info::core_number, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), error_exit_code, ICERT_REG_DEBUG_STATUS, ice_state::ignore_stepbug, instr_intest, INTEST, ice_state::is_debugrequest, ice_state::is_step_mode, jtag_arm7_ReadCpuRegs(), jtag_arm9_ReadCpuRegs(), jtag_arm_IceRT_RegRead(), jtag_arm_set_chain(), jtag_cortex_core_ReadCpuRegs(), and jtag_send_instr().

Referenced by gdb_check_thumb_support(), gdb_main_loop(), gdb_monitor_Rcmd(), gdb_restart(), and jtag_test().

void jtag_arm_DumpCPUregs ( void   ) 
void jtag_arm_WriteCpuRegs ( void   ) 

Write back the stored CPU register to the ARM core.
(This function is used for test only.)

Parameters:
- 
Returns:
-

References arm_info::core_number, error_exit_code, instr_intest, INTEST, jtag_arm7_WriteCpuRegs(), jtag_arm9_WriteCpuRegs(), jtag_arm_set_chain(), jtag_cortex_core_WriteCpuRegs(), jtag_send_instr(), and scan_chain.

Referenced by jtag_test().

void jtag_arm_PrepareEnterDebug ( void   ) 

Prepare to enter Debug Mode.
(or make sure it will be entered soon.)

Parameters:
- 
Returns:
-

References arm_info::core_number, error_exit_code, jtag_arm_IceRT_PutAnyBreakPoint(), jtag_cortex_dwt_ClearAnyWatchPoint(), jtag_cortex_fpb_ClearAnyHWBreakPoint(), and jtag_cortex_PrepareEnterDebugHalt().

Referenced by gdb_main_loop(), gdb_restart(), and jtag_test().

void jtag_arm_ClearAnyBreakPoint ( void   ) 
void jtag_arm_PrepareExitDebug ( void   ) 

Write back the stored CPU register to the ARM core and restart execution to continue the current program.
Also cleanup BreakPoints (if necesary)

-- note on exit we messed up the PC so we can't access the Memory within the debug state.
But we can correct this next time we read out the CPU register

Parameters:
- 
Returns:
-

References arm_info::core_number, CPU, DBG_LEVEL_GDB_ARM_INFO, dbgPrintf(), error_exit_code, reg_set::ext, instr_intest, INTEST, ice_state::is_debugrequest, jtag_arm7_PrepareExitDebug(), jtag_arm9_PrepareExitDebug(), jtag_arm_IceRT_ClearAnyBreakPoint(), jtag_arm_set_chain(), jtag_cortex_core_PrepareExitDebug(), jtag_send_instr(), reg_set::RegExt::RegV4Ext::prev_CPSR, scan_chain, and reg_set::RegExt::v4.

Referenced by gdb_action_continue(), gdb_main_loop(), and jtag_test().

void jtag_arm_FinalExitDebug ( void   ) 

Finalize to exit debug state
place RESTART into Jtag - IR
enter Jtag - Tap state RUN/IDLE

Parameters:
- 
Returns:
-

References arm_info::core_number, error_exit_code, ICERT_REG_DEBUG_CONTROL, instr_restart, ice_state::is_debugrequest, jtag_arm_IceRT_RegWrite(), jtag_cortex_core_FinalExitDebug(), jtag_eos(), jtag_send_instr(), and RESTART.

Referenced by gdb_action_continue(), gdb_main_loop(), and jtag_test().

void jtag_arm_Step ( uint32_t  next_instr  ) 
void jtag_arm_ResynchStep ( void   ) 

Resynchronize step in ARM mode.
Write back some of the stored CPU register to the ARM core and execute one "b ." instruction.

Parameters:
- 
Returns:
-

References arm_info::core_number, DBG_LEVEL_JTAG_ICERT, dbgPrintf(), error_exit_code, ICERT_REG_DEBUG_STATUS, instr_intest, INTEST, jtag_arm7_ResynchStep(), jtag_arm9_ResynchStep(), jtag_arm_chain1_sysspeed_restart(), jtag_arm_IceRT_RegRead(), jtag_arm_set_chain(), jtag_send_instr(), and scan_chain.

void jtag_arm_ReadWordMemory ( uint32_t  address,
int  howmanywords,
uint32_t *  buf 
)

Read out word memory into the given buffer.

Parameters:
address target machine address (memory at ARM side)
howmanywords number of words to read
buf pointer to destination read buffer (memory at server side)
Returns:
-

References arm_info::core_number, DBG_LEVEL_GDB_ARM_WARN, DBG_LEVEL_JTAG_ARM_LOW, dbgPrintf(), error_exit_code, instr_intest, INTEST, ice_state::is_debugrequest, jtag_arm7_ReadWordMemory(), jtag_arm9_ReadWordMemory(), jtag_arm_set_chain(), jtag_cortex_AHB_ReadWordMemory(), jtag_send_instr(), and scan_chain.

Referenced by gdb_read_memory_block(), jtag_test(), and useWorkspace().

uint32_t jtag_arm_ReadWord ( uint32_t  address  ) 
uint32_t jtag_arm_ReadHalfword ( uint32_t  address  ) 
uint32_t jtag_arm_ReadByte ( uint32_t  address  ) 
void jtag_arm_WriteWord ( uint32_t  address,
uint32_t  value 
)
void jtag_arm_WriteHalfword ( uint32_t  address,
uint16_t  value 
)
void jtag_arm_WriteByte ( uint32_t  address,
uint16_t  value 
)
void jtag_arm_WriteMemoryBuf ( uint32_t  address,
int  howmanywords,
uint32_t *  buf 
)

Write back word memory from the given buffer.

Parameters:
address target machine address (memory at ARM side)
howmanywords number of words to read
buf pointer to source write buffer (memory at server side)
Returns:
-

References arm_info::core_number, DBG_LEVEL_GDB_ARM_WARN, DBG_LEVEL_JTAG_ARM_LOW, dbgPrintf(), error_exit_code, instr_intest, INTEST, ice_state::is_debugrequest, jtag_arm7_WriteMemoryBuf(), jtag_arm9_WriteMemoryBuf(), jtag_arm_set_chain(), jtag_cortex_AHB_WriteMemoryBuf(), jtag_send_instr(), and scan_chain.

Referenced by gdb_writeback_memory_block(), gdb_writeback_RamWorkspace(), jtag_test(), stm32FlashProgram(), and useWorkspace().

void jtag_arm_RunProgram ( uint32_t  address  ) 
unsigned int jtag_arm_PollDbgState ( void   ) 

Variable Documentation

int scan_chain = -1
struct reg_set CPU
struct ice_state ice_state = {0,0,0,0,0,0,{0,0,{0},0,0,{0}},{0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0}}
struct arm_info arm_info = {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

This file is part of the documentation for JTAG-GDB Server for ARM .

Generated on Mon Feb 15 21:23:21 2010 by doxygen 1.6.2.