<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I remember seeing the problem that gdb does not correctly
    disassemble code...<br>
    <br>
    Please do a <br>
    <br>
     arm-none-eabi-readelf -A xxx.elf<br>
    <br>
    you should see:<br>
    <br>
    File Attributes<br>
      Tag_CPU_name: "7-M"<br>
      Tag_CPU_arch: v7<br>
      Tag_CPU_arch_profile: Microcontroller<br>
      Tag_THUMB_ISA_use: <b>Thumb-2</b><br>
    <br>
    Compiling, linking and running is fine for me, difference in setup
    is that I use another processor (stm32f407) and that I used trunk
    sources to compile the crosscompiler.<br>
    But as Jeppe already mentioned, this all should have worked fine
    with 2.6.4 version too.<br>
    <br>
    And your commandline you used for both creating the crosscompiler /
    build the program is exactly the same I use.<br>
    <br>
    Michael<br>
    <br>
    <div class="moz-cite-prefix">Am 23.10.14 um 20:15 schrieb Sietse
      Achterop:<br>
    </div>
    <blockquote cite="mid:544945DA.9060705@rug.nl" type="cite">  Hello,
      <br>
      I am trying to get the embedded version of fpc for arm to work.
      <br>
      Currently i try it for the lpc1768 from NXP using the lpcxpresso
      board.
      <br>
      The example compiles, but doesn't run on the target...
      <br>
      <br>
      I created a simple example and it seems that the code it generates
      is NOT thumb2 code.
      <br>
      I disassembled the elf-file generated by fpc using
      "arm-none-eabi-objdump -S"
      <br>
      I also disassembled it using the debugger "arm-none-eabi-gdb"
      <br>
      Here is a fragment of the code from both:
      <br>
      <br>
      From objdump:
      <br>
      000001c4 <FPC_INITIALIZEUNITS>:
      <br>
       1c4:    e92d4070     push    {r4, r5, r6, lr}
      <br>
       1c8:    ebfffff5     bl    1a4 <SYSTEM_$$_FPC_CPUINIT>
      <br>
       1cc:    e59f006c     ldr    r0, [pc, #108]    ; 240
      <FPC_INITIALIZEUNITS+0x7c>
      <br>
       1d0:    e5904000     ldr    r4, [r0]
      <br>
       1d4:    e3a05001     mov    r5, #1
      <br>
       1d8:    e1540005     cmp    r4, r5
      <br>
       1dc:    ba00000f     blt    220 <FPC_INITIALIZEUNITS+0x5c>
      <br>
      <br>
      From gdb
      <br>
         0x000001c4 <fpc_initializeunits+0>:        70 40
      eors             r0, r6
      <br>
         0x000001c6 <fpc_initializeunits+2>:        2d e9 f5
      ff             stmdb    sp!, {r0, r2, r4, r5, r6, r7, r8, r9, r10,
      r11, r12, sp, lr, pc}
      <br>
      => 0x000001ca <fpc_initializeunits+6>:        ff eb 6c
      00                          ; <UNDEFINED> instruction:
      0xebff006c
      <br>
         0x000001ce <fpc_initializeunits+10>:        9f e5
      b.n                     0xfffffd10
      <br>
         0x000001d0 <fpc_initializeunits+12>:        00 40
      ands                     r0, r0
      <br>
         0x000001d2 <fpc_initializeunits+14>:        90 e5
      b.n                     0xfffffcf6
      <br>
         0x000001d4 <fpc_initializeunits+16>:        01 50
      str                     r1, [r0, r0]
      <br>
         0x000001d6 <fpc_initializeunits+18>:        a0 e3
      b.n                     0x91a
      <br>
         0x000001d8 <fpc_initializeunits+20>:        05 00
      movs                     r5, r0
      <br>
         0x000001da <fpc_initializeunits+22>:        54 e1
      b.n                     0x486
      <br>
         0x000001dc <fpc_initializeunits+24>:        0f 00
      movs                     r7, r1
      <br>
      <br>
      Note how the interpretation of the code is different, as is the
      length of most instructions.
      <br>
      It looks to me as if the code in the elf-file are (mostly) 32-bit
      values, while the debugger does interpret thee code as thumb2 (i
      think).
      <br>
      <br>
      In the Makefile in rtl/embedded I find:
      <br>
      <br>
          ifeq ($(SUBARCH),armv7m)
      <br>
          CPU_UNITS=lm3fury lm3tempest stm32f10x_ld stm32f10x_md
      stm32f10x_hd stm32f10x_xl stm32f10x_conn stm32f10x_cl lpc13xx
      lpc1768 lm4f120  xmc4500 cortexm3 cortexm4 # thumb2_bare
      <br>
          endif
      <br>
      <br>
      So that suggest (via the comment) that fpc can do thumb2 code,
      which it should for cortexm3.
      <br>
      <br>
      My PC is debian/jessie/64bit:  Free Pascal Compiler version
      2.6.4+dfsg-3 [2014/07/12] for x86_64
      <br>
      I got the sourcecode for the port from svn as described on the
      website.
      <br>
      To create the port I do:
      <br>
      <br>
          make clean buildbase installbase CROSSINSTALL=1
      OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7m  
      BINUTILSPREFIX=arm-none-eabi-
      <br>
      <br>
      For the binutils I use the (current) stuff for the lpc1768 from
      NXP: lpcxpresso_7.4.0_229
      <br>
      <br>
      To create a program I do:
      <br>
      <br>
          ppcrossarm -Ch1024 -Cs1024 -Tembedded -Parm -Cparmv7m
      -XParm-none-eabi- -Wplpc1768 -vu prog.p
      <br>
      <br>
      Is there anybody that did get this port to work?
      <br>
      <br>
        Thanks in advance,
      <br>
             Sietse
      <br>
      <br>
      <br>
      <br>
      _______________________________________________
      <br>
      fpc-devel maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
      <br>
      <a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
      <br>
    </blockquote>
    <br>
  </body>
</html>