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

x and x2 should not be volatile #19

Closed
nerdralph opened this issue Jul 4, 2020 · 3 comments
Closed

x and x2 should not be volatile #19

nerdralph opened this issue Jul 4, 2020 · 3 comments

Comments

@nerdralph
Copy link
Contributor

https://github.com/Blinkinlabs/ch554_sdcc/blob/master/include/debug.c#L164
Making them volatile stops SDCC from doing constant folding and propagation, which bloats the code size. By making them non-volatile, the blink example compiles to 364 bytes instead of 700.

@cibomahto
Copy link
Member

Good find! And you've verified that the code still writes the intended value to TH1? Happy to accept a pull request or make the change, whichever you'd prefer.

@nerdralph
Copy link
Contributor Author

I haven't tested the UARTs on my modules, but the asm code looks good with 16M FREQ_SYS:
mov _TH1,#0x98
0-0x98 = 104, 16M/16/104 = 9,615bps
With 12M for FREQ_SYS it 0xB2 instead of 0x98.

@cibomahto
Copy link
Member

Excellent!

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

No branches or pull requests

2 participants