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
  • those "RAM" locations seem to access de C:0000 external code area.

    No, they're accessing the X:0000 RAM area, exactly as the map file says.

    The architecture is sharing the bus for code and data.

    No, "the architecture" most definitely doesn't do that. Your particular circuit may be wired that way, but that's rather unusual for an 8051 --- why would anyone want to waste address space like that?

    don't know exactly the compiler/linker options I have to check to ensure that this linking is correct.

    You'll have to completely disallow X:0000 .. X:7fff. See your linker settings.

Reply
  • those "RAM" locations seem to access de C:0000 external code area.

    No, they're accessing the X:0000 RAM area, exactly as the map file says.

    The architecture is sharing the bus for code and data.

    No, "the architecture" most definitely doesn't do that. Your particular circuit may be wired that way, but that's rather unusual for an 8051 --- why would anyone want to waste address space like that?

    don't know exactly the compiler/linker options I have to check to ensure that this linking is correct.

    You'll have to completely disallow X:0000 .. X:7fff. See your linker settings.

Children
More questions in this forum