#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <ctype.h>
#include <unistd.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_flash.h"
#include "arm_gdbstub.h"
#include "arm_memory_mmap.h"
#include "arm_memory_workspace.h"
void gdb_writeback_memory_block | ( | uint32_t | addr, | |
uint32_t | word_len, | |||
uint32_t * | buf | |||
) |
Write-back the modified data block into the targets memory space.
If possible try to put a target WRITE program into our target workspace.
And transfer the Write-data via DCC.
If this is not possible write the memory via JTAG.
addr | target address | |
word_len | length of 32-Bit words to write | |
buf | pointer to source buffer |
References memMap::baseAddr, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), getWorkSpace(), ICERT_REG_DCC_CONTROL, ICERT_REG_DCC_DATA, jtag_arm_IceRT_RegRead(), jtag_arm_IceRT_RegRead_Once(), jtag_arm_IceRT_RegWrite(), jtag_arm_Mointor2DebugMode(), jtag_arm_PollDbgState(), jtag_arm_RunProgram(), jtag_arm_WriteMemoryBuf(), memMap::memBufferType, memMap::MemBufferType::Workspace::offset, useWorkspace(), memMap::MemBufferType::Workspace, and WORKSPACE_ALGO_WRITE.
Referenced by gdb_writeback_Ram().
int gdb_write_mem | ( | void * | mem_val, | |
int | addr, | |||
int | length | |||
) |
Write new data into local cache buffer.
(The real write will be done a little bit later in the write-back phase.)
mem_val | pointer to source of data | |
addr | start byte address of target memory | |
length | in bytes |
0 | OK | |
1 | Failure |
References memMap::baseAddr, bit_nset, memMap::MemBuffer::Byte, DBG_LEVEL_GDB_ARM_INFO_LOW, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), findMemMapOfAddr(), memMap::MemBufferType::Flash, memMap::length, memMap::memBuffer, memMap::memBufferType, MMAP_T_APPLICATION_FLASH, MMAP_T_CACHE, MMAP_T_FLASH, MMAP_T_IO, MMAP_T_RAM, MMAP_T_REREAD_ROM, MMAP_T_ROM, MMAP_T_SFA, MMAP_T_UNREAL, MMAP_T_UNUSED, MMAP_T_WORKSPACE, memMap::MemBufferType::Flash::numberOfSectors, memMap::MemBufferType::Ram, SECTOR_INVALID, SECTOR_WRITE, memMap::MemBufferType::Flash::sectorList, sector::size, memMap::type, memMap::MemBufferType::Ram::writeByteBitmap, and memMap::MemBufferType::Flash::writeByteBitmap.
Referenced by gdb_monitor_Rcmd(), gdbstub_write_binmem(), gdbstub_write_hexmem(), gdbWriteSoftwareBreakToRAM(), RemoveAllBreakpoints(), and RemoveBreakpoint().
int gdb_invalidate_Ram_Buffer | ( | void | ) |
Mark all cached RAM - Data is being invalid now.
Also invalidate RereadROM and Appl.Flash since this might have been changed at next debug entry, too.
Oh. better do not invalidate workspace (we should write even the old/modified data back)
- |
References memMapHead::firstMapEntry, memMap::MemBufferType::Flash, memMap::length, memMap::memBufferType, MMAP_T_APPLICATION_FLASH, MMAP_T_RAM, MMAP_T_REREAD_ROM, memMap::nextMap, memMapHead::numberOfEntrys, memMap::MemBufferType::Flash::numberOfSectors, memMap::MemBufferType::Ram, RAM_PAGE_SIZE, memMap::MemBufferType::Ram::readPageBitmap, SECTOR_INVALID, memMap::MemBufferType::Flash::sectorList, memMap::type, and memMap::MemBufferType::Ram::writeByteBitmap.
Referenced by gdb_action_continue(), gdb_action_step(), and gdb_monitor_Rcmd().
int gdb_invalidate_Rom_Buffer | ( | void | ) |
Mark all cached ROM - Data is being invalid now.
Also invalidate RereadROM and Appl.Flash since this might have changed at next debug entry, too.
(Don't inval Flash we still need it.)
- |
References memMapHead::firstMapEntry, memMap::MemBufferType::Flash, memMap::length, memMap::memBufferType, MMAP_T_APPLICATION_FLASH, MMAP_T_REREAD_ROM, MMAP_T_ROM, memMap::nextMap, memMapHead::numberOfEntrys, memMap::MemBufferType::Flash::numberOfSectors, memMap::MemBufferType::Ram, RAM_PAGE_SIZE, memMap::MemBufferType::Ram::readPageBitmap, SECTOR_INVALID, memMap::MemBufferType::Flash::sectorList, and memMap::type.
Referenced by gdb_monitor_Rcmd(), and gdb_query_symbol().
int gdb_invalidate_Flash_Buffer | ( | void | ) |
Mark all cached Flash - Data is being invalid now.
- |
References memMapHead::firstMapEntry, memMap::MemBufferType::Flash, memMap::length, memMap::memBufferType, MMAP_T_APPLICATION_FLASH, MMAP_T_FLASH, memMap::nextMap, memMapHead::numberOfEntrys, memMap::MemBufferType::Flash::numberOfSectors, SECTOR_INVALID, memMap::MemBufferType::Flash::sectorList, and memMap::type.
int gdb_flush_Flash | ( | uint32_t | addr, | |
uint32_t | len | |||
) |
Mark a range of cached Flash - Data as being invalid now.
addr | start address | |
len | length in bytes |
References memMap::baseAddr, memMapHead::firstMapEntry, memMap::MemBufferType::Flash, memMap::length, memMap::memBufferType, MMAP_T_APPLICATION_FLASH, MMAP_T_FLASH, memMap::nextMap, memMapHead::numberOfEntrys, memMap::MemBufferType::Flash::numberOfSectors, SECTOR_INVALID, memMap::MemBufferType::Flash::sectorList, and memMap::type.
Referenced by gdb_vquery().
int gdb_writeback_Ram | ( | void | ) |
Write back all cached RAM modification (including workspace replacements).
After this function return, the target RAM should hold the correct data.
- |
References memMap::baseAddr, bit_ffs, bit_nclear, bit_test, memMap::MemBuffer::Byte, DBG_LEVEL_GDB_ARM_ERROR, dbgPrintf(), memMapHead::firstMapEntry, gdb_writeback_memory_block(), gdb_writeback_RamWorkspace(), getWorkSpace(), memMap::MemBuffer::HalfWord, jtag_arm_WriteByte(), jtag_arm_WriteHalfword(), jtag_arm_WriteWord(), memMap::length, memMap::memBuffer, memMap::memBufferType, MMAP_T_RAM, memMap::nextMap, memMapHead::numberOfEntrys, memMap::MemBufferType::Workspace::offset, memMap::MemBufferType::Ram, memMap::type, memMap::MemBuffer::Word, memMap::MemBufferType::Workspace, WORKSPACE_SEGMENT_SIZE, and memMap::MemBufferType::Ram::writeByteBitmap.
Referenced by gdb_handle_exception(), gdb_monitor_Rcmd(), gdbWriteSoftwareBreakToRAM(), and RemoveAllBreakpoints().
void gdb_writeback_RamWorkspace | ( | void | ) |
In case we are having a RAM based workspace write the original data back to RAM. Also the workspace is free now.
- |
References memMap::baseAddr, bit_ffs, bit_nclear, bit_test, memMap::MemBuffer::Byte, DBG_LEVEL_GDB_ARM_ERROR, dbgPrintf(), getWorkSpace(), memMap::MemBuffer::HalfWord, jtag_arm_WriteByte(), jtag_arm_WriteHalfword(), jtag_arm_WriteMemoryBuf(), jtag_arm_WriteWord(), memMap::length, memMap::memBuffer, memMap::memBufferType, MMAP_T_RAM, memMap::MemBufferType::Ram, memMap::MemBufferType::Workspace::state, memMap::type, memMap::MemBuffer::Word, memMap::MemBufferType::Workspace, WORKSPACE_BROKEN, WORKSPACE_FREE, WORKSPACE_UNTESTED, and memMap::MemBufferType::Ram::writeByteBitmap.
Referenced by gdb_monitor_Rcmd(), and gdb_writeback_Ram().