Topic : Lack of Overlays in Data Memory (Raisonance Compiler & Linker)

Forum : ST7/STM8

Original Post
Post Information Post
July 9, 2007 - 7:37pm
Guest

I am using RIDE 2.1.1 to program an ST72264 MCU. I have used the Rbuilder to generate most of the C code framework. I am using SPI, I2C, WDG, IO, and MCC peripherals. I have barely started to program and have run into a linker error that indicates I am out of data memory (Error 107 : Address Space Overflow -Segment: ?DT?SPI(SPI)). I have confirmed this by increasing the data memory and seeing that it links successfully (also indicating in the map report that it needs 3 more bytes than was originally specified).

That led me to look at the map report to see how the memory was being used. This showed only 5 bytes of overlaid data memory, spanning only 4 functions and 2 modules. This seems pretty inefficient to me and likely to cause problems. I have included the data memory map below (with invoke info).

INVOKED BY:
RLST7 
C:\TEMP\CODING\IO.OBJ,C:\TEMP\CODING\MCC.OBJ,C:\TEMP\CODING\ITC.OBJ,C:\TEMP\CODING\WDG.OBJ,C:\TEMP\CODING\I2C.OBJ,C:\TEMP\CODING\SPI.OBJ 
,"C:\TEMP\CODING\CHASE LIGHTMAIN.OBJ","C:\TEMP\CODING\CHASE LIGHTINT.OBJ",C:\TEMP\CODING\STSERIALFLASH.OBJ 
TO("C:\TEMP\CODING\CHASE LIGHT.AOF") CODESIZE(02000H) RAMSIZE(0200H) 
DATASTART(080H) STACKSIZE(080H) LIBPATH(C:\RIDE\LIB\ST7) 
PR("C:\TEMP\CODING\CHASE LIGHT.MS7") IX SCINAME(ST72264) 
 WITHOUT ANY FLOATING POINT ARITHMETIC

(snip)

LINK MAP OF MODULE: C:\TEMP\CODING\CHASE LIGHT.AOF (IO)
   TYPE     BASE         LENGTH     RELOCATION      SEGMENT NAME
   ----     ----         ------     ----------      ------------
   * * * * * * * *   D A T A       M E M O R Y   * * * * * * * *
   DATA     0080H        0007H      PAGE0           ?D0?IO_Input?IO
   DATA     0087H        0005H      PAGE0           ?D0?IO_Output?IO
   DATA     008CH        0002H      PAGE0           ?D0?IO_Read?IO
   DATA     008EH        0002H      PAGE0           ?D0?IO_ByteWrite?IO
   DATA     0090H        0002H      PAGE0           ?D0?MCC_SlowMode?MCC
   DATA     0092H        0005H      PAGE0           ?D0?ITC_GetPriority?ITC
   DATA     0097H        0003H      PAGE0           ?D0?ITC_ConfigureInterrupt?ITC
   DATA     009AH        0009H      PAGE0           ?D0?WDG_ComputeTimeout?WDG
   DATA     00A3H        0003H      PAGE0           ?D0?I2C_PutString?I2C
   DATA     00A6H        0006H      PAGE0           ?D0?I2C_PutBuffer?I2C
   DATA     00ACH        0002H      PAGE0           ?D0?I2C_IsTransmitCompleted?I2C
   DATA     00AEH        0005H      PAGE0           ?D0?I2C_GetBuffer?I2C
   DATA     00B3H        0002H      PAGE0           ?D0?I2C_IsReceptionCompleted?I2C
   DATA     00B5H        0002H      PAGE0           ?D0?SPI_Init?SPI
   DATA     00B7H        0001H      PAGE0           ?D0?SPI_Clear_Flags?SPI
   DATA     00B8H        0007H      PAGE0           ?D0?SPI_PutBuffer?SPI
   DATA     00BFH        0006H      PAGE0           ?D0?SPI_PutString?SPI
            00C5H        0004H      OVERLAID GROUP  *** 
   DATA     00C5H        0004H      -------------   ?D0?IO_Write?IO
   DATA     00C5H        0001H      -------------   ?D0?SPI_IsReceptionCompleted?SPI
   DATA     00C5H        0001H      -------------   ?D0?SPI_GetBuffer?SPI
   DATA     00C5H        0001H      -------------   ?D0?SPI_IsTransmitCompleted?SPI
   DATA     00C9H        0005H      PAGE0           ?D0?main?CHASE LIGHTMAIN
   DATA     00CEH        0003H      PAGE0           ?D0?STSerFlash_WriteEnable?STSERIALFLASH
   DATA     00D1H        0003H      PAGE0           ?D0?STSerFlash_WriteDisable?STSERIALFLASH
   DATA     00D4H        0004H      PAGE0           ?D0?STSerFlash_ReadID?STSERIALFLASH
   DATA     00D8H        0008H      PAGE0           ?D0?STSerFlash_CmdRead?STSERIALFLASH
   DATA     00E0H        0006H      PAGE0           ?D0?STSerFlash_ReadStat1x?STSERIALFLASH
   DATA     00E6H        0004H      PAGE0           SEG_REGISTERS
   DATA     00EAH        0002H      INSECTION       ?DT?ITC
   DATA     00ECH        000BH      INSECTION       ?DT?I2C
   DATA     00F7H        000CH      INSECTION       ?DT?SPI
            0103H        007DH                       *** GAP ***
   DATA     0180H        0080H      UNIT            ?C_STACK?SEG

(snip)

EXECUTABLE SUMMARY:
-------------------
    Total EEPROM storage requirement:  0000H (0)
    Total DATA storage requirement:  0103H (259)
    Total CODE storage requirement:  0EB1H (3761)

REFERENCE MAP OF MODULE: C:\TEMP\CODING\CHASE LIGHT.AOF (CHASE LIGHT)

SEGMENT
   +-->CALLED SEGMENT
---------------------
?PR?IO_Input?IO
   +-->?PR?IO

?PR?IO_Output?IO
   +-->?PR?IO

?PR?IO_Read?IO
   +-->?PR?IO

?PR?IO_Write?IO
   +-->?PR?IO

?PR?IO_ByteWrite?IO
   +-->?PR?IO

?PR?ITC_GetPriority?ITC
   +-->CSTDLIB
   +-->CSTDLIB

?PR?WDG_ComputeTimeout?WDG
   +-->CSTDLIB
   +-->CSTDLIB
   +-->CSTDLIB
   +-->CSTDLIB
   +-->CSTDLIB
   +-->CSTDLIB

?PR?SPI_Init?SPI
   +-->?PR?SPI_Clear_Flags?SPI

?PR?STSerFlash_WriteEnable?STSERIALFLASH
   +-->?PR?SPI_IsTransmitCompleted?SPI
   +-->?PR?SPI_PutByte?SPI
   +-->?PR?IO_Write?IO

?PR?STSerFlash_WriteDisable?STSERIALFLASH
   +-->?PR?SPI_IsTransmitCompleted?SPI
   +-->?PR?SPI_PutByte?SPI
   +-->?PR?IO_Write?IO

?PR?STSerFlash_CmdRead?STSERIALFLASH
   +-->?PR?SPI_IsReceptionCompleted?SPI
   +-->?PR?SPI_GetBuffer?SPI
   +-->?PR?SPI_IsTransmitCompleted?SPI
   +-->?PR?SPI_PutByte?SPI
   +-->?PR?IO_Write?IO

?PR?STSerFlash_ReadID?STSERIALFLASH
   +-->?PR?STSerFlash_CmdRead?STSERIALFLASH

?PR?STSerFlash_ReadStat1x?STSERIALFLASH
   +-->?PR?SPI_IsReceptionCompleted?SPI
   +-->?PR?SPI_GetBuffer?SPI
   +-->?PR?SPI_IsTransmitCompleted?SPI
   +-->?PR?SPI_PutByte?SPI
   +-->?PR?IO_Write?IO

I know that SPI.c, ITC.c, and I2C.c have global variables, which cannot be overlaid. These seem to be accounted for by the ?DT? segments.

IO.c functions contain volatile local variables (reason unknown), whch could interfere with overlay on that data. However, this doesn't explain the rest of the segments. It seems that there are a lot of basic local variables that could share memory space.

Any suggestions on this would be greatly appreciated. If more info is needed, let me know.

Thanks in advance,
Torrey