T32: Integrated Register read/write calls
* Tested without connected Lauterbach. T32_* functions are mocked via aspect. * New target t32cli, for sending T32 command cia cli. (for testing) git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@2103 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
11
debuggers/t32/src/CMakeLists.txt
Normal file
11
debuggers/t32/src/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
set(SRCS
|
||||
T32Connector.cc
|
||||
)
|
||||
|
||||
add_executable(fail-client ${SRCS})
|
||||
target_link_libraries(fail-client -Wl,-whole-archive t32api -Wl,-no-whole-archive fail )
|
||||
|
||||
install(TARGETS fail-client RUNTIME DESTINATION bin)
|
||||
|
||||
add_executable(t32cli t32cli.cc)
|
||||
target_link_libraries(t32cli -Wl,-whole-archive t32api -Wl,-no-whole-archive)
|
||||
61
debuggers/t32/src/T32Connector.cc
Normal file
61
debuggers/t32/src/T32Connector.cc
Normal file
@ -0,0 +1,61 @@
|
||||
/**
|
||||
* FailT32 -- Fault Injection on the Lauterbach Trace32 System
|
||||
*
|
||||
* 1. Invoke t32 executable with appropriate Lauterbach Skript
|
||||
* - Script has to load binary
|
||||
* - and let system run until entry point
|
||||
* -> Then we have a readily configured system
|
||||
*
|
||||
* @author Martin Hoffmann <hoffmann@cs.fau.de>
|
||||
* @date 15.02.2013
|
||||
*/
|
||||
|
||||
#include <t32.h>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "config/VariantConfig.hpp"
|
||||
#include "sal/SALInst.hpp"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
/* Default T32 error handler */
|
||||
void err(int ernum){
|
||||
if(err != 0){
|
||||
cerr << "Error: " << err << endl;
|
||||
//exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Here we go... */
|
||||
int main(int argc, char** argv){
|
||||
|
||||
// Evaluate arguments
|
||||
|
||||
// Setup connection to Lauterbach
|
||||
cout << "Lauterbach remote connection" << endl;
|
||||
int error;
|
||||
char hostname[] = "localhost";
|
||||
char packlen[] = "1024";
|
||||
char port[] = "20010";
|
||||
|
||||
cout << "[T32] Connecting to " << hostname << ":" << port << " Packlen: " << packlen << endl;
|
||||
T32_Config("NODE=", hostname);
|
||||
T32_Config("PACKLEN=", packlen);
|
||||
T32_Config("PORT=", port);
|
||||
|
||||
cout << "[T32] Init." << endl;
|
||||
err(T32_Init());
|
||||
|
||||
cout << "[T32] Attach." << endl;
|
||||
err(T32_Attach(T32_DEV_ICD));
|
||||
|
||||
|
||||
// Let the SimulatorController do the dirty work.
|
||||
fail::simulator.startup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
24
debuggers/t32/src/T32Connector.hpp
Normal file
24
debuggers/t32/src/T32Connector.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef __T32_CONNECTOR_HPP__
|
||||
#define __T32_CONNECTOR_HPP__
|
||||
|
||||
#include <t32.h>
|
||||
|
||||
namespace fail {
|
||||
|
||||
/**
|
||||
* \class T32Connector
|
||||
*/
|
||||
class T32Connector {
|
||||
public:
|
||||
|
||||
|
||||
/**
|
||||
* Save simulator state. Quite hard on real hardware! Also safe all HW registers!
|
||||
* @param path Location to store state information
|
||||
* @return \c true if the state has been successfully saved, \c false otherwise
|
||||
*/
|
||||
};
|
||||
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif // __T32_CONNECTOR_HPP__
|
||||
63
debuggers/t32/src/t32cli.cc
Normal file
63
debuggers/t32/src/t32cli.cc
Normal file
@ -0,0 +1,63 @@
|
||||
#include <t32.h>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void err(int ernum){
|
||||
if(err != 0){
|
||||
cerr << "Error: " << err << endl;
|
||||
//exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int eval_command(){
|
||||
string cmd;
|
||||
char errmsg[128];
|
||||
cout << "%> ";
|
||||
getline(cin, cmd);
|
||||
if(cmd.compare("bye") == 0) return -1;
|
||||
|
||||
int err = T32_Cmd((char*)cmd.c_str());
|
||||
if(err != 0){
|
||||
cerr << "Could not execute command: " << err << endl;
|
||||
word errnum;
|
||||
T32_GetMessage(errmsg, &errnum);
|
||||
cerr << errmsg << "Type: " << errnum << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(void){
|
||||
cout << "Lauterbach remote connection" << endl;
|
||||
cout << "Enter bye to exit." << endl;
|
||||
int error;
|
||||
char hostname[] = "localhost";
|
||||
char packlen[] = "1024";
|
||||
char port[] = "20010";
|
||||
|
||||
cout << "[T32] Connecting to " << hostname << ":" << port << " Packlen: " << packlen << endl;
|
||||
T32_Config("NODE=", hostname);
|
||||
T32_Config("PACKLEN=", packlen);
|
||||
T32_Config("PORT=", port);
|
||||
|
||||
cout << "[T32] Init." << endl;
|
||||
err(T32_Init());
|
||||
|
||||
cout << "[T32] Attach." << endl;
|
||||
err(T32_Attach(T32_DEV_ICD));
|
||||
|
||||
while(eval_command() != -1);
|
||||
|
||||
cout << "[T32] Exit." << endl;
|
||||
err(T32_Exit());
|
||||
cout << "Bye." << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user