Merlin error?

removed lines from asm

wsandor
Benutzer
Avatar
Geschlecht: keine Angabe
Alter: 54
Beiträge: 26
Dabei seit: 07 / 2012
Betreff:

Merlin error?

 · 
Gepostet: 03.04.2018 - 14:18 Uhr  ·  #1
Hi,

I use AVRCO ver 5.04.04, Optimiser Ver 3.2.12.0 and run to the following error:

Pascal source (part):

{$IDATA}
var
tms: Integer;
buzzerOffTime,
buzzer2OffTime: Integer;
buzzer, buzzer2: Boolean;

{--------------------------------------------------------------}
{ functions }

procedure OnSysTick;

begin
asm;
LDS _ACCCLO, %.TMS
LDS _ACCCHI, %.TMS+1
ADIW _ACCCLO, 1
STS %.TMS, _ACCCLO
STS %.TMS+1, _ACCCHI
LDS _ACCB, %.BuzzerOffTime
LDS _ACCA, %.BuzzerOffTime+1
SUB _ACCB, _ACCCLO
SBC _ACCA, _ACCCHI
BRPL nobuzzer
LDI _ACCA, 0
STS %.buzzer, _ACCA
nobuzzer:
LDS _ACCB, %.Buzzer2OffTime
LDS _ACCA, %.Buzzer2OffTime+1
SUB _ACCB, _ACCCLO
SBC _ACCA, _ACCCHI
BRPL nobuzzer2
LDI _ACCA, 0
STS %.buzzer2, _ACCA
noBuzzer2:
endasm;
end;

If I compile it using the Optimiser, lines that use _ACCB in the first part áre removed:
Here is the generated asm: (lines in bold - 94 and 96 are missing! - but 102 and 104 is present)

.SYM tms, 00327h, 00004h, 3
merlintest.tms .EQU 327h ; var iData integer
.SYM buzzerOffTime, 00329h, 00004h, 3
merlintest.buzzerOffTime .EQU 329h ; var iData integer
.SYM buzzer2OffTime, 0032Bh, 00004h, 3
merlintest.buzzer2OffTime .EQU 32Bh ; var iData integer
.SYM buzzer, 0032Dh, 00003h, 3
merlintest.buzzer .EQU 32Dh ; var iData boolean
.SYM buzzer2, 0032Eh, 00003h, 3
merlintest.buzzer2 .EQU 32Eh ; var iData boolean
.FUNC OnSysTick, 00055h, 00020h
merlintest.OnSysTick:
.RETURNS 0
.BLOCK 87
.ASM
.LINE 89
LDS _ACCCLO, %.TMS
.LINE 90
LDS _ACCCHI, %.TMS+1
.LINE 91
ADIW _ACCCLO, 1
.LINE 92
STS %.TMS, _ACCCLO
.LINE 93
STS %.TMS+1, _ACCCHI
.LINE 95
LDS _ACCA, %.BuzzerOffTime+1
.LINE 97
SBC _ACCA, _ACCCHI
.LINE 98
BRPL nobuzzer
.LINE 99
LDI _ACCA, 0
.LINE 100
STS %.buzzer, _ACCA
nobuzzer:
.LINE 102
LDS _ACCB, %.Buzzer2OffTime
.LINE 103
LDS _ACCA, %.Buzzer2OffTime+1
.LINE 104
SUB _ACCB, _ACCCLO
.LINE 105
SBC _ACCA, _ACCCHI
.LINE 106
BRPL nobuzzer2
.LINE 107
LDI _ACCA, 0
.LINE 108
STS %.buzzer2, _ACCA
noBuzzer2:
.endasm
.ENDBLOCK 111
.LINE 111
.BRANCH 19
RET
.ENDFUNC 111

I think that the optimiser thinks that the value in _ACCB is not used, however it is not the case, it is needed for the subtraction and the following compare.
How can I avoid it? (without turning off the optimization completly)
(If there is no second part - lines between nobuzzer and nobuzzer2 then the result is good - as it is good for this block)

Thanks in advance!
rh
Administrator
Avatar
Geschlecht:
Herkunft: Germany
Alter: 25
Homepage: e-lab.de
Beiträge: 5558
Dabei seit: 03 / 2002
Betreff:

Re: Merlin error?

 · 
Gepostet: 03.04.2018 - 14:46 Uhr  ·  #2
Sandor wow,
you are using a stone-aged version of the Opti, current is 3.5.6
I attach this one ad hope it will help you.

rolf
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: Merlin error?

 · 
Gepostet: 03.04.2018 - 14:56 Uhr  ·  #3
Hi Sandor.

If the problem persists with the latest version of optimiser, please supply asm and dsm files via pm and I will investigate.
wsandor
Benutzer
Avatar
Geschlecht: keine Angabe
Alter: 54
Beiträge: 26
Dabei seit: 07 / 2012
Betreff:

Re: Merlin error?

 · 
Gepostet: 04.04.2018 - 17:10 Uhr  ·  #4
Thanks for the new optimiser version.
For my test project the new version solved the problem, the lines aren't missing anymore. However with my original, full project the new optimezer throws an Access Violation error. So I can't really use it...
I attached a screenshot about the error.
Der an diesem Beitrag angefügte Anhang ist entweder nur im eingeloggten Zustand sichtbar oder die Berechtigung Deiner Benutzergruppe ist nicht ausreichend.
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: Merlin error?

 · 
Gepostet: 04.04.2018 - 17:27 Uhr  ·  #5
Please send asm and dsm files (zipped) via pm and I will check it out.
wsandor
Benutzer
Avatar
Geschlecht: keine Angabe
Alter: 54
Beiträge: 26
Dabei seit: 07 / 2012
Betreff:

Re: Merlin error?

 · 
Gepostet: 04.04.2018 - 18:14 Uhr  ·  #6
I sent you the PM with the asked files.
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: Merlin error?

 · 
Gepostet: 04.04.2018 - 23:20 Uhr  ·  #7
Hi Sandor.

Thanks for your code.

The optimiser crashed due to a syntax error in your hand crafted assembly code. However, because the built in AVRCo assembler allows this syntax error, I have decided that the optimiser should also allow it and have sent you an update via pm. I have also sent the update to Rolf to be issued in the next release.
Gewählte Zitate für Mehrfachzitierung:   0

Registrierte in diesem Topic

Aktuell kein registrierter in diesem Bereich

Die Statistik zeigt, wer in den letzten 5 Minuten online war. Erneuerung alle 90 Sekunden.
MySQL Queries: 10 · Cache Hits: 14   124   138 · Page-Gen-Time: 0.025581s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI