Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Modify target_write_u32() to make 32-bit data output easier #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kaeteyaruyo
Copy link

  • Modify target_write_u32() function to make 32-bit data output easier
    • User can now output integer or any data type in 32-bit by assigning to (volatile <type> *)0x40000008

* Modify `target_write_u32()` function to make integer output easier
@jserv
Copy link
Contributor

jserv commented Oct 21, 2020

Please read this carefully: https://chris.beams.io/posts/git-commit/
The subject of git commit message and pull request should summarize the motivation why you would like to make the modification.

@kaeteyaruyo kaeteyaruyo changed the title Modify target_write_u32() function Modify target_write_u32() to make 32-bit data output easier Oct 21, 2020
@kaeteyaruyo
Copy link
Author

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?

@jserv
Copy link
Contributor

jserv commented Oct 21, 2020

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
Then, you can do force-push.

@@ -878,6 +878,7 @@ int target_write_u32(uint32_t addr, uint32_t val)
return 1;
}
if (addr == MTIMECMP_ADDR) {
printf("%d", val);
Copy link
Contributor

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.

Copy link
Author

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?

Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants