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

c51: xdata RAM starting at 0x8000 and reentrant

Hello,

Im porting our code to a "8051" harware architecture where the external CODE is placed from 0x0000 to 0x7fff. XDATA RAM is placed from 0x8000 to 0x83ff. I have to use reentrant functions. Program is crashing when entering reentrant functions and having a look into the m51 listing, I realized that local variables ar linked as follows, for instance:

  C:113AH         PUBLIC        _?Sum2EfitoRMS

  -------         PROC          _?SUM2EFITORMS

  x:0021H         SYMBOL        au16Sum2Efi

  -------         DO

  x:0000H         SYMBOL        u32resultado
  x:0004H         SYMBOL        u32auxiliar
  x:0008H         SYMBOL        u32mascara
  x:000CH         SYMBOL        u32auxa

those "RAM" locations seem to access de C:0000 external code area. The architecture is sharing the bus for code and data. Anyway, there's no RAM in those external adresses.

Non-reentrant functions seems to link local variables in the right place:


  -------         PROC          _SCREEN_METER

  X:8027H         SYMBOL        obis
  X:802BH         SYMBOL        valor
  X:802FH         SYMBOL        tarifa

right into the _XDATA_GROUP_

Please a would thank any idea, I don't know exactly the compiler/linker options I have to check to ensure that this linking is correct.

Thanks in advance,

S.

Parents
  • Hans and Andy, thank you very much for your help,

    well the problem has been solved, but had nothing to do with the question that I posted, sorry.

    The XBPSTACKTOP location was defined out of bounds in Startup, so of course any reentrant function was crashing.

    the "m51" listing is confusing, I mean, I was confused with the lowercase "x:0000" notation and the uppercase "X:0000". The last one mean, yes XDATA, and the location written beside is exactly the address assigned to the variable.
    In the lowercase "x", variables are located also in the XDATA, but withing the stack. The linker doen't know the right location in link-time, doesn't know the top of stack, so that's the result.

    Anyway thank you again for your time

    Regards,

    S.

Reply
  • Hans and Andy, thank you very much for your help,

    well the problem has been solved, but had nothing to do with the question that I posted, sorry.

    The XBPSTACKTOP location was defined out of bounds in Startup, so of course any reentrant function was crashing.

    the "m51" listing is confusing, I mean, I was confused with the lowercase "x:0000" notation and the uppercase "X:0000". The last one mean, yes XDATA, and the location written beside is exactly the address assigned to the variable.
    In the lowercase "x", variables are located also in the XDATA, but withing the stack. The linker doen't know the right location in link-time, doesn't know the top of stack, so that's the result.

    Anyway thank you again for your time

    Regards,

    S.

Children
No data