Shop OBEX P1 Docs P2 Docs Learn Events
PASM source listing — Parallax Forums

PASM source listing

pedwardpedward Posts: 1,642
edited 2012-06-12 19:36 in Propeller 1
I was looking at the ASM listing that is generated for human use, and it wasn't annotated, so I made some changes to SimpleIDE and hello.c generates this now:

Would you like me to commit this change?
    1                      .text
    2                  .Ltext0
    3                      .data
    4                      .balign    4
    5                  .LC0
    6 0000 48656C6C         .ascii "Hello World\0"
    6      6F20576F 
    6      726C6400 
    7                      .balign    4
    8                  .LC3
    9 000c 48656C6C         .ascii "Hello World %d\12\0"
    9      6F20576F 
    9      726C6420 
    9      25640A00 
   10                      .text
   11                      .balign    4
   12                      .global    _main
   13                  _main
   14                  .LFB0
   15                      .file 1 "hello.c"
    1:hello.c       **** /*
    2:hello.c       ****  * This demo uses waitcnt instead of sleep so it will fit in a COG.
    3:hello.c       ****  * It also repeats printing every 200ms and prints the iteration.
    4:hello.c       ****  * Some computers may not be fast enough for the terminal to catch
    5:hello.c       ****  * the serial input after loading the Propeller, so you may not see
    6:hello.c       ****  * "Hello World 1", but you will see something on the terminal.
    7:hello.c       ****  */
    8:hello.c       **** #include <stdio.h>
    9:hello.c       **** #include <propeller.h>
   10:hello.c       **** 
   11:hello.c       **** int main(void)
   12:hello.c       **** {
   16                      .loc 1 12 0
   17 0000 0400FC84         sub    sp, #4
   18                  .LCFI0
   19 0004 00003C08         wrlong    r8, sp
   20                  .LCFI1
   21 0008 0400FC84         sub    sp, #4
   22                  .LCFI2
   23 000c 00003C08         wrlong    r14, sp
   24                  .LCFI3
   25 0010 0400FC84         sub    sp, #4
   26                  .LCFI4
   27 0014 00003C08         wrlong    lr, sp
   28                  .LCFI5
   29 0018 0000BCA0         mov    r14, sp
   30                  .LCFI6
   31 001c 1400FC84         sub    sp, #20
   32                  .LCFI7
   13:hello.c       ****     long long n = 1;
   33                      .loc 1 13 0
   34 0020 0100FCA0         mov    r6, #1
   35 0024 0000BCA0         mov    r7, r14
   36 0028 0800FC84         sub    r7, #8
   37 002c 00003C08         wrlong    r6, r7
   38 0030 0000BCA0         mov    r7, r14
   39 0034 0400FC84         sub    r7, #4
   40 0038 0000FCA0         mov    r6, #0
   41 003c 00003C08         wrlong    r6, r7
   14:hello.c       ****     printf("Hello World\n");
   42                      .loc 1 14 0
   43 0040 4300BCA0         mov    r7, .LC1
   44 0044 0000BCA0         mov    r0, r7
   45 0048 0000FC5C         jmpret    lr,#_puts
   46                  .L2
   15:hello.c       ****     while(1) {
   16:hello.c       ****         waitcnt(CLKFREQ/10+CNT);
   47                      .loc 1 16 0 discriminator 1
   48 004c 4400BCA0         mov    r7, .LC2
   49 0050 0000BC08         rdlong    r7, r7
   50 0054 0000BCA0         mov    r0, r7
   51 0058 0A00FCA0         mov    r1, #10
   52 005c 0000FC5C         call    #__UDIVSI
   53 0060 0000BCA0         mov    r7, r0
   54 0064 0000BCA0         mov    r6, r7
   55 0068 0000BCA0         mov    r7, CNT
   56 006c 0000BC80         add    r7, r6
   57 0070 0000FCF8         waitcnt    r7,#0
   17:hello.c       ****         printf("Hello World %d\n", n);
   58                      .loc 1 17 0 discriminator 1
   59 0074 008A3C08         wrlong    .LC4, sp
   60 0078 0000BCA0         mov    r7, sp
   61 007c 0400FC80         add    r7, #4
   62 0080 0000BCA0         mov    r6, r14
   63 0084 0800FC84         sub    r6, #8
   64 0088 0000BC08         rdlong    r6, r6
   65 008c 00003C08         wrlong    r6, r7
   66 0090 0400FC80         add    r7, #4
   67 0094 0000BCA0         mov    r6, r14
   68 0098 0400FC84         sub    r6, #4
   69 009c 0000BC08         rdlong    r6, r6
   70 00a0 00003C08         wrlong    r6, r7
   71 00a4 0000FC5C         jmpret    lr,#_printf
   18:hello.c       ****         n++;
   72                      .loc 1 18 0 discriminator 1
   73 00a8 0000BCA0         mov    r7, r14
   74 00ac 0800FC84         sub    r7, #8
   75 00b0 0000BC08         rdlong    r5, r7
   76 00b4 0000BCA0         mov    r7, r14
   77 00b8 0400FC84         sub    r7, #4
   78 00bc 0000BC08         rdlong    r6, r7
   79 00c0 0100FCA0         mov    r3, #1
   80 00c4 0000FCA0         mov    r4, #0
   81 00c8 0000BCA0         mov    r7, r5
   82 00cc 0000BC80         add    r7, r3
   83 00d0 00003C85         cmp    r7, r5 wc
   84 00d4 0000FCA0         mov    r2, #0
   85 00d8 0100FC70         muxc    r2,#1
   86 00dc 0000BCA0         mov    r8, r6
   87 00e0 0000BC80         add    r8, r4
   88 00e4 0000BCA0         mov    r6, r2
   89 00e8 0000BC80         add    r6, r8
   90 00ec 0000BCA0         mov    r8, r6
   91 00f0 0000BCA0         mov    r6, r14
   92 00f4 0800FC84         sub    r6, #8
   93 00f8 00003C08         wrlong    r7, r6
   94 00fc 0000BCA0         mov    r6, r14
   95 0100 0400FC84         sub    r6, #4
   96 0104 00003C08         wrlong    r8, r6
   19:hello.c       ****     }
   97                      .loc 1 19 0 discriminator 1

   98 0108 13007C5C         jmp    #.L2
   99                  .LFE0
  100                      .balign    4
  101                  .LC1
  102 010c 00000000         long    .LC0
  103                      .balign    4
  104                  .LC2
  105 0110 00000000         long    __clkfreq
  106                      .balign    4
  107                  .LC4
  108 0114 0C000000         long    .LC3
  158                  .Letext0
  159                      .file 2 "/opt/parallax/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/includ

Comments

  • Dave HeinDave Hein Posts: 6,347
    edited 2012-06-12 05:14
    Can you make the annotation conditional on a comman-line parameter? Or is there a seperate file that doesn't contain the annotation?
  • jazzedjazzed Posts: 11,803
    edited 2012-06-12 06:37
    pedward wrote: »
    I was looking at the ASM listing that is generated for human use, and it wasn't annotated, so I made some changes to SimpleIDE and hello.c generates this now:

    Would you like me to commit this change?


    Sweet. Post a diff to review.

    Thanks,
    --Steve
  • pedwardpedward Posts: 1,642
    edited 2012-06-12 12:54
    diff -r c52aa38c81e7 propside/mainwindow.cpp
    --- a/propside/mainwindow.cpp    Fri Jun 08 10:22:53 2012 -0700
    +++ b/propside/mainwindow.cpp    Tue Jun 12 12:54:00 2012 -0700
    @@ -3674,10 +3674,12 @@
             compstr+="c++"; 
         } 
      
    +    removeArg(args,"-S"); 
         removeArg(args,"-o"); 
         removeArg(args,"a.out"); 
    -    args.insert(0,name+SHOW_ASM_EXTENTION); 
    -    args.insert(0,"-o"); 
    +    args.insert(0,"-Wa,-ahdnl="+name+SHOW_ASM_EXTENTION); 
    +    args.insert(0,"-c"); 
    +    args.insert(0,"-g"); 
      
         /* this is the final compile/link */ 
         compileStatus->setPlainText(""); 
    
    
  • jazzedjazzed Posts: 11,803
    edited 2012-06-12 18:57
    Dave Hein wrote: »
    Can you make the annotation conditional on a comman-line parameter? Or is there a seperate file that doesn't contain the annotation?

    Hi Dave,

    The SimpleIDE is generating .asm files for the listings when the user asks for "Show Assembly" from the project manager.
    I've also added "Show Map File" for the main program file and looking at usage, etc....

    Thanks,
    --Steve
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-06-12 19:36
    I hadn't made the connection that this was generated from SIDE when I posted my comment this morning. The annotated format should be very useful.
Sign In or Register to comment.