[lldb-dev] Loading object file to target flash memory using vFlashWrite
Owen Shaw via lldb-dev
lldb-dev at lists.llvm.org
Tue Jan 9 15:53:21 PST 2018
Looks like there was an addition about a year ago to load an object
file to bare metal target memory via "target modules load --load".
https://reviews.llvm.org/D28804
However, this isn't working in my case with openocd and a target that
uses flash memory. By comparison, gdb loads the object just fine, but
instead of using the M memory write command, it uses vFlashErase,
vFlashWrite, and vFlashDone.
These flash commands don't seem to be supported in lldb. Any reason
not to add them?
I've got a basic working implementation, which is probably easier to
break into two reviews:
1. Add support for qXfer:memory-map and parse the resulting xml to
determine which memory regions are flash and what their blocksizes are
(required for vFlashErase)
2. Update ProcessGDBRemote::DoWriteMemory to use the flash commands
when writing to a flash region, while continuing to use M when writing
to non-flash regions.
If this sounds like the right track, I'll open a Phabricator review
for #1 to start.
One question I have relates to the load address for object sections.
The current ObjectFile::LoadInMemory implementation will incorrectly
place my .data section at its virtual address in RAM when it really
should be placed at its physical address in flash memory. I have code
that can place it at the physical address, but it's unclear if that
change is correct for every case. Does anyone have insight/opinions?
Thanks,
Owen
More information about the lldb-dev
mailing list