Probleme mit langen Strings im EEProm

  • 1
  • 2
  • 3
  • Page 2 of 3
werner mehl
Benutzer
Avatar
Gender:
Age: 68
Posts: 49
Registered: 02 / 2012
Subject:

Re: Probleme mit langen Strings im EEProm

 · 
Posted: 21.11.2020 - 18:41  ·  #9
i used the controller before, but never used this long strings.
golf
Benutzer
Avatar
Gender:
Location: Donauwörth
Age: 70
Posts: 250
Registered: 11 / 2009
Subject:

Re: Probleme mit langen Strings im EEProm

 · 
Posted: 21.11.2020 - 19:04  ·  #10
Hallo Werner,
ich habe diese Probleme bisher nicht gehabt.
Jedoch meide ich aus Performance-Gründen soweit es geht eine größere Nutzung des Eeproms zur Laufzeit. Wenn es geht, kopiere ich nötige EEprominhalte beim Programmstart ins Ram und arbeite damit.
Wenn Sachen aber sehr oft und schnell gespeichert müssen, dann habe ich dazu auch schon FRams verwendet oder serielle SRams mit SuperCap dran, das geht auch.

Gruß
golf
werner mehl
Benutzer
Avatar
Gender:
Age: 68
Posts: 49
Registered: 02 / 2012
Subject:

Re: Probleme mit langen Strings im EEProm

 · 
Posted: 22.11.2020 - 11:13  ·  #11
Hallo Thorsten, Hallo Golf,
ich habe mit der Auswertung und dem Speichern/lesen der Strings keine Performance Probleme, die Strings werden prinzipiell einmal gespeichert und bei Bedarf aufgerufen und abgearbeitet. Dieses Aufrufen und abarbeiten kann einmal in der Stunde oder einmal im Jahr sein. Aber eine spezielle Performance erwarte ich hier nicht. Deshalb habe ich es auch so gemacht. Denn eigentlich sollte es ja gehen.
Aber nochmal eine spezielle Frage. Benötigen diese langen Strings spezielle einstellungen bei der Stack / Frame größe?
Wie wirken sich diese Strings aus?
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1372
Registered: 03 / 2005
Subject:

Re: Probleme mit langen Strings im EEProm

 · 
Posted: 22.11.2020 - 12:11  ·  #12
It depends on how you use the strings. Strings are problematic. They use a lot of frame space (stack is not really an issue) and if you manipulate strings (rather than the characters within the strings individually) you can expect to use at least twice the space in the frame for temporary storage as the length of the strings involved. If you are passing strings as parameters to functions (rather than pointers to string) then you use as much stack as the maximum length of the string because it is copied to the frame. Local variables do the same (even if they are not used!). So you can see, it is easy to run out of stack quite quickly,

Strings are one of the few things I tend to define as global variables for this reason. I generally don't like global variables.
werner mehl
Benutzer
Avatar
Gender:
Age: 68
Posts: 49
Registered: 02 / 2012
Subject:

Re: Probleme mit langen Strings im EEProm

 · 
Posted: 22.11.2020 - 13:42  ·  #13
I also do not use local Variables.
The strings are transferred as variables via serial interface and saved in the EEProm.
In an external event occours, they are read, broken down into individual commands and processed.

If I see that correctly, do I have to make the stack and frame at least twice as large as the longest possible string?
Then wouldn't I have been completely wrong with $1FF for both of them?

This is an example of the macros used.

!; H; 0;!; N; GSM!; M; +491707224180;!; D; 15;!; M; +4916126132794;!; 1; Inp_1;!; 2; Inp_2;!; 3; Inp_3 ;! ; 4; Inp_4;!; D; 15;!; C; 11;!; &; 0; <; C; 14;!; Z; 0;!; Z; 3;
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1372
Registered: 03 / 2005
Subject:

Re: Probleme mit langen Strings im EEProm

 · 
Posted: 22.11.2020 - 14:13  ·  #14
Stack is not an issue. Frame may or may not be.

For example when reading your serial buffer you do things like

Code
Dummy01[n][i] := SerInp;
inc(i);


then you might be OK.

But if instead you write

Code

Dummy01[n] := Dummy01[n] + SerInp;


then I very much doubt it but I don't know the internal workings of the compiler enough to be sure. Don't forget you need stack for calculating offsets in arrays and that whether you use local variables or not, the compiler does internally, and these are stored on the frame.

Sorry I cant be definitive about it.
Thomas.AC
Benutzer
Avatar
Gender: n/a
Age: 43
Posts: 308
Registered: 07 / 2013
Subject:

Re: Probleme mit langen Strings im EEProm

 · 
Posted: 23.11.2020 - 23:10  ·  #15
Hallo,

Im Simulator existiert das Problem auch mit kurzen Strings und Words!
Immer dann, wenn gleiche Bytes aufeinanderfolgen. Das wäre schlimm.
Ich muss das einmal mit richtiger Hardware testen.

@Werner
Den maximalen Stack- und Frameverbrauch lassen sich mit GetStackFree und Get StackFrame herausfinden. Der Simulator zeigt es auch an.

Gruß
You must be logged in or your permissions are to low to see this Attachment(s).
pvs-deck
PowerUser
Avatar
Gender:
Age: 53
Homepage: pvs-deck.de
Posts: 1340
Registered: 02 / 2009
Subject:

Re: Probleme mit langen Strings im EEProm

 · 
Posted: 24.11.2020 - 14:16  ·  #16
Hallo Thomas,

welche Version nutzt Du?
Ich speichere schon seit Jahren Passwörter, PinCodes als String im EEProm ab. Ich habe bis jetzt noch nie solche Probleme gehabt. Allerdings sind meine Strings auch nur 10 Zeichen lang. In den alten Versionen wurde es noch als Klartext gespeichert. Da war es als Intialpasswort / PIN "000000"
Da konnte ich keine Probleme feststellen. Mittlerweile sind diese Sachen verschlüsselt im EEPROM, da ich diese EEPROM Bereich auch auf der SD-Card abspeichere.

Ich habe mal die alte Software mit meiner AVRco Version getestet 5.10.09, ich kann hier keine Probleme erkennen. Sind aber auch nur Strings aus Zahlen.

Thorsten
You must be logged in or your permissions are to low to see this Attachment(s).
  • 1
  • 2
  • 3
  • Page 2 of 3
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   139   153 · Page-Gen-Time: 0.023205s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI