View Issue Details

IDProjectCategoryView StatusLast Update
0036620FPCCompilerpublic2020-01-23 13:53
ReporterChristo Crause Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0036620: AVR [patch] Avrtiny26 controller is not subarch avr25
DescriptionThe avrtiny26 controller is listed as an avr2 by https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html. According to its datasheet it doesn't support the MOVW instruction, hence incorrect code can be generated if it remains part of the avr25 subarch group in FPC. The attached patch changes the subarch for avrtiny26 to vr2 and also adds CPUAVR_HAS_LPMX to avr2's capabilities (according to avrtiny26 datasheet).
TagsNo tags attached.
Fixed in Revision44019
FPCOldBugId
FPCTarget-
Attached Files

Activities

Christo Crause

2020-01-22 20:42

reporter  

avr2.patch (3,940 bytes)   
diff --git a/compiler/avr/cpuinfo.pas b/compiler/avr/cpuinfo.pas
index 8c6aec5a92..b5e2c651ff 100644
--- a/compiler/avr/cpuinfo.pas
+++ b/compiler/avr/cpuinfo.pas
@@ -289,7 +289,7 @@ Const
         ,(controllertypestr:'ATTINY44A'; controllerunitstr:'ATTINY44A'; cputype: cpu_avr25; fputype:fpu_soft; flashbase:0; flashsize:4096; srambase:96; sramsize:256; eeprombase:0; eepromsize:256)
         ,(controllertypestr:'ATMEGA649A'; controllerunitstr:'ATMEGA649A'; cputype: cpu_avr5; fputype:fpu_soft; flashbase:0; flashsize:65536; srambase:256; sramsize:4096; eeprombase:0; eepromsize:2048)
         ,(controllertypestr:'ATMEGA32U4'; controllerunitstr:'ATMEGA32U4'; cputype: cpu_avr5; fputype:fpu_soft; flashbase:0; flashsize:32768; srambase:256; sramsize:2560; eeprombase:0; eepromsize:1024)
-        ,(controllertypestr:'ATTINY26'; controllerunitstr:'ATTINY26'; cputype: cpu_avr25; fputype:fpu_soft; flashbase:0; flashsize:2048; srambase:96; sramsize:128; eeprombase:0; eepromsize:128)
+        ,(controllertypestr:'ATTINY26'; controllerunitstr:'ATTINY26'; cputype: cpu_avr2; fputype:fpu_soft; flashbase:0; flashsize:2048; srambase:96; sramsize:128; eeprombase:0; eepromsize:128)
         ,(controllertypestr:'AT90USB1287'; controllerunitstr:'AT90USB1287'; cputype: cpu_avr51; fputype:fpu_soft; flashbase:0; flashsize:131072; srambase:256; sramsize:8192; eeprombase:0; eepromsize:4096)
         ,(controllertypestr:'AT90PWM161'; controllerunitstr:'AT90PWM161'; cputype: cpu_avr5; fputype:fpu_soft; flashbase:0; flashsize:16384; srambase:256; sramsize:1024; eeprombase:0; eepromsize:512)
         ,(controllertypestr:'ATTINY48'; controllerunitstr:'ATTINY48'; cputype: cpu_avr25; fputype:fpu_soft; flashbase:0; flashsize:4096; srambase:256; sramsize:256; eeprombase:0; eepromsize:64)
@@ -464,7 +464,7 @@ Const
      ( { cpu_none    } [],
        { cpu_avrtiny } [CPUAVR_16_REGS,CPUAVR_2_BYTE_PC],
        { cpu_avr1    } [CPUAVR_2_BYTE_PC],
-       { cpu_avr2    } [CPUAVR_2_BYTE_PC],
+       { cpu_avr2    } [CPUAVR_HAS_LPMX,CPUAVR_2_BYTE_PC],
        { cpu_avr25   } [CPUAVR_HAS_MOVW,CPUAVR_HAS_LPMX,CPUAVR_2_BYTE_PC],
        { cpu_avr3    } [CPUAVR_HAS_JMP_CALL,CPUAVR_2_BYTE_PC],
        { cpu_avr31   } [CPUAVR_HAS_JMP_CALL,CPUAVR_HAS_RAMPZ,CPUAVR_HAS_ELPM,CPUAVR_2_BYTE_PC],
diff --git a/rtl/embedded/Makefile b/rtl/embedded/Makefile
index d6e3a3328c..8adfc17a88 100644
--- a/rtl/embedded/Makefile
+++ b/rtl/embedded/Makefile
@@ -389,8 +389,12 @@ ifeq ($(SUBARCH),avrtiny)
 CPU_UNITS=attiny4 attiny5 attiny9 attiny10 attiny20 attiny40
 CPU_UNITS_DEFINED=1
 endif
+ifeq ($(SUBARCH),avr2)
+CPU_UNITS=attiny26
+CPU_UNITS_DEFINED=1
+endif
 ifeq ($(SUBARCH),avr25)
-CPU_UNITS=attiny44a attiny26 attiny48 attiny10 attiny84a attiny2313 attiny461 attiny43u \
+CPU_UNITS=attiny44a attiny48 attiny10 attiny84a attiny2313 attiny461 attiny43u \
 	  attiny24a attiny88 attiny40 attiny861 attiny85 attiny20 attiny24 attiny9 \
 	  attiny87 attiny84 attiny13a attiny45 attiny5 attiny828 attiny4313 attiny13 attiny261 \
 	  attiny861a attiny28 attiny4 attiny44 attiny2313a attiny461a attiny261a attiny25
diff --git a/rtl/embedded/Makefile.fpc b/rtl/embedded/Makefile.fpc
index 1f0a799d95..eeba2afefa 100644
--- a/rtl/embedded/Makefile.fpc
+++ b/rtl/embedded/Makefile.fpc
@@ -105,8 +105,12 @@ ifeq ($(SUBARCH),avrtiny)
 CPU_UNITS=attiny4 attiny5 attiny9 attiny10 attiny20 attiny40
 CPU_UNITS_DEFINED=1
 endif
+ifeq ($(SUBARCH),avr2)
+CPU_UNITS=attiny26
+CPU_UNITS_DEFINED=1
+endif
 ifeq ($(SUBARCH),avr25)
-CPU_UNITS=attiny44a attiny26 attiny48 attiny10 attiny84a attiny2313 attiny461 attiny43u \
+CPU_UNITS=attiny44a attiny48 attiny10 attiny84a attiny2313 attiny461 attiny43u \
           attiny24a attiny88 attiny40 attiny861 attiny85 attiny20 attiny24 attiny9 \
           attiny87 attiny84 attiny13a attiny45 attiny5 attiny828 attiny4313 attiny13 attiny261 \
           attiny861a attiny28 attiny4 attiny44 attiny2313a attiny461a attiny261a attiny25
avr2.patch (3,940 bytes)   

Christo Crause

2020-01-23 13:53

reporter   ~0120686

Thanks Florian.

Issue History

Date Modified Username Field Change
2020-01-22 20:42 Christo Crause New Issue
2020-01-22 20:42 Christo Crause File Added: avr2.patch
2020-01-22 21:42 Florian Assigned To => Florian
2020-01-22 21:42 Florian Status new => resolved
2020-01-22 21:42 Florian Resolution open => fixed
2020-01-22 21:42 Florian Fixed in Version => 3.3.1
2020-01-22 21:42 Florian Fixed in Revision => 44019
2020-01-22 21:42 Florian FPCTarget => -
2020-01-23 13:53 Christo Crause Status resolved => closed
2020-01-23 13:53 Christo Crause Note Added: 0120686