Error: parameter error

Compiler bug?

sine_wave
Benutzer
Avatar
Geschlecht: keine Angabe
Alter: 55
Beiträge: 21
Dabei seit: 10 / 2022
Betreff:

Error: parameter error

 · 
Gepostet: 22.12.2025 - 15:52 Uhr  ·  #1
Hello,

I discovered a strange compiler behaviour. This code works:

SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
//SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;

(18 accesses to the data structure)

but this not:

SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;
SensorData.GyroData.Roll := SensorData.GyroData.Roll + 1;

(20 or more accesses to the data structure)

Ok, the code doesn't make sense, but it shows, that only the number of accesses to the data structure can cause the error. In my application the code is different, but this points out the problem best.

The error is, that the window with the .asm file opens and the error "Error: parameter error" comes up. The code line, where the error happens (yellow marked), is in a completely different code section.

The AVRco version is 6.00.05 and the processor used is XMega256A3.

I would highly appreciate any help, because currently, I'm blocked with the software development ...

Best regards
Alois
sine_wave
Benutzer
Avatar
Geschlecht: keine Angabe
Alter: 55
Beiträge: 21
Dabei seit: 10 / 2022
Betreff:

Re: Error: parameter error

 · 
Gepostet: 22.12.2025 - 17:06 Uhr  ·  #2
The error rises up when making the project with CTRL-F9.
The error rises not up when using Make & Optimize CTRL-SHIFT-F9.
Merlin
Administrator
Avatar
Geschlecht:
Alter: 26
Beiträge: 1483
Dabei seit: 03 / 2005
Betreff:

Re: Error: parameter error

 · 
Gepostet: 22.12.2025 - 18:13 Uhr  ·  #3
Please compile unoptimised and post the asm and err files, via pm if you don't want to post here. The likelihood is that a label has gone out of scope but the optimiser has reduced the code size sufficiently to bring it back but without seeing the above files it is impossible to say for sure.
Merlin
Administrator
Avatar
Geschlecht:
Alter: 26
Beiträge: 1483
Dabei seit: 03 / 2005
Betreff:

Re: Error: parameter error

 · 
Gepostet: 22.12.2025 - 21:08 Uhr  ·  #4
Thank you for sending me the assembler Alois.

In the lcd unit is the following block of code:

.ASM
.LINE 1898
LDS _ACCBHI, %.pxCount+1
.LINE 1899
LDS _ACCBLO, %.pxCount
_LoopFillR:
.LINE 1902
LDD _ACCA, Y+001h // hi byte
.LINE 1903
RCALL %.WriteData
.LINE 1904
LDD _ACCA, Y+00h // lo byte
.LINE 1905
RCALL %.WriteData
.LINE 1907
SBIW _ACCBLO, 1
.LINE 1908
BRNE _LoopFillR
.endasm

which is where the error is generated.

This tells me that there is code written in assembler, which is not verified by the compiler. This assembler contains the instruction RCALL %.WriteData which should be changed to CALL %.WriteData wherever it occurs.

RCALL only has a limited range so if a lot of code is placed between this block and the routine WriteData the RCALL will eventually go out of range. It is nothing to do with what the code is, simply that it is there at all. The optimiser reduces the code size and therefore will bring the code back into scope.

In assembler routines, particularly those for use by others, you should always use CALL unless the code is only intended for use with TINY devices (which do not support the CALL function) and even then it is OK if you are using the optimiser. The optimiser will convert CALL to RCALL if it is valid to do so (which in TINY device is always valid anyway).

Regards

Merlin.
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: 15 · Cache Hits: 14   79   93 · Page-Gen-Time: 0.020197s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI