Forum: Mikrocontroller und Digitale Elektronik MSP430F1611 - Controller hängt beim löschen des Speichers


von Sebastian K. (albatros82)


Lesenswert?

Hallo,

Seit gestern kämpfe ich mit einem merkwürdigen Problem. Mein MSP lässt 
sich wie gewohnt mit meiner Software bespielen und startet auch.

IAR Assembler for MSP430
V3.30A/W32 (3.30.1.9)

Normalerweise bleibt er dann jedoch am einstiegspunkt "main" stehen.
Momentan kommt er aber erst garnicht bis zum Einstiegspunkt Main sondern 
bleibt vorher in einer Endlosschleife hängen. Nachforschungen führten zu 
dieser Funktion:

__data16_memzero:
 0053EE   0F4C          mov.w   R12,R15
 0053F0   0F5E          add.w   R14,R15
 0053F2   033C          jmp     0x53FA
 0053F4   CC430000      clr.b   0x0(R12)
 0053F8   1C53          inc.w   R12
 0053FA   0C9F          cmp.w   R15,R12
 0053FC   FB23          jne     0x53F4
 0053FE   3041          ret

In meinen Augen löscht sie den Speicher des Controlles von der Adresse 
in R12 bis zur Adresse in R15 (0x2F53).  Jedoch erreicht das Register 
R12 niemals den Wert in R15. Scheinbar wird das Register durch irgendwas 
immer wieder zurückgestezt.

Setzt man den PC auf die Adresse 0053FE zeigt der Debugger das erwartete 
Verhalten und springt zu Main. Jedoch sind dann logischerweise nicht 
alle Variblen zurückgestezt.

Ein anderer Workaround ist es die Codeoptimierung auf maximal zu 
stellen. Jedoch lässt sich der Code dann nicht mehr gescheit Debuggen.

Fakt ist auch das ich relativ viele globale Variablen definiert habe. 
Kann es sein das ich da einfach übertrieben habe?

Hat da jemand eine Idee was das ein könnte?

Grüße Albatros

von Humberto (Gast)


Lesenswert?

Hi Albatros!

I have read your email and, in fact, I can not help you, but I need to 
know if you could solve the problem (MSP430F1611 - __data16_memzero).
I am asking this because I am in front of this problem right now! So 
could you to solve the problem? If so, can you help-me sending me the 
workaround, please.

Thank you so much.

Best regards

Humberto

humbertovgomes@gmail.com

von Stefan (Gast)


Lesenswert?

The problem:
IAR compiler inserts __low_level_init in front of your main().
This is done e.g. to initialize variables you defined!
If there are too many variables then __low_level_init will take to long 
time and your watchdog will fire before you are able to disable WDT in 
main()!

solutions:
- define less (global) variables
- or try higher MCLK, so the code will run faster
- or try some other optimization switches
But the most reasonable solution would be to change cstartup code, so 
WDT is disabled before or in __low_level_init

von Stefan (Gast)


Lesenswert?

>- or try higher MCLK, so the code will run faster
OK, nonsense. Forget about this ;-)

von Humberto (Gast)


Lesenswert?

Hey Stefan,

Thank you so much!
Sorry by the delay, but the forum didn't send me any message, and I was 
solving another problem of the shelf.. :)
With your tip I could solve the problem, you were completely right, I 
fixed it declaring the global arrays with the __no_init IAR directive.

Thanks again

Humberto

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.