Browse Source

+ AVR: initial support of the avrtiny architecture in the rtl

git-svn-id: trunk@43988 -
florian 5 years ago
parent
commit
28391e04bc
5 changed files with 43 additions and 3 deletions
  1. 12 0
      rtl/avr/setjump.inc
  2. 8 1
      rtl/avr/setjumph.inc
  3. 4 0
      rtl/embedded/Makefile
  4. 4 0
      rtl/embedded/Makefile.fpc
  5. 15 2
      rtl/embedded/avr/start.inc

+ 12 - 0
rtl/avr/setjump.inc

@@ -18,6 +18,7 @@ function fpc_setjmp(var S : jmp_buf) : shortint;assembler;[Public, alias : 'FPC_
   asm
   asm
     mov r26,r24
     mov r26,r24
     mov r27,r25
     mov r27,r25
+{$ifndef CPUAVR_16_REGS}   
     st x+,r1
     st x+,r1
     st x+,r2
     st x+,r2
     st x+,r3
     st x+,r3
@@ -33,8 +34,13 @@ function fpc_setjmp(var S : jmp_buf) : shortint;assembler;[Public, alias : 'FPC_
     st x+,r13
     st x+,r13
     st x+,r14
     st x+,r14
     st x+,r15
     st x+,r15
+{$endif CPUAVR_16_REGS}       
     st x+,r16
     st x+,r16
     st x+,r17
     st x+,r17
+{$ifdef CPUAVR_16_REGS}   
+    st x+,r18
+    st x+,r19
+{$endif CPUAVR_16_REGS}   
     st x+,r28
     st x+,r28
     st x+,r29
     st x+,r29
 
 
@@ -65,6 +71,7 @@ procedure fpc_longjmp(var S : jmp_buf;value : shortint);assembler;[Public, alias
   asm
   asm
     mov r26,r24
     mov r26,r24
     mov r27,r25
     mov r27,r25
+{$ifndef CPUAVR_16_REGS}   
     ld r1,x+
     ld r1,x+
     ld r2,x+
     ld r2,x+
     ld r3,x+
     ld r3,x+
@@ -80,8 +87,13 @@ procedure fpc_longjmp(var S : jmp_buf;value : shortint);assembler;[Public, alias
     ld r13,x+
     ld r13,x+
     ld r14,x+
     ld r14,x+
     ld r15,x+
     ld r15,x+
+{$endif CPUAVR_16_REGS}       
     ld r16,x+
     ld r16,x+
     ld r17,x+
     ld r17,x+
+{$ifdef CPUAVR_16_REGS}   
+    ld r18,x+
+    ld r19,x+
+{$endif CPUAVR_16_REGS}   
     ld r28,x+
     ld r28,x+
     ld r29,x+
     ld r29,x+
 
 

+ 8 - 1
rtl/avr/setjumph.inc

@@ -16,7 +16,14 @@
 
 
 type
 type
    jmp_buf = packed record
    jmp_buf = packed record
-     r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r28,r29,splo,sphi,pclo,pchi : byte;
+{$ifndef CPUAVR_16_REGS}   
+     r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,
+{$endif CPUAVR_16_REGS}   
+     r16,r17,
+{$ifdef CPUAVR_16_REGS}   
+     r18,r19,
+{$endif CPUAVR_16_REGS}   
+     r28,r29,splo,sphi,pclo,pchi : byte;
 {$ifdef CPUAVR_3_BYTE_PC}
 {$ifdef CPUAVR_3_BYTE_PC}
      pchighest : byte
      pchighest : byte
 {$endif CPUAVR_3_BYTE_PC}
 {$endif CPUAVR_3_BYTE_PC}

+ 4 - 0
rtl/embedded/Makefile

@@ -385,6 +385,10 @@ endif
 endif
 endif
 ifeq ($(ARCH),avr)
 ifeq ($(ARCH),avr)
 CPU_SPECIFIC_COMMON_UNITS=intrinsics
 CPU_SPECIFIC_COMMON_UNITS=intrinsics
+ifeq ($(SUBARCH),avrtiny)
+CPU_UNITS=attiny4 attiny5 attiny9 attiny10 attiny20 attiny40
+CPU_UNITS_DEFINED=1
+endif
 ifeq ($(SUBARCH),avr25)
 ifeq ($(SUBARCH),avr25)
 CPU_UNITS=attiny44a attiny26 attiny48 attiny10 attiny84a attiny2313 attiny461 attiny43u \
 CPU_UNITS=attiny44a attiny26 attiny48 attiny10 attiny84a attiny2313 attiny461 attiny43u \
 	  attiny24a attiny88 attiny40 attiny861 attiny85 attiny20 attiny24 attiny9 \
 	  attiny24a attiny88 attiny40 attiny861 attiny85 attiny20 attiny24 attiny9 \

+ 4 - 0
rtl/embedded/Makefile.fpc

@@ -101,6 +101,10 @@ endif
 
 
 ifeq ($(ARCH),avr)
 ifeq ($(ARCH),avr)
 CPU_SPECIFIC_COMMON_UNITS=intrinsics
 CPU_SPECIFIC_COMMON_UNITS=intrinsics
+ifeq ($(SUBARCH),avrtiny)
+CPU_UNITS=attiny4 attiny5 attiny9 attiny10 attiny20 attiny40
+CPU_UNITS_DEFINED=1
+endif
 ifeq ($(SUBARCH),avr25)
 ifeq ($(SUBARCH),avr25)
 CPU_UNITS=attiny44a attiny26 attiny48 attiny10 attiny84a attiny2313 attiny461 attiny43u \
 CPU_UNITS=attiny44a attiny26 attiny48 attiny10 attiny84a attiny2313 attiny461 attiny43u \
           attiny24a attiny88 attiny40 attiny861 attiny85 attiny20 attiny24 attiny9 \
           attiny24a attiny88 attiny40 attiny861 attiny85 attiny20 attiny24 attiny9 \

+ 15 - 2
rtl/embedded/avr/start.inc

@@ -1,5 +1,9 @@
     _start:
     _start:
+{$ifdef CPUAVR_16_REGS}
+        clr r17
+{$else CPUAVR_16_REGS}
         clr r1
         clr r1
+{$endif CPUAVR_16_REGS}
 
 
         // load stack pointer
         // load stack pointer
         ldi r30,lo8(_stack_top)
         ldi r30,lo8(_stack_top)
@@ -16,8 +20,13 @@
 
 
         rjmp .LCopyDataLoopEntry
         rjmp .LCopyDataLoopEntry
 .LCopyDataLoop:
 .LCopyDataLoop:
-        lpm r0, Z+
-        st X+, r0
+{$ifdef CPUAVR_16_REGS}
+        //!!!! FIXME? lpm r0, Z+
+        //!!!! FIXME? st X+, r0
+{$else CPUAVR_16_REGS}
+        lpm r16, Z+
+        st X+, r16
+{$endif CPUAVR_16_REGS}
 
 
 .LCopyDataLoopEntry:
 .LCopyDataLoopEntry:
         cpi XL, lo8(_edata)
         cpi XL, lo8(_edata)
@@ -35,7 +44,11 @@
         jmp .LZeroBssLoopEntry
         jmp .LZeroBssLoopEntry
 {$endif RELBRANCHES}
 {$endif RELBRANCHES}
 .LZeroBssLoop:
 .LZeroBssLoop:
+{$ifdef CPUAVR_16_REGS}
+        st X+, r17
+{$else CPUAVR_16_REGS}
         st X+, r1
         st X+, r1
+{$endif CPUAVR_16_REGS}
 
 
 .LZeroBssLoopEntry:
 .LZeroBssLoopEntry:
         cpi XL, lo8(_bss_end)
         cpi XL, lo8(_bss_end)