This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

about "a C program calling an assembly routine"problem

The C code is:

#pragma SRC
#include<Reg936.h>
#define uchar unsigned char
#define uint unsigned int
extern uchar AA1;
extern uchar a_func(uchar)
void main()
 {
  unsigned char ab,acd;
  AA1=0xff;
 P0M1=0xff;
 P0M2=0xff;
        ab=1;
        acd=128;
 while(1)
   {
     if(ab==128)
      {
           P0=~acd;
           ab=128;
           acd/=2;
    a_func(acd);
          }
         if(acd==128)
         {
          P0=~ab;
          acd=128;
          ab*=2;
   a_func(ab/2);
          }
         if((ab==128)&&(acd==1))
          {
          ab=1;
          acd=128;
         }
        }
}

when i press the "build target",and disappear the error:

C51 FATAL-ERROR -
  ACTION:  PARSING INVOKE-/#PRAGMA-LINE
  LINE:    #pragma SRC
  ERROR:   RESPECIFIED OR CONFLICTING CONTROL


how to deal with the error?

Parents
  • Yes,the ASM section in another file,and the name is mixx.asm,the code is:

    NAME  MIX
    ?PR?_a_func?MIX   SEGMENT CODE
    ?DT?_a_func?MIX   SEGMENT DATA OVERLAYABLE
    ?DT?MIX           SEGMENT DATA
    
    PUBLIC AA1
    PUBLIC ?_a_func?BYTE
    PUBLIC _a_func
    RSEG ?DT?_a_func?MIX
    ?_a_func?BYTE:
       BB1:DS 1
    RSEG ?DT?MIX
       AA1:DS 1
    RSEG ?PR?_a_func?MIX
     _a_func:
       mov a,AA1
    az:mov r6,#40
    cd:mov r5,#0
       djnz r5,$
       djnz r6,cd
       djnz r7,az
       ret
       end
    


    When I checke 'Generate SRC File' ,and also appear the error:

      C51 FATAL-ERROR -
      ACTION:  PARSING INVOKE-/#PRAGMA-LINE
      LINE:    #pragma SRC
      ERROR:   RESPECIFIED OR CONFLICTING CONTROL
    


    I want to know which settings I should do.Is there any example?

Reply
  • Yes,the ASM section in another file,and the name is mixx.asm,the code is:

    NAME  MIX
    ?PR?_a_func?MIX   SEGMENT CODE
    ?DT?_a_func?MIX   SEGMENT DATA OVERLAYABLE
    ?DT?MIX           SEGMENT DATA
    
    PUBLIC AA1
    PUBLIC ?_a_func?BYTE
    PUBLIC _a_func
    RSEG ?DT?_a_func?MIX
    ?_a_func?BYTE:
       BB1:DS 1
    RSEG ?DT?MIX
       AA1:DS 1
    RSEG ?PR?_a_func?MIX
     _a_func:
       mov a,AA1
    az:mov r6,#40
    cd:mov r5,#0
       djnz r5,$
       djnz r6,cd
       djnz r7,az
       ret
       end
    


    When I checke 'Generate SRC File' ,and also appear the error:

      C51 FATAL-ERROR -
      ACTION:  PARSING INVOKE-/#PRAGMA-LINE
      LINE:    #pragma SRC
      ERROR:   RESPECIFIED OR CONFLICTING CONTROL
    


    I want to know which settings I should do.Is there any example?

Children