Massive refactor to accommodate RISC-V targets
- Refactored entire codebase (excluding the Insight component) to accommodate multiple target architectures (no longer specific to AVR) - Deleted 'generate SVD' GDB monitor command - I will eventually move this functionality to the Bloom website - Added unit size property to address spaces - Many other changes which I couldn't be bothered to describe here
This commit is contained in:
@@ -2,21 +2,21 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
|
||||
#include "src/Targets/Microchip/AVR/AVR8/Avr8TargetConfig.hpp"
|
||||
|
||||
#include "src/Targets/Microchip/AVR/TargetSignature.hpp"
|
||||
#include "src/Targets/Microchip/AVR/AVR8/Family.hpp"
|
||||
#include "src/Targets/Microchip/AVR/AVR8/ProgramMemorySection.hpp"
|
||||
#include "src/Targets/Microchip/AVR/AVR8/TargetParameters.hpp"
|
||||
#include "src/Targets/Microchip/AVR8/TargetSignature.hpp"
|
||||
#include "src/Targets/Microchip/AVR8/Family.hpp"
|
||||
#include "src/Targets/Microchip/AVR8/ProgramMemorySection.hpp"
|
||||
|
||||
#include "src/Targets/TargetDescriptor.hpp"
|
||||
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
|
||||
#include "src/Targets/TargetMemorySegmentDescriptor.hpp"
|
||||
#include "src/Targets/TargetState.hpp"
|
||||
#include "src/Targets/TargetRegisterDescriptor.hpp"
|
||||
#include "src/Targets/TargetRegister.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
|
||||
namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr8
|
||||
{
|
||||
/**
|
||||
* Interfacing with an AVR8 target for debugging operations can vary significantly, depending on the debug tool
|
||||
@@ -41,40 +41,17 @@ namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
|
||||
Avr8DebugInterface& operator = (const Avr8DebugInterface& other) = default;
|
||||
Avr8DebugInterface& operator = (Avr8DebugInterface&& other) = default;
|
||||
|
||||
/**
|
||||
* Should initialise the interface between the debug tool and the AVR8 target.
|
||||
*/
|
||||
virtual void init() = 0;
|
||||
|
||||
/**
|
||||
* Should stop execution on that target.
|
||||
*/
|
||||
virtual void stop() = 0;
|
||||
|
||||
/**
|
||||
* Should resume execution on the AVR8 target.
|
||||
*/
|
||||
virtual void run() = 0;
|
||||
|
||||
/**
|
||||
* Continue execution up to a specific byte address.
|
||||
*/
|
||||
virtual void runTo(Targets::TargetMemoryAddress address) = 0;
|
||||
|
||||
/**
|
||||
* Step execution on teh AVR8 target.
|
||||
*/
|
||||
virtual void step() = 0;
|
||||
|
||||
/**
|
||||
* Should reset the AVR8 target.
|
||||
*/
|
||||
virtual void reset() = 0;
|
||||
|
||||
/**
|
||||
* Should activate the physical interface between the debug tool and the AVR8 target.
|
||||
*
|
||||
* If the debugWire interface has been selected - this function should throw a DebugWirePhysicalInterfaceError
|
||||
* If the debugWIRE interface has been selected - this function should throw a DebugWirePhysicalInterfaceError
|
||||
* exception, in the event of a failure when activating the interface. The reason for this is to allow us the
|
||||
* chance to check the DWEN fuse bit, via an ISP interface. See Avr8::activate() for more.
|
||||
*/
|
||||
@@ -85,6 +62,30 @@ namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
|
||||
*/
|
||||
virtual void deactivate() = 0;
|
||||
|
||||
/**
|
||||
* We can specify access restrictions for individual registers in our TDFs, but this is only at a target
|
||||
* level - it does not account for any restrictions that the debug interface may be subject to.
|
||||
*
|
||||
* For example, EDBG debug tools cannot access fuse registers on JTAG targets, during a debug session. Those
|
||||
* registers can only be accessed during a programming session. This restriction is specific to the EDBG debug
|
||||
* interface.
|
||||
*
|
||||
* This function should communicate any access restrictions for the given register, which apply during a debug
|
||||
* session. It does not need to account for any access restrictions that only apply outside of a debug session.
|
||||
*
|
||||
* @param registerDescriptor
|
||||
* The descriptor of the register.
|
||||
*
|
||||
* @param addressSpaceDescriptor
|
||||
* The descriptor of the address space in which the register resides.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual Targets::TargetRegisterAccess getRegisterAccess(
|
||||
const Targets::TargetRegisterDescriptor& registerDescriptor,
|
||||
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* Should retrieve the AVR8 target signature of the AVR8 target.
|
||||
*
|
||||
@@ -93,97 +94,29 @@ namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual Targets::Microchip::Avr::TargetSignature getDeviceId() = 0;
|
||||
virtual Targets::Microchip::Avr8::TargetSignature getDeviceId() = 0;
|
||||
|
||||
/**
|
||||
* Should set a software breakpoint at a given address.
|
||||
*
|
||||
* @param address
|
||||
*/
|
||||
virtual void setSoftwareBreakpoint(Targets::TargetMemoryAddress address) = 0;
|
||||
|
||||
/**
|
||||
* Should remove a software breakpoint at a given address.
|
||||
*
|
||||
* @param address
|
||||
*/
|
||||
virtual void clearSoftwareBreakpoint(Targets::TargetMemoryAddress address) = 0;
|
||||
|
||||
/**
|
||||
* Should set a hardware breakpoint at a given address.
|
||||
*
|
||||
* @param address
|
||||
*/
|
||||
virtual void setHardwareBreakpoint(Targets::TargetMemoryAddress address) = 0;
|
||||
|
||||
/**
|
||||
* Should remove a hardware breakpoint at a given address.
|
||||
*
|
||||
* @param address
|
||||
*/
|
||||
virtual void clearHardwareBreakpoint(Targets::TargetMemoryAddress address) = 0;
|
||||
|
||||
/**
|
||||
* Should remove all software and hardware breakpoints on the target.
|
||||
*/
|
||||
virtual void clearAllBreakpoints() = 0;
|
||||
|
||||
/**
|
||||
* Should retrieve the current program counter value from the target.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual Targets::TargetMemoryAddress getProgramCounter() = 0;
|
||||
|
||||
/**
|
||||
* Should update the program counter value on the target.
|
||||
*
|
||||
* @param programCounter
|
||||
*/
|
||||
virtual void setProgramCounter(Targets::TargetMemoryAddress programCounter) = 0;
|
||||
|
||||
/**
|
||||
* Should read the requested registers from the target.
|
||||
*
|
||||
* @param descriptorIds
|
||||
* A collection of register descriptor IDs, for the registers to be read.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual Targets::TargetRegisters readRegisters(const Targets::TargetRegisterDescriptorIds& descriptorIds) = 0;
|
||||
|
||||
/**
|
||||
* Should update the value of the given registers.
|
||||
*
|
||||
* @param registers
|
||||
*/
|
||||
virtual void writeRegisters(const Targets::TargetRegisters& registers) = 0;
|
||||
|
||||
/**
|
||||
* Should read memory from the target, for the given memory type.
|
||||
*
|
||||
* @param memoryType
|
||||
* @param startAddress
|
||||
* @param bytes
|
||||
* @param excludedAddressRanges
|
||||
* @return
|
||||
*/
|
||||
virtual Targets::TargetRegisterDescriptorAndValuePairs readRegisters(
|
||||
const Targets::TargetRegisterDescriptors& descriptors
|
||||
) = 0;
|
||||
virtual void writeRegisters(const Targets::TargetRegisterDescriptorAndValuePairs& registers) = 0;
|
||||
virtual Targets::TargetMemoryBuffer readMemory(
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
||||
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
|
||||
Targets::TargetMemoryAddress startAddress,
|
||||
Targets::TargetMemorySize bytes,
|
||||
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* Should write memory to the target, for a given memory type.
|
||||
*
|
||||
* @param memoryType
|
||||
* @param startAddress
|
||||
* @param buffer
|
||||
*/
|
||||
virtual void writeMemory(
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
||||
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
|
||||
Targets::TargetMemoryAddress startAddress,
|
||||
const Targets::TargetMemoryBuffer& buffer
|
||||
) = 0;
|
||||
@@ -195,29 +128,12 @@ namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
|
||||
* The section to erase, or std::nullopt to erase the entire program memory.
|
||||
*/
|
||||
virtual void eraseProgramMemory(
|
||||
std::optional<Targets::Microchip::Avr::Avr8Bit::ProgramMemorySection> section = std::nullopt
|
||||
std::optional<Targets::Microchip::Avr8::ProgramMemorySection> section = std::nullopt
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* Should erase the chip.
|
||||
*/
|
||||
virtual void eraseChip() = 0;
|
||||
|
||||
/**
|
||||
* Should obtain the current target state.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual Targets::TargetState getTargetState() = 0;
|
||||
|
||||
/**
|
||||
* Should prepare the debug interface for programming the target.
|
||||
*/
|
||||
virtual Targets::TargetExecutionState getExecutionState() = 0;
|
||||
virtual void enableProgrammingMode() = 0;
|
||||
|
||||
/**
|
||||
* Should prepare the debug interface for resuming debugging operations after a programming session.
|
||||
*/
|
||||
virtual void disableProgrammingMode() = 0;
|
||||
};
|
||||
}
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "src/Targets/Microchip/AVR/TargetSignature.hpp"
|
||||
#include "src/Targets/Microchip/AVR/IspParameters.hpp"
|
||||
#include "src/Targets/Microchip/AVR/Fuse.hpp"
|
||||
#include "src/Targets/Microchip/AVR8/TargetSignature.hpp"
|
||||
#include "src/Targets/Microchip/AVR8/IspParameters.hpp"
|
||||
#include "src/Targets/Microchip/AVR8/Fuse.hpp"
|
||||
|
||||
#include "src/ProjectConfig.hpp"
|
||||
|
||||
namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr
|
||||
namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr8
|
||||
{
|
||||
/**
|
||||
* Many AVRs can be programmed via an SPI interface. Some debug tools provide access to this interface via the AVR
|
||||
@@ -17,8 +17,8 @@ namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr
|
||||
* This interface class is incomplete - it only provides the ability to read the device ID and access AVR fuses and
|
||||
* lockbit bytes (as that's all we need, for now).
|
||||
*
|
||||
* Currently, Bloom only uses the ISP interface for accessing fuses and lockbits on debugWire targets. We can't
|
||||
* access fuses via the debugWire interface, so we have to use the ISP interface.
|
||||
* Currently, Bloom only uses the ISP interface for accessing fuses and lockbits on debugWIRE targets. We can't
|
||||
* access fuses via the debugWIRE interface, so we have to use the ISP interface.
|
||||
*
|
||||
* @see Avr8::updateDwenFuseBit() for more.
|
||||
*/
|
||||
@@ -34,20 +34,6 @@ namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr
|
||||
AvrIspInterface& operator = (const AvrIspInterface& other) = default;
|
||||
AvrIspInterface& operator = (AvrIspInterface&& other) = default;
|
||||
|
||||
/**
|
||||
* Configures the ISP interface with user-provided config parameters.
|
||||
*
|
||||
* @param targetConfig
|
||||
*/
|
||||
virtual void configure(const TargetConfig& targetConfig) = 0;
|
||||
|
||||
/**
|
||||
* Configures the ISP interface with the target's ISP parameters.
|
||||
*
|
||||
* @param ispParameters
|
||||
*/
|
||||
virtual void setIspParameters(const Targets::Microchip::Avr::IspParameters& ispParameters) = 0;
|
||||
|
||||
/**
|
||||
* Should initialise and activate the ISP interface between the debug tool and the AVR target.
|
||||
*/
|
||||
@@ -63,15 +49,17 @@ namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual Targets::Microchip::Avr::TargetSignature getDeviceId() = 0;
|
||||
virtual Targets::Microchip::Avr8::TargetSignature getDeviceId() = 0;
|
||||
|
||||
/**
|
||||
* Should read a fuse from the AVR target.
|
||||
*
|
||||
* @param fuseType
|
||||
* @param fuseRegisterDescriptor
|
||||
* @return
|
||||
*/
|
||||
virtual Targets::Microchip::Avr::Fuse readFuse(Targets::Microchip::Avr::FuseType fuseType) = 0;
|
||||
virtual Targets::Microchip::Avr8::FuseValue readFuse(
|
||||
const Targets::TargetRegisterDescriptor& fuseRegisterDescriptor
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* Should read the lock bit byte from the AVR target.
|
||||
@@ -83,8 +71,12 @@ namespace DebugToolDrivers::TargetInterfaces::Microchip::Avr
|
||||
/**
|
||||
* Should program a particular fuse byte.
|
||||
*
|
||||
* @param fuse
|
||||
* @param fuseRegisterDescriptor
|
||||
* @param value
|
||||
*/
|
||||
virtual void programFuse(Targets::Microchip::Avr::Fuse fuse) = 0;
|
||||
virtual void programFuse(
|
||||
const Targets::TargetRegisterDescriptor& fuseRegisterDescriptor,
|
||||
Targets::Microchip::Avr8::FuseValue value
|
||||
) = 0;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user