Moving a 8051 project for EZUSB (Cypress FX2LP CY7C68013A) from SDCC version
2.3.8 to 2.7.0 encounted two linker problems:

1. wrongly counts the SFR space in the DATA memory size as a result
displayes "Insufficient space in data memory."
as\link\mcs51\lkmem.c line: 182

2. the program won't run if the start address of the code segment is
specified, the "_main" will be mapped to address 0x0000 instead of the "sdcc
statup function"
don't give "-b CSEG = 0x0000" for "aslink"


///////////////////////////// 1. SFR to DSEG bug //////////////////////

   Name             Start    End      Size     Max
   ---------------- -------- -------- -------- --------
   DATA             0x08     0xe5       222      128
   ---------------- -------- -------- -------- --------
   TOTAL:           0x00     0xe5       230      128
*** ERROR: Insufficient space in data memory.   102 bytes short.
Stack starts at: 0x6e (sp set to 0x6d).
*** ERROR: Stack overlaps area 'DATA'

//////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
as\link\mcs51\lkmem.c
line:182

/////////////////////
wrong:

        /*If is not a register bank, bit, stack, or idata, then it should be
data*/
        else if((xp->a_flag & (A_CODE|A_BIT|A_XDATA))==0)
        {
            if(xp->a_size)
            {
                Ram[6].Size+=xp->a_size;
                if(xp->a_addr<Ram[6].Start) Ram[6].Start=xp->a_addr;
            }
        }

/////////////////////
good (copied from version 2.4.0):

        else if ( EQ(xp->a_id, "DSEG") || EQ(xp->a_id, "OSEG") )
        {
            Ram[6].Size+=xp->a_size;
            if(xp->a_addr<Ram[6].Start) Ram[6].Start=xp->a_addr;
        }

//////////////////////////// 2. no CSEG for aslink
//////////////////////////

wrong:
Area                               Addr   Size   Decimal Bytes (Attributes)
--------------------------------   ----   ----   ------- ----- ------------
CSEG                               0000   1CA7 =   7335. bytes
(REL,CON,CODE)

      Value  Global
   --------  --------------------------------
  0C:0000    _main

good:
Area                               Addr   Size   Decimal Bytes (Attributes)
--------------------------------   ----   ----   ------- ----- ------------
CSEG                               00CC   1CA7 =   7335. bytes
(REL,CON,CODE)

      Value  Global
   --------  --------------------------------
  0C:00CC    _main


-- 
Kovacs Laszlo Attila
Digilent RO
[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to