Menu

MCS-51 project without intrins.h

Help
Mian Qi
2023-11-17
2023-12-08
  • Mian Qi

    Mian Qi - 2023-11-17

    I tried mcs-51 project on Ubuntu through VMware, when compiled, it prompted lack of intrins.h, I added one, there was still some error, how to fix this?

    my intrins.h:

    #ifndef __INTRINS_H__
    #define __INTRINS_H__
    
    
    extern void          _nop_     (void);
    //extern bit           _testbit_ (bit);
    extern unsigned char _cror_    (unsigned char, unsigned char);
    extern unsigned int  _iror_    (unsigned int,  unsigned char);
    extern unsigned long _lror_    (unsigned long, unsigned char);
    extern unsigned char _crol_    (unsigned char, unsigned char);
    extern unsigned int  _irol_    (unsigned int,  unsigned char);
    extern unsigned long _lrol_    (unsigned long, unsigned char);
    extern unsigned char _chkfloat_(float);
    

    I want a function like "cror" in keil, is there any function list in sdcc?

     

    Last edit: Mian Qi 2023-11-21
    • Philipp Klaus Krause

      Can you provide any additional information? What is this "mcs-51 project" you are trying to compile? Code written for a different compiler,m such as Keil? Code written for an older SDCC?
      What should that _cror_ function do? From the name and declaration, I guess it might rotate an unsigned char to the right?

      Which version of SDCC are you using?

      I guess you could just implement the function, e.g.

      unsigned char _cror_ (unsigned char x, unsigned char r)
      {
         return ((x >> r) | (x << (8 - r)));
      }
      

      However, there are more efficient alternatives (inline function instead of extern), especially if at function calls, the second parameter often is a constant.

       

Log in to post a comment.