Usual instructions in SPECIAL Register section

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HI,

 

I downloaded a RADAR program (Radarcode.Ino). 

 

Loaded it into the ARDUINO IDE and compiled it using a AVRMEGA 2560 as source processor.  NO errors.   

 

Disassembled the HEX-code and recompiled the Disassembled  code in AVR STUDIO 6.   (Just to make sure the disassembly was done correct  It was. )

 

Afterwards I examined the disassembled listing.   I was really amazed when I discovered that several lines (all STS and LDS instructions)  had references

to adresses i the SPEC-REGISTER area (0x40 - 0x1FF) and these references/addresses wee NOT assigned to anything (maybe an ordinary RAM-cell ). 

 

(I guess it's because it was originally written for a AVR328(P) , but here I use an AVR-2560!    Should't the code be relocated ?? Considering the NO-error )

 

Have anyone in this group ever seen something like that, ever ??

 

Snestrup2012  AKA Kris

KSH

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

0x40 to 0x1FF are the Special Function Registers that control I/O ports, counters, ADC, and such. So, there is rarely any reason to write to them, and then fairly soon, read back. One exception might be interrupt status registers. So, what is the question? It ought to be quite normal to write to those addresses during initialization, then leave them unchanged. No big surprise.

 

And, yes, the corresponding registers in a Mega2560 are very likely at different addresses than the ones in a Mega328. Changing them is called "porting" but care is needed  because bits might not even have the same function. Its not like changing a Mega328 for a Mega168 or Mega88! Those writes should only be relocated if you used register names rather than addresses, but, as noted, that is often insufficient.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Tue. Sep 20, 2022 - 11:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


snestrup2012 wrote:
Loaded it into the ARDUINO IDE and compiled it using a AVRMEGA 2560 as source processor.  NO errors.   
That is kind of "auto porting". Arduino knows a number of CPUs and will get SFR references right as long as the build target is correctly selected.

snestrup2012 wrote:

Afterwards I examined the disassembled listing.   I was really amazed when I discovered that several lines (all STS and LDS instructions)  had references

to adresses i the SPEC-REGISTER area (0x40 - 0x1FF) and these references/addresses wee NOT assigned to anything (maybe an ordinary RAM-cell ). 

I'm no sure what point you are trying to make here? 2560 datasheet has:

 

 

....

 

 

There's a ton of SFRs in the range 0x40 .. 0x1FF so why are you surprised to see access to them in the code ??

 

snestrup2012 wrote:
ecompiled the Disassembled  code in AVR STUDIO 6.  
Why on earth are you using version 6? It was riddled with bugs and is now hugely out of date. If you had the latest Studio 7 it even has an Arduino INO importer that can turn an Arduino sketch into a C++ project so you wouldn't need to mess about with all this disassembly/re-assembly malarkey - you could work in high level source from start to finish.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HI,

 

Thanks for the answers.

 

First:

 

I did not know that during the initialization these SPEC-reg's (0x40-0x1FF) could be used . Thanks for the idea. 

 

Second:  

 

Using the AVR Studio 6 is (unfortunately) necessary.    As retired (72 years of age) I am "forced" to use older PC (read: WIN 10 / Win 11 will simply not not properly on these PC's).  I simply can't afford a new one. 

 

Win 10 software destroys my battery on this Dell Lattitude (E6410)  Believe me, I have tried to install a Win 10 .  So I am forced to use Win 8 (or 7)  on this Dell machine. It just too old.  And all the AVR STUDIO 7 versions  I have seen so  far is based on WIN 10 - so no AVR- Studio 7 here.  But maybe there is a AVR Studio 7 for WIN XP, (7 /  8)  ??   (I have not found it (yet ??)) ..    

 

Another aspect is, that I am developing a program in Delphi 7 Enterprise on a XP  (SP 4 / another machine).  It should be an ("extremely" smart)  Interface between  an AVR- 32pP / AVR-2560 and making the connected AVR-unit (328P/2560) an "intelligent" (controlled by the Delphi program) multipurpose connectable  hardware unit.    Porting the Delphi program to WIN's greater than XP is giving me a lot of problems when loading and saving my programs (tried that too) . It easier to let the XP be as it is now .    And again  AVR Studio 7 and XP ...   (sigh)...

 

Snestrup2012 AKA Kris

 

KSH

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In case you are interested I have recently updated my Atmel Studio 7 to latest Microchip Studio 7.0.2594 on my Windows-7 64-bit machine.

 

It works just fine on Windows-7 32-bit and 64-bit as long as it's reasonably up-to-date in terms of Microsoft Updates.

 

snestrup2012 wrote:
Win 10 software destroys my battery on this Dell Lattitude (E6410) 

  • How long did you leave it ?
  • It will take several hours to complete the indexing of Microsoft Updates. Resource constrained machines are pretty much unusable during this phase, but it will settle down after that.
  • You'll definitely need an SSD with Windows-10 it does seem very much more disk intensive than previous versions.
  • I upgraded my Dell E6410 to 8GB of memory. It does make a noticeable improvement in responsiveness. (It had a 120GB SSD already from DELL. I may upgrade that some day)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HI

 

@ N.Winterbottom 

 

Several months ago I installed WIN 10 (home) on this Dell Latitude E6410 ( DELL).  

 

I experienced several problems with that edition (browser froze, very long response times, long closing times and so on.)  Again months later on the DELL support web-site  I read, that this machine WAS NOT SUITED for Windows 10 .  Before the installation of W-10 I did not discover any problems with the installed Win (was a Win 8 as I remember) .  After (re)-installation of Win-8 I have not discovered any problems of the before-mentioned kind, except that the battery is almost dead ( well not quite;  approx 10 % back) .  I guess (maybe I am wrong) that is/was the Win-10 battery handling, that "killed" it.   

 

I will download the  Studio 7.0.2594  to this DELL    Thanks a lot for the tip.    (If I cant find it, I'll be back ) 

 

Thanks aqain.

 

Snestrup2012 AKA Kris

 

KSH

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

snestrup2012 wrote:
Believe me, I have tried to install a Win 10 .
Installing Windows also means matching UEFI and drivers both from the OEM; lack of either means EoS beginning at a specific build of Windows 10 (here, such occurred for one notebook PC made by HP in early '15 with northern summer '15 for first Windows 10 RTM)

RTM builds of Windows 10 are at Microsoft and OEM.

snestrup2012 wrote:
So I am forced to use Win 8 (or 7)  on this Dell machine.
Windows 8.1 lives on for a while (10-Jan'23)

snestrup2012 wrote:
But maybe there is a AVR Studio 7 for WIN XP, (7 /  8)  ??
Atmel Studio 6 for Windows XP

snestrup2012 wrote:
Porting the Delphi program to WIN's greater than XP is giving me a lot of problems when loading and saving my programs (tried that too)
Some are porting from Delphi to Free Pascal.

 


What is the Lifecycle Policy for Windows 8.1? | Lifecycle FAQ - Windows | Microsoft Docs

 

Delphi - Free Pascal wiki

re AVR :

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

snestrup2012 wrote:
the Win-10 battery handling,
fyi, some installs of Windows 11 have similar issues.

IIRC, MarkThomas has refurbished notebook PC (are refurbished notebook PC low enough in price?)

 

[Beta] DisplayPort Expansion Card firmware update to reduce system power consumption - Framework Laptop / DIY Edition - Framework Community

Which Framework Laptop is right for you? | Framework (DIY begins at 819USD)

 

edit :

1289USD at the regional Linux VAR

Notebook 15FHD | SWT: Notebook Computer

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Sep 21, 2022 - 05:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I really wish that we could see a fragment of this app that supposedly shows anomalous behavior.  Then we could give a straight answer to the supposed problem, instead of going on and on about the merits of a particular version of toolchain, and the merits of particular versions of operating systems, and the battery state of an aging laptop, and the merits of vacuum windshield wipers in a 1951 Chevy pickup truck.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.