View Issue Details

IDProjectCategoryView StatusLast Update
0036650FPCRTLpublic2020-02-02 20:25
ReporterChristo Crause Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0036650: AVR [patch] Fix startup code for avrtiny subarch
DescriptionThe current startup code gets stuck in the data copy loop for avrtiny. The attached patch fixes this by using the LD instruction to load data from a memory mapped flash address to SRAM.
TagsNo tags attached.
Fixed in Revision44100
FPCOldBugId
FPCTarget-
Attached Files

Activities

Christo Crause

2020-02-02 18:58

reporter  

start-avrtiny.patch (787 bytes)   
diff --git a/rtl/embedded/avr/start.inc b/rtl/embedded/avr/start.inc
index b49c475533..3887c87705 100644
--- a/rtl/embedded/avr/start.inc
+++ b/rtl/embedded/avr/start.inc
@@ -16,17 +16,20 @@
         ldi XH,hi8(_data)
         ldi YH,hi8(_edata)
         ldi ZL,lo8(_etext)
+{$ifdef CPUAVR_16_REGS}
+        ldi ZH,hi8(_etext)+(0x40) // program memory mapped to $4000 in data space
+{$else CPUAVR_16_REGS}
         ldi ZH,hi8(_etext)
+{$endif CPUAVR_16_REGS}
 
         rjmp .LCopyDataLoopEntry
 .LCopyDataLoop:
 {$ifdef CPUAVR_16_REGS}
-        //!!!! FIXME? lpm r0, Z+
-        //!!!! FIXME? st X+, r0
+        ld r16, Z+
 {$else CPUAVR_16_REGS}
         lpm r16, Z+
-        st X+, r16
 {$endif CPUAVR_16_REGS}
+        st X+, r16
 
 .LCopyDataLoopEntry:
         cpi XL, lo8(_edata)
start-avrtiny.patch (787 bytes)   

Florian

2020-02-02 20:19

administrator   ~0120849

Thanks, applied.

Christo Crause

2020-02-02 20:25

reporter   ~0120850

Thanks Florian.

Issue History

Date Modified Username Field Change
2020-02-02 18:58 Christo Crause New Issue
2020-02-02 18:58 Christo Crause File Added: start-avrtiny.patch
2020-02-02 20:19 Florian Assigned To => Florian
2020-02-02 20:19 Florian Status new => resolved
2020-02-02 20:19 Florian Resolution open => fixed
2020-02-02 20:19 Florian Fixed in Version => 3.3.1
2020-02-02 20:19 Florian Fixed in Revision => 44100
2020-02-02 20:19 Florian FPCTarget => -
2020-02-02 20:19 Florian Note Added: 0120849
2020-02-02 20:25 Christo Crause Status resolved => closed
2020-02-02 20:25 Christo Crause Note Added: 0120850