Skip to content

Commit 4de10bf

Browse files
committed
Implemented debug-writemem command
1 parent 48040a4 commit 4de10bf

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

jtagsh/commands.cpp

+20-2
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ void OnDebugCommand(DebuggableDevice* pdev, const string& cmd, const vector<stri
370370
else if(cmd == "regs")
371371
pdev->PrintRegisters();
372372

373-
//Read memory from the default RAM Mem-AP (generally AHB bus but might be AXI)
373+
//Read memory from the default RAM source (generally AHB or AXI bus on ARM targets)
374374
else if(cmd == "readmem")
375375
{
376376
if(args.size() != 2)
@@ -383,7 +383,25 @@ void OnDebugCommand(DebuggableDevice* pdev, const string& cmd, const vector<stri
383383
sscanf(args[1].c_str(), "%x", &addr);
384384

385385
uint32_t value = pdev->ReadMemory(addr);
386-
LogNotice("*0x%08x = %08x\n", addr, value);
386+
LogNotice("*0x%08x = 0x%08x\n", addr, value);
387+
}
388+
389+
//Write memory to the default destination
390+
else if(cmd == "writemem")
391+
{
392+
if(args.size() != 3)
393+
{
394+
LogError("Usage: writemem [hex address] [hex data]\n");
395+
return;
396+
}
397+
398+
uint32_t addr;
399+
sscanf(args[1].c_str(), "%x", &addr);
400+
401+
uint32_t value;
402+
sscanf(args[2].c_str(), "%x", &value);
403+
404+
pdev->WriteMemory(addr, value);
387405
}
388406

389407
else

0 commit comments

Comments
 (0)