Skip to content

Commit

Permalink
Added write-memory function to DebuggableDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
azonenberg committed Jul 27, 2018
1 parent 7669f26 commit 4b27604
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
9 changes: 8 additions & 1 deletion ARM7TDMISProcessor.cpp
Expand Up @@ -351,7 +351,7 @@ void ARM7TDMISProcessor::DumpRegisters()
LogNotice("%10s: %08x\n", GetRegisterName(reg), ReadCPURegister(reg));
}*/

uint32_t ARM7TDMISProcessor::ReadMemory(uint32_t addr)
uint32_t ARM7TDMISProcessor::ReadMemory(uint32_t /*addr*/)
{
throw JtagExceptionWrapper(
"Memory access not implemented for this CPU yet",
Expand All @@ -360,6 +360,13 @@ uint32_t ARM7TDMISProcessor::ReadMemory(uint32_t addr)
return 0;
}

void ARM7TDMISProcessor::WriteMemory(uint32_t /*addr*/, uint32_t /*value*/)
{
throw JtagExceptionWrapper(
"Memory access not implemented for this CPU yet",
"");
}

/**
@brief Halts the CPU and enters debug state
*/
Expand Down
1 change: 1 addition & 0 deletions ARM7TDMISProcessor.h
Expand Up @@ -146,6 +146,7 @@ class ARM7TDMISProcessor : public DebuggableDevice
virtual void PrintRegisters();

virtual uint32_t ReadMemory(uint32_t addr);
virtual void WriteMemory(uint32_t addr, uint32_t value);

/*
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
7 changes: 6 additions & 1 deletion DebuggableDevice.cpp
Expand Up @@ -2,7 +2,7 @@
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2016 Andrew D. Zonenberg *
* Copyright (c) 2012-2018 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
Expand Down Expand Up @@ -59,3 +59,8 @@ uint32_t DebuggableDevice::ReadMemory(uint32_t addr)
{
return m_iface->ReadMemory(addr);
}

void DebuggableDevice::WriteMemory(uint32_t addr, uint32_t value)
{
m_iface->WriteMemory(addr, value);
}
3 changes: 2 additions & 1 deletion DebuggableDevice.h
Expand Up @@ -2,7 +2,7 @@
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2016 Andrew D. Zonenberg *
* Copyright (c) 2012-2018 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
Expand Down Expand Up @@ -55,6 +55,7 @@ class DebuggableDevice
virtual std::string GetDescription() =0;

virtual uint32_t ReadMemory(uint32_t addr);
virtual void WriteMemory(uint32_t addr, uint32_t value);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Debug commands
Expand Down
14 changes: 12 additions & 2 deletions FTDIJtagInterface.cpp
Expand Up @@ -432,18 +432,28 @@ void FTDIJtagInterface::SharedCtorInit(uint32_t type, const std::string& layout)
m_gpioDirection.push_back(false);
}

//Digilent HS1 and azonenberg's usb-jtag-mini (0403:8028): GPIOL3 is active HIGH output enable
//Digilent HS1 and azonenberg's usb-jtag-mini (0403:8028)
if(layout == "hs1")
{
//GPIOL3 is active HIGH output enable
SetGpioDirectionDeferred(3, true);
SetGpioValueDeferred(3, true);
}

//JTAGKey (or compatible bus blaster etc): GPIOL0 is active LOW output enable
//JTAGKey (or compatible bus blaster etc)
else if(layout == "jtagkey")
{
//GPIOL0 is active LOW output enable
SetGpioDirectionDeferred(0, true);
SetGpioValueDeferred(0, false);

//GPIOH0 is TRST_N, hold this high for now since we don't support TRST in the API yet
SetGpioDirectionDeferred(4, true);
SetGpioValueDeferred(4, true);

//GPIOH2 is TRST_N_OE_N, hold this high so TRST is driven
SetGpioDirectionDeferred(6, true);
SetGpioValueDeferred(6, true);
}

else
Expand Down

0 comments on commit 4b27604

Please sign in to comment.