Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wchfixes #3

Open
wants to merge 6 commits into
base: mrs-wch-riscv-220623
Choose a base branch
from
Open

Conversation

robertlipe
Copy link

  • Specify full paramater definition in decl. C89's 'implicit int' is an error here.
  • Allow a clean build on systems with warnings.

… error here.

With -Werror removed, this is the only fatal error when building on MacOS.

Change-Id: If5590a17097d63d6c2155c626b5c58673953c477
Signed-off-by: Robert Lipe <[email protected]>
Remove unused locals.
Keep, but comment out, locals whose users were there but commented out.
Change data types to used types when easy.
Add casts when not.

Change-Id: I5b6077f1de44c6cfb39218b55744e4c891547bfc
Signed-off-by: Robert Lipe [email protected]
Change-Id: Idf621decb89e3c6b9473427fcefc4f2ec086a45d
Change-Id: Ibf2ffc6866989c94cc4f021cbfdcf25f04ee0529
Signed-off-by: Robert Lipe [email protected]
Change-Id: If3774cb11e56da396eae177d60cf785ffb246bf6
Change-Id: I39b400f55af0f48da83af0ca3e0e6d7d5c3539a1
Signed-off-by: Robert Lipe <[email protected]>
@karlp
Copy link
Owner

karlp commented Aug 6, 2022

Given that the entire structure of the WCH support is not upstreamable, I'm not really interested in taking a bunch of whitespace cleanups, when it will make it harder to track merges from newer MRS releases.

@robertlipe
Copy link
Author

robertlipe commented Aug 6, 2022 via email

// The final argument here is a uint16_t as it is in the caller. I'm going to
// change this to read 16 bits, but this could cause synchronization issues.
// Orig: int retval = target_read_u32(target, 0x1ffff7e0, flash_size_in_kb);
int retval = target_read_u16(target, 0x1ffff7e0, flash_size_in_kb);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without debug docs from WCH, we don't know if this is wrong or right. It might only allow a 32bit read, even if they are only interested in the lower 16bits. Is the code gross? yes! is this code actually wrong? we have no idea!

@robertlipe
Copy link
Author

robertlipe commented Aug 6, 2022 via email

@karlp
Copy link
Owner

karlp commented Aug 17, 2022

right, yes, I missed that the u16 pointer got converted to a u32 pointer first. I thought it was just writing a 32bit value to a 16bit pointer, and it was just discarding the top16 bits, which is dumb, but fine, and would be valid if (for instance) their target_read_16 was busted.

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

Successfully merging this pull request may close these issues.

2 participants