View previous topic :: View next topic |
Author |
Message |
Alexander-Dan
Joined: 13 Mar 2014 Posts: 111 Location: S.Posad
|
Posted: Thu Feb 22, 2024 2:14 pm Post subject: |
|
|
Yes, I read about all the changes...
But since 2009 I have had a rule: no “magic” -- no assembler commands in programs!
Sometimes you need to transfer code to different chips, so assembler is very undesirable and is fraught with many problems |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
|
Back to top |
|
|
Alexander-Dan
Joined: 13 Mar 2014 Posts: 111 Location: S.Posad
|
Posted: Thu Feb 22, 2024 3:50 pm Post subject: |
|
|
"magic" is what is not visible in the code
If I read a chip register MCUCSR, then I can find a description of that register in the chip's datasheets.
If I write "R0", then I don’t know what the compiler does inside and I have to look in third-party sources for the compiler itself and all its versions!
At the same time, I cannot be sure that tomorrow, in the new version of the compiler, these “old tricks” will not be replaced by new “progressive things”. ha-ha
I don't argue and I don't encourage you to do the same. Each of us has our own personal experience and coding style... |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Thu Feb 22, 2024 6:26 pm Post subject: |
|
|
Alexander-Dan wrote: | I cannot be sure that tomorrow, in the new version of the compiler, these “old tricks” will not be replaced by new “progressive things”. |
No, you can't be sure.
But as you use this compiler you seem to feel it is trustworthy.
Would you not believe it to be trustworthy, you need to go bare-metal and use assembler code. But still then, a new assembler may do things different.
Any type of compiler may change it's behavior over time, and any maker of any compiler will try not to alienate its users by doing things completely different.
But, this is not the case here.
Backing up MCUCSR into R0 is likely older than the time you use this compiler.
You simply ignored it, because you thought there's no need to care.
What can you do now, as it has changed and you still don't like to read R0?
You can use older versions, for example 2.0.8.5
You can try to patch the *.dat file accordingly, look for WD=MCUCSR.WDRF,$E0 as described in history.txt
You can patch the created *.hex
You can NOT misuse $INITMICRO, as access of MCUCSR happens earlier.
You can throw yourself on the floor and start crying.
Will it help?
PS:
Alexander-Dan wrote: | If I write "R0", then I don’t know what the compiler does inside |
I can tell you: Nothing will happen, as R0 is only a copy of MCUCSR.
After the copy was done, all flags in MCUCSR are cleared, but you'll find them as copy in R0.
With a MCUSR (..status register only) read access is sufficient, in contrary with MCUCSR (..control and status register), as there may be bits you want to write.
Of course you write them into MCUCSR then and not its copy R0. |
|
Back to top |
|
|
Alexander-Dan
Joined: 13 Mar 2014 Posts: 111 Location: S.Posad
|
Posted: Thu Feb 22, 2024 7:21 pm Post subject: |
|
|
oh so many words.
I looked at the calendar: no, today is not Friday and tomorrow is not Saturday. Too many emotions in a working day
I can indulge myself: I’m on vacation.
But I will answer briefly: thank you |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Thu Feb 22, 2024 8:40 pm Post subject: |
|
|
Alexander-Dan wrote: | But I will answer briefly: thank you |
Relax No emotions were involved, neither hurt.
Words come out of my keyboard easily, I have even to delete some.
You're welcome of course. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|