瀏覽代碼

+ added some AT91SAM7 controllers
* improved linker script for arm-embedded

git-svn-id: trunk@13292 -

florian 16 年之前
父節點
當前提交
7a65b5c7a0
共有 2 個文件被更改,包括 73 次插入28 次删除
  1. 19 3
      compiler/arm/cpuinfo.pas
  2. 54 25
      compiler/systems/t_embed.pas

+ 19 - 3
compiler/arm/cpuinfo.pas

@@ -49,9 +49,17 @@ Type
 
    tcontrollertype =
      (ct_none,
+
+      { Phillips }
       ct_lpc2114,
       ct_lpc2124,
-      ct_lpc2194
+      ct_lpc2194,
+
+      { ATMEL }
+      ct_at91sam7s256,
+      ct_at91sam7se256,
+      ct_at91sam7x256,
+      ct_at91sam7xc256
      );
 
 Const
@@ -94,14 +102,22 @@ Const
      ('',
       'LPC2114',
       'LPC2124',
-      'LPC2194'
+      'LPC2194',
+      'AT91SAM7S256',
+      'AT91SAM7SE256',
+      'AT91SAM7X256',
+      'AT91SAM7XC256'
      );
 
    controllerunitstr : array[tcontrollertype] of string[20] =
      ('',
       'LPC21x4',
       'LPC21x4',
-      'LPC21x4'
+      'LPC21x4',
+      'AT91SAM7x256',
+      'AT91SAM7x256',
+      'AT91SAM7x256',
+      'AT91SAM7x256'
      );
 
 

+ 54 - 25
compiler/systems/t_embed.pas

@@ -224,32 +224,62 @@ begin
       with linkres do
         begin
           Add('ENTRY(_START)');
-          Add('SECTIONS');
+          Add('MEMORY');
           Add('{');
-          Add('     . = 0x0;  /* start of flash */');
-          Add('    /* code and constants */');
-          Add('    .text :');
-          Add('    {');
-          Add('    *(.init, .init.*)');
-          Add('    *(.text, .text.*)');
-          Add('    *(.strings)');
-          Add('    *(.rodata.*)');
-          Add('    *(.comment)');
-          Add('    }');
-          Add('    /* uninitialized data */');
-          Add('    . = 0x40000000;  /* start of ram */');
-          Add('    .bss :');
-          Add('    {');
-          Add('    *(.bss, .bss.*)');
-          Add('    *(COMMON)');
-          Add('    *(.data, .data.*)');
-          Add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
-          Add('    }');
+          Add('    flash : ORIGIN = 0, LENGTH = 128K');
+          Add('    ram : ORIGIN = 0x40000000, LENGTH = 4K');
           Add('}');
         end;
+      ct_at91sam7s256,
+      ct_at91sam7se256,
+      ct_at91sam7x256,
+      ct_at91sam7xc256:
+      with linkres do
+        begin
+          Add('ENTRY(_START)');
+          Add('MEMORY');
+          Add('{');
+          Add('    flash : ORIGIN = 0, LENGTH = 256K');
+          Add('    ram : ORIGIN = 0x200000, LENGTH = 64K');
+          Add('}');
+          Add('_stack_end = 0x20FFFC;');
+        end;
+
     else
       internalerror(200902011);
   end;
+
+  with linkres do
+    begin
+      Add('SECTIONS');
+      Add('{');
+      Add('     .text :');
+      Add('    {');
+      Add('    *(.init, .init.*)');
+      Add('    *(.text, .text.*)');
+      Add('    *(.strings)');
+      Add('    *(.rodata, .rodata.*)');
+      Add('    *(.comment)');
+      Add('    _etext = .;');
+      Add('    } >flash');
+      Add('    .data :');
+      Add('    {');
+      Add('    _data = .;');
+      Add('    *(.data, .data.*)');
+      Add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
+      Add('    _edata = .;');
+      Add('    } >ram AT >flash');
+      Add('    .bss :');
+      Add('    {');
+      Add('    _bss_start = .;');
+      Add('    *(.bss, .bss.*)');
+      Add('    *(COMMON)');
+      Add('    } >ram');
+      Add('. = ALIGN(4);');
+      Add('_bss_end = . ;');
+      Add('}');
+      Add('_end = .;');
+    end;
 {$endif ARM}
 
   { Write and Close response }
@@ -308,17 +338,16 @@ begin
   success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false);
 
 { Remove ReponseFile }
-  if (success) and not(cs_link_nolink in current_settings.globalswitches) then
+  if success and not(cs_link_nolink in current_settings.globalswitches) then
    DeleteFile(outputexedir+Info.ResName);
 
-{ Post process
+{ Post process }
   if success then
     begin
-      success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
+      success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O hex '+
         ChangeFileExt(current_module.exefilename^,'.elf')+' '+
-        current_module.exefilename^,true,false);
+        ChangeFileExt(current_module.exefilename^,'.hex'),true,false);
     end;
-}
 
   MakeExecutable:=success;   { otherwise a recursive call to link method }
 end;