-
Notifications
You must be signed in to change notification settings - Fork 18
Modify target_write_u32()
to make 32-bit data output easier
#10
base: master
Are you sure you want to change the base?
Conversation
* Modify `target_write_u32()` function to make integer output easier
Please read this carefully: https://chris.beams.io/posts/git-commit/ |
target_write_u32()
functiontarget_write_u32()
to make 32-bit data output easier
Sorry I put my purpose in the body but not title... It seems that I cannot modify a commit after I created it. Should I close this PR and create another one with an appropriate commit message? |
Check this: https://docs.github.com/en/free-pro-team@latest/github/committing-changes-to-your-project/changing-a-commit-message |
@@ -878,6 +878,7 @@ int target_write_u32(uint32_t addr, uint32_t val) | |||
return 1; | |||
} | |||
if (addr == MTIMECMP_ADDR) { | |||
printf("%d", val); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the change is improving the verbosity of data read operations, right? If so, please consider to wrap it with DEBUG_EXTRA
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was intended to mimic line 822, which output a character when UART receives data.
Because UART outputs every byte received as character, even if I divide an integer by 4 and send them respectively, the processor still cannot display it correctly. I think we need a way to display data in any data type, and 4-byte integer is a very commonly used one. So at least I want the processor to display integer when it detects integer write. So I put a printf()
in target_write_u32()
, and it works.
But maybe this is not an appropriate way to deal with data output... (indeed this output is more like debug message rather than standard output) Should I use try other ways to output data > 8 bits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can manipulate the serialized data with a buffer and then flush later.
target_write_u32()
function to make 32-bit data output easier(volatile <type> *)0x40000008