T32: FailT32 support for Cortex-M3
Currently working: - Connect/Disconnect, Read CPU info - CMM Script generation and T32 startup via cmake (make runt32) - Read/Write Register, Read Program Pointer - Read/Write Memory - Single Breakpoint - Setting Memory Breakpoint TODO: - Fix mock aspect for T32_GetRam. - Fix Thumb2 bit in function addresses from ELFReader - Evaluate memory breakpoint hit
This commit is contained in:
@ -14,27 +14,34 @@ T32Connector::~T32Connector() {
|
||||
bool T32Connector::startup(){
|
||||
// Setup connection to Lauterbach
|
||||
m_log << "Remote connection: " << m_hostname << ":" << m_port << " - Packet length: " << m_packetlength << std::endl;
|
||||
T32_Config("NODE=", m_hostname);
|
||||
T32_Config("PACKLEN=", m_packetlength);
|
||||
T32_Config("PORT=", m_port);
|
||||
T32_Config("NODE=", m_hostname);
|
||||
T32_Config("PACKLEN=", m_packetlength);
|
||||
T32_Config("PORT=", m_port);
|
||||
|
||||
m_log << "Init." << std::endl;
|
||||
if(!err(T32_Init()) ) { return false; }
|
||||
if(!err(T32_Init()) ) { return false; }
|
||||
|
||||
m_log << "Attach." << std::endl;
|
||||
if(!err(T32_Attach(T32_DEV_ICD)) ) { return false; }
|
||||
if(!err(T32_Attach(T32_DEV_ICD)) ) { return false; }
|
||||
|
||||
word tmp, fpu, endian;
|
||||
char* cpuname[128];
|
||||
char * cpuname;
|
||||
//if(!err(T32_GetCpuInfo( reinterpret_cast<char**>(&m_cpustring), &fpu, &endian, &tmp))) { return false; }
|
||||
if(!err(T32_GetCpuInfo( reinterpret_cast<char**>(&cpuname), &fpu, &endian, &tmp))) { return false; }
|
||||
if(!err(T32_GetCpuInfo( (&cpuname), &fpu, &endian, &tmp))) { return false; }
|
||||
m_littleendian = (endian != 0);
|
||||
m_cpustring = reinterpret_cast<const char*>(cpuname);
|
||||
m_log << "Attached to: " << m_cpustring << (isBigEndian() == true ? " (BIG-endian)" : " (little-endian)") << std::endl;
|
||||
|
||||
m_log << "Attached to: " << m_cpustring << std::endl;
|
||||
// discoverMemory(DISCOVER_PROGRAM_RAM, m_program_memory_map);
|
||||
// discoverMemory(DISCOVER_DATA_RAM, m_data_memory_map);
|
||||
|
||||
// discoverMemory(DISCOVER_PROGRAM_RAM, m_program_memory_map);
|
||||
// discoverMemory(DISCOVER_DATA_RAM, m_data_memory_map);
|
||||
if(m_data_memory_map.size() > 0) {
|
||||
showDataRegions();
|
||||
}
|
||||
|
||||
if(m_program_memory_map.size() > 0) {
|
||||
showProgramRegions();
|
||||
}
|
||||
|
||||
m_connection_established = true;
|
||||
// TODO send init script.
|
||||
@ -44,7 +51,9 @@ bool T32Connector::startup(){
|
||||
void T32Connector::discoverMemory(int access, memory_map_t& map) {
|
||||
dword pstart = 0, pend;
|
||||
word paccess;
|
||||
int c = 1;
|
||||
do {
|
||||
std::cout << "Discovering Memory Regions: " << c++ << std::endl;
|
||||
paccess = access;
|
||||
err(T32_GetRam(&pstart, &pend, &paccess));
|
||||
if(paccess != DISCOVER_END){
|
||||
@ -66,6 +75,14 @@ int T32Connector::getState() const {
|
||||
}
|
||||
|
||||
|
||||
void T32Connector::showMemoryRegions(const memory_map_t& map) const {
|
||||
|
||||
for(int i = 0; i < map.size(); i++){
|
||||
std::cout << "[" << i << "] 0x" << std::hex << map[i].first << " - 0x" << std::hex << map[i].second << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Default T32 error handler */
|
||||
bool T32Connector::err(int errornum) const {
|
||||
if(errornum != 0){
|
||||
|
||||
@ -78,7 +78,10 @@ int main(int argc, char** argv){
|
||||
}
|
||||
|
||||
// Initialize T32
|
||||
t32.startup();
|
||||
if(t32.startup() == false){
|
||||
cout << "Could not connect to Lauterbach :(" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Let the SimulatorController do the dirty work.
|
||||
|
||||
Reference in New Issue
Block a user