Help with error 159 and error 16

Help
Jonoe
2009-03-26
2013-03-12
  • Jonoe
    Jonoe
    2009-03-26

    Hello,

    I am new with sdcc and I can't find a solution for these errors.

    Error 159: in function write_register: name omitted for parameter 2
    error 16: variable ´_write_register_PARM_2' must be static to have storage class in reentrant function

    I am trying to write a function with 2 parameters which uses the parameters that I passed it. What should I do?

    Thanks and regards

     
    • aozima
      aozima
      2009-03-26

      can you write you code here?

       
      • Jonoe
        Jonoe
        2009-03-26

        This is my code:

        void write_register(BYTE register_name, BYTE data)
        {
            register_name &=0x3F;
            BYTE x;
            x=data;
           
            SSN=LOW;
            spi_transfer(register_name);
           
            spi_transfer(x);
            SSN=HIGH;
        }   

        main.c:155: parse error: token -> 'BYTE' ; column 5
        main.c:156: parse error: token -> 'data' ; column 7
        main.c:163: error 159: in function write_register: name omitted for parameter 2
        main.c:163: error 16: variable '_write_register_PARM_2' must be static to have storage class in reentrant function

         
        • Patryk
          Patryk
          2009-03-26

          BYTE is not defined. You should define like this before using:
          typedef unsigned char BYTE;

          'data' is reserved keyword in SDCC: change second parameter name (to 'value' for example).

           
    • Maarten Brock
      Maarten Brock
      2009-03-26

      I would fix the first error first. Apparently you did not define BYTE.
      Next 'data' is a reserved keyword for SDCC for some targets unless --std-c89 or --std-c99 is used.
      Finally you might have missed --stack-auto while compiling one of your source files.

       
    • Jonoe
      Jonoe
      2009-03-26

      Thanks!

      It seems to work properly now