소스 검색

+ avrsim controller target requiring a special avr simulator with a certain memory location handling, see avrsim.pp controller helper unit for what it is needed

git-svn-id: trunk@30385 -
florian 10 년 전
부모
커밋
dfd4d3656b
5개의 변경된 파일72개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 0
      .gitattributes
  2. 12 0
      compiler/avr/cpuinfo.pas
  3. 1 1
      rtl/embedded/Makefile
  4. 1 1
      rtl/embedded/Makefile.fpc
  5. 57 0
      rtl/embedded/avr/avrsim.pp

+ 1 - 0
.gitattributes

@@ -8206,6 +8206,7 @@ rtl/embedded/arm/stm32f10x_md.pp svneol=native#text/pascal
 rtl/embedded/arm/stm32f10x_xl.pp svneol=native#text/pascal
 rtl/embedded/arm/xmc4500.pp svneol=native#text/pascal
 rtl/embedded/avr/atmega128.pp svneol=native#text/plain
+rtl/embedded/avr/avrsim.pp svneol=native#text/plain
 rtl/embedded/avr/start.inc svneol=native#text/plain
 rtl/embedded/buildrtl.lpi svneol=native#text/plain
 rtl/embedded/buildrtl.pp svneol=native#text/plain

+ 12 - 0
compiler/avr/cpuinfo.pas

@@ -56,6 +56,8 @@ Type
    tcontrollertype =
      (ct_none,
 
+      ct_avrsim,
+
       ct_atmega16,
       ct_atmega32,
       ct_atmega48,
@@ -120,6 +122,16 @@ Const
         eeprombase:0;
         eepromsize:0
    	),
+   	(
+        controllertypestr:'AVRSIM';
+        controllerunitstr:'AVRSIM';
+        flashbase:0;
+        flashsize:$20000;
+        srambase:0;
+        sramsize:4096;
+        eeprombase:0;
+        eepromsize:4096;
+        ),
         (
    	controllertypestr:'ATMEGA16';
         controllerunitstr:'ATMEGA16';

+ 1 - 1
rtl/embedded/Makefile

@@ -369,7 +369,7 @@ CPU_UNITS=allwinner_a20
 endif
 endif
 ifeq ($(ARCH),avr)
-CPU_UNITS=atmega128
+CPU_UNITS=atmega128 avrsim
 endif
 ifeq ($(ARCH),i386)
 CPU_SPECIFIC_COMMON_UNITS=sysutils math classes fgl macpas typinfo types rtlconsts

+ 1 - 1
rtl/embedded/Makefile.fpc

@@ -84,7 +84,7 @@ endif
 endif
 
 ifeq ($(ARCH),avr)
-CPU_UNITS=atmega128
+CPU_UNITS=atmega128 avrsim
 endif
 
 ifeq ($(ARCH),i386)

+ 57 - 0
rtl/embedded/avr/avrsim.pp

@@ -0,0 +1,57 @@
+{******************************************************************************
+Startup code for an avr simulator
+
+******************************************************************************}
+unit avrsim;
+
+{$goto on}
+{$macro on}
+
+  interface
+    var
+      OUTPUTREG   : byte absolute $20;
+      EXITCODEREG : byte absolute $21;
+      HALTREQUEST : byte absolute $22;
+
+    {$define DOCALL:=call}
+    {$define DOJMP:=jmp}
+
+  implementation
+
+    procedure PASCALMAIN; external name 'PASCALMAIN';
+
+    procedure _FPC_haltproc(exitcode : longint); public name '_haltproc'; noreturn;
+
+      begin
+        EXITCODEREG:=exitcode;
+        HALTREQUEST:=1;
+        { really stop }
+        while true do
+          ;
+      end;
+
+    var
+      _data: record end; external name '__data_start';
+      _edata: record end; external name '__data_end';
+      _etext: record end; external name '_etext';
+      _bss_start: record end; external name '__bss_start';
+      _bss_end: record end; external name '__bss_end';
+      _stack_top: record end; external name '_stack_top';
+
+    procedure _FPC_start; assembler; nostackframe;
+      label
+        _start;
+      asm
+        .init
+        .globl _start
+        jmp _start
+
+        {
+          all ATMEL MCUs use the same startup code, the details are
+          governed by defines
+        }
+        {$i start.inc}
+      end;
+
+end.
+