Skip to content

Attempt to make Serial_HelloWorld compatible with SDCC 4.4.0#15

Open
jz13138 wants to merge 1 commit into
free-pdk:masterfrom
jz13138:new_branch
Open

Attempt to make Serial_HelloWorld compatible with SDCC 4.4.0#15
jz13138 wants to merge 1 commit into
free-pdk:masterfrom
jz13138:new_branch

Conversation

@jz13138

@jz13138 jz13138 commented May 12, 2024

Copy link
Copy Markdown

@spth

spth commented May 12, 2024

Copy link
Copy Markdown
Contributor

I didn't try it, but from a quick look at the diff it looks ok to me, and should do what the title claims.

Two questions:

  • What is the motivation for the PFS154->PFS173 change?
  • Do we really need those asm __set1io and __set0io? Why not just use &= and |= with suitable masks?

@cpldcpu

cpldcpu commented May 12, 2024

Copy link
Copy Markdown
Member

Do we really need those asm __set1io and __set0io? Why not just use &= and |= with suitable masks?

I believe older versions of SDCC were not able to infer the set instruction for different memory types. Is that now all fixed?

@spth

spth commented May 12, 2024

Copy link
Copy Markdown
Contributor

Compiling that Serial_HelloWorld, which has both, it looks like there is no difference:

;	../include/serial.h: 28: __set0io(PA, SERIAL_TX_PIN);                // Send 0 on TX Pin
	set0.io	__pa, #7

vs.

;	../include/serial.h: 39: INTEN &= ~INTEN_TM2;                          // Disable TM2 (setup of 16 bit value txdata is non atomic)
	set0.io	__inten, #6

Philipp

P.S.: AFAIK, SDCC does use set0 and set1 for I/O. But it can't do so for general RAM: set0 and1 are only available for a part of the RAM, and which variable will be where in RAM is typically not known before link time.

@jz13138

jz13138 commented May 13, 2024

Copy link
Copy Markdown
Author

Thanks for your feedback.

* What is the motivation for the PFS154->PFS173 change?

I am just evaluating PFS173 at the moment. No need to change that here. Sorry for that.

* Do we really need those asm `__set1io` and `__set0io`? Why not just use `&=` and `|=` with suitable masks?

I was hoping that it will run faster.

However, in a different test case I experienced that
__set1io(ADCC, ADCC_PROCESS_CONTROL_BIT);
could start the ADC conversion whereas |= didn't.

@cpldcpu

cpldcpu commented May 24, 2024

Copy link
Copy Markdown
Member

Shall we merge this? Or what are the proposed changes? Changing to PFS154 as default?

@spth

spth commented May 24, 2024

Copy link
Copy Markdown
Contributor

I'd rather just make the minimal changes necessary as a first step: Replace the mov by mov.io, etc in the inline asm.
Second step: Eliminate inline asm where it doesn't really provide an advantage. For now, I don't see much point in the rest of changes in the pull request (PFS154 default, etc).

P.S.: I've now implemented what I proposed above.

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.

3 participants