Răsfoiți Sursa

+ added an embedded target for the 6502

Nikolay Nikolov 1 an în urmă
părinte
comite
5395382a79

+ 4 - 2
compiler/systems.inc

@@ -59,7 +59,8 @@
              cpu_z80,                      { 22 }
              cpu_mips64,                   { 23 }
              cpu_mips64el,                 { 24 }
-             cpu_loongarch64               { 25 }
+             cpu_loongarch64,              { 25 }
+             cpu_mos6502                   { 26 }
        );
 
        tasmmode= (asmmode_none
@@ -217,7 +218,8 @@
              system_m68k_human68k,      { 122 }
              system_mipsel_ps1,         { 123 }
              system_wasm32_wasip1threads,{ 124 }
-             system_wasm32_wasip2       { 125 }
+             system_wasm32_wasip2,      { 125 }
+             system_mos6502_embedded    { 126 }
        );
 
      type

+ 5 - 1
compiler/systems.pas

@@ -491,7 +491,7 @@ interface
             ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
              'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm', 'i8086',
              'aarch64', 'wasm32', 'sparc64', 'riscv32', 'riscv64', 'xtensa',
-             'z80', 'mips64', 'mips64el', 'loongarch64');
+             'z80', 'mips64', 'mips64el', 'loongarch64', 'mos6502');
 
        abiinfo : array[tabi] of tabiinfo = (
          (name: 'DEFAULT'; supported: true),
@@ -1231,6 +1231,10 @@ begin
 {$ifdef loongarch64}
   default_target(system_loongarch64_linux);
 {$endif loongarch64}
+
+{$ifdef mos6502}
+  default_target(system_mos6502_embedded);
+{$endif mos6502}
 end;
 
 

+ 73 - 0
compiler/systems/i_embed.pas

@@ -851,6 +851,74 @@ unit i_embed;
             llvmdatalayout : 'todo';
           );
 
+       system_mos6502_embedded_info : tsysteminfo =
+          (
+            system       : system_mos6502_embedded;
+            name         : 'Embedded';
+            shortname    : 'Embedded';
+            flags        : [tf_needs_symbol_size,tf_files_case_sensitive,
+                            tf_smartlink_library,
+                            tf_no_objectfiles_when_smartlinking];
+            cpu          : cpu_mos6502;
+            unit_env     : '';
+            extradefines : '';
+            exeext       : '';
+            defext       : '.def';
+            scriptext    : '.sh';
+            smartext     : '.sl';
+            unitext      : '.ppu';
+            unitlibext   : '.ppl';
+            asmext       : '.s';
+            objext       : '.rel';
+            resext       : '.res';
+            resobjext    : '.or';
+            sharedlibext : '.so';
+            staticlibext : '.a';
+            staticlibprefix : 'libp';
+            sharedlibprefix : 'lib';
+            sharedClibext : '.so';
+            staticClibext : '.a';
+            staticClibprefix : 'lib';
+            sharedClibprefix : 'lib';
+            importlibprefix : 'libimp';
+            importlibext : '.a';
+            Cprefix      : '';
+            newline      : #10;
+            dirsep       : '/';
+            assem        : as_sdcc_sdas6500;
+            assemextern  : as_sdcc_sdas6500;
+            link         : ld_none;
+            linkextern   : ld_embedded;
+            ar           : ar_sdcc_sdar;
+            res          : res_none;
+            dbg          : dbg_dwarf2;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign            : 1;
+                loopalign            : 1;
+                jumpalign            : 0;
+                jumpalignskipmax     : 0;
+                coalescealign        : 0;
+                coalescealignskipmax : 0;
+                constalignmin        : 0;
+                constalignmax        : 1;
+                varalignmin          : 0;
+                varalignmax          : 1;
+                localalignmin        : 0;
+                localalignmax        : 1;
+                recordalignmin       : 0;
+                recordalignmax       : 1;
+                maxCrecordalign      : 1
+              );
+            first_parm_offset : 4;
+            stacksize    : 1024;
+            stackalign   : 1;
+            abi : abi_default;
+            llvmdatalayout : 'todo';
+          );
+
        system_wasm32_embedded_info : tsysteminfo =
           (
             system       : system_wasm32_embedded;
@@ -985,5 +1053,10 @@ initialization
     set_source_info(system_z80_embedded_info);
   {$endif embedded}
 {$endif CPUZ80}
+{$ifdef CPUMOS6502}
+  {$ifdef embedded}
+    set_source_info(system_mos6502_embedded_info);
+  {$endif embedded}
+{$endif CPUMOS6502}
 end.
 

+ 5 - 0
compiler/systems/t_embed.pas

@@ -2379,4 +2379,9 @@ initialization
   RegisterExport(system_wasm32_embedded, texportlibwasi);
   RegisterLinker(ld_embedded, TLinkerEmbedded_Wasm);
 {$endif wasm32}
+
+{$ifdef mos6502}
+  RegisterLinker(ld_embedded,TlinkerEmbedded_SdccSdld);
+  RegisterTarget(system_mos6502_embedded_info);
+{$endif mos6502}
 end.