Skip to content

Commit e04664f

Browse files
[#94558] CortexM: Allow setting CPUWAIT in constructor
This is useful for scenarios where you would like the CPU to start in a halted state, and stay halted even after being reset. Without this constructor parameter, you'd have to set both CpuWaitSignal and IsHalted in order to achieve this, which is inconsistent. The construction of a new CPU should behave like a reset, and if CPUWAIT is set before the reset (i.e. as a constructor argument) then the CPU should be halted from the very beginning.
1 parent dcf2120 commit e04664f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/Emulator/Cores/Arm-M/CortexM.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ namespace Antmicro.Renode.Peripherals.CPU
2525
public partial class CortexM : Arm, IPeripheralWithTransactionState
2626
{
2727
public CortexM(string cpuType, IMachine machine, NVIC nvic, [NameAlias("id")] uint cpuId = 0, Endianess endianness = Endianess.LittleEndian,
28-
uint? fpuInterruptNumber = null, uint? numberOfMPURegions = null, bool enableTrustZone = false, uint? numberOfSAURegions = null, uint? numberOfIDAURegions = null)
28+
uint? fpuInterruptNumber = null, uint? numberOfMPURegions = null, bool enableTrustZone = false, uint? numberOfSAURegions = null, uint? numberOfIDAURegions = null, bool isCpuWaitSignalSet = false)
2929
: base(cpuType, machine, cpuId, endianness, numberOfMPURegions)
3030
{
3131
CpuWaitSignal = new GPIO();
32+
CpuWaitSignal.Set(isCpuWaitSignalSet);
3233
CpuWaitSignal.AddStateChangedHook((state) => UpdateCPUWait(state));
34+
IsHalted = CpuWaitSignal.IsSet;
3335

3436
if(nvic == null)
3537
{

0 commit comments

Comments
 (0)