This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Changing the "MEMORY" configuration in the linker.cmd file

Hi,

I'm trying to modify my Platform.xdc file so that the "Memory" configuration in my linker.cmd file looks like the following:

MEMORY {
   PAGE 1:   PIEVECT:    origin = 0xd00,         len = 0x100
   PAGE 0:   SRAM:       origin = 0x200000,      len = 0x5a000
   PAGE 1:   MSARAM:     origin = 0x60,          len = 0x7a0
   PAGE 0:   L03SARAM:   origin = 0x8000,        len = 0x3000
   PAGE 1:   L47SARAM:   origin = 0xb000,        len = 0x4e00
   PAGE 0:   OTP:        origin = 0x380400,      len = 0x400
   PAGE 0:   BOOTROM:    origin = 0x3ff27c,      len = 0xd44
   PAGE 0:   FLASH_CODE: origin = 0x300000,      len = 0x3ff00
   PAGE 0:   FLASH_KEY:  origin = 0x33ff00,      len = 0x80
   PAGE 0:   CSM_RSVD:   origin = 0x33ff80,      len = 0x76
   PAGE 0:   BEGIN_FLASH: origin = 0x33fff6,     len = 0x2
   PAGE 1:   SRAM_DATA:  origin = 0x25a000,      len = 0x26000
   PAGE 1:   BOOT_INFO:  origin = 0xfe00,        len = 0x200
   PAGE 0:   IQTABLES:   origin = 0x3fe000,      len = 0xb50
   PAGE 0:   IQTABLES2:  origin = 0x3feb50,      len = 0x8c
   PAGE 0:   FPUTABLES:  origin = 0x3febdc,      len = 0x6a0
}
 
This is what my Platform.xdc file looks like after changing it:

............................................................................

    config ti.platforms.generic.Platform.Instance CPU =
        ti.platforms.generic.Platform.create("CPU", {
            clockRate:      150,                                      
            catalogName:    "ti.catalog.c2800",
            deviceName:     "TMS320C28335",
            customMemoryMap:
           [          
                ["BOOT_INFO",
                     {
                        name: "BOOT_INFO",
                        base: 0xfe00,                    
                        len: 0x200,                    
                        space: "data",
                        page: 0,
                     }
                ],
                ["IQTABLES2",
                     {
                        name: "IQTABLES2",
                        base: 0x3feb50,                    
                        len: 0x8c,                    
                        space: "code",
                        page: 0,
                     }
                ],
                ["SRAM_DATA",
                     {
                        name: "SRAM_DATA",
                        base: 0x25a000,                    
                        len: 0x26000,                    
                        space: "data",
                        page: 1,
                     }
                ],
                ["BEGIN_FLASH",
                     {
                        name: "BEGIN_FLASH",
                        base: 0x33fff6,                    
                        len: 0x2,                    
                        space: "code",
                        page: 0,
                     }
                ],
                ["FLASH_CODE",
                     {
                        name: "FLASH_CODE",
                        base: 0x300000,                    
                        len: 0x3ff00,                    
                        space: "code",
                        page: 0,
                     }
                ],
                ["FLASH_KEY",
                     {
                        name: "FLASH_KEY",
                        base: 0x33ff00,                    
                        len: 0x80,                    
                        space: "code",
                        page: 0,
                     }
                ],
                ["BOOTROM",
                     {
                        name: "BOOTROM",
                        base: 0x3ff27c,                    
                        len: 0xd44,                    
                        space: "code",
                        page: 0,
                     }
                ],
                ["FPUTABLES",
                     {
                        name: "FPUTABLES",
                        base: 0x3febdc,                    
                        len: 0x6a0,                    
                        space: "code",
                         page: 0,
                     }
                ],
                ["CSM_RSVD",
                     {
                        name: "CSM_RSVD",
                        base: 0x33ff80,                    
                        len: 0x76,                    
                        space: "code",
                         page: 0,
                     }
                ],
                ["OTP",
                     {
                        name: "OTP",
                        base: 0x380400,                    
                        len: 0x400,                    
                        space: "code",
                         page: 0,
                     }
                ],
                ["PIEVECT",
                     {
                        name: "PIEVECT",
                        base: 0xd00,                    
                        len: 0x100,                    
                        space: "data",
                         page: 1,
                     }
                ],
                ["SRAM",
                     {
                        name: "SRAM",
                        base: 0x200000,                    
                        len: 0x5a000,                    
                        space: "code",
                         page: 0,
                     }
                ],
                ["MSARAM",
                     {
                        name: "MSARAM",
                        base: 0x60,                    
                        len: 0x7a0,                    
                        space: "data",
                        page: 1,
                     }
                ],
                ["L03SARAM",
                     {
                        name: "L03SARAM",
                        base: 0x8000,                    
                        len: 0x3000,                    
                        space: "code",
                        page: 0,
                     }
                ],
                ["FLASH",
                     {
                        name: "FLASH",
                        base: 0x33fffd,                                  
                        len: 0x2,                    
                        space: "code",
                         page: 0,
                     }
                ],
                ["L47SARAM",
                     {
                        name: "L47SARAM",
                        base: 0xb000,                    
                        len: 0x4e00,                    
                        space: "data",
                         page: 1,
                     }
                ],
                ["IQTABLES",
                     {
                        name: "IQTABLES",
                        base: 0x3fe000,                    
                        len: 0xb50,                    
                        space: "code",
                         page: 0,
                     }
                ],
           ],

    });
   
instance :
   
    override config string codeMemory  = "SRAM";  
    override config string dataMemory  = "SRAM_DATA";                                
    override config string stackMemory = "MSARAM";

............................................................................

I've modified the Platform.xdc file by adding the "page:" attribute. I also modified the "FLASH" memory segment to have a different "base" address and "len", so there's no overlap. However, I continue to get the following error:

ti/xdctools_3_24_05_48/packages/ti/platforms/generic/Platform.xs", line 100: ti.platforms.generic.Platform.Instance#0 BEGIN_FLASH and FLASH: Memory objects BEGIN_FLASH and FLASH overlap
js: "C:/ti/xdctools_3_24_05_48/packages/xdc/cfg/Main.xs", line 149: Error: Configuration failed!

Is this a legitimate way to go about getting the appropriate linker.cmd file?
It looks like a "FLASH" memory segment is automatically generated and placed in the linker.cmd file, is there a way to turn that off?
The Platform.xdc file has three "override" lines at the end of the file. What are they used for?

Thanks

  • When you change Platform.xdc file, you have to run 'xdc' command to make the change visible. You need to go to the directory where Platform.xdc is located, open the command window and run C:/ti/xdctools_3_24_05_48/xdc. I don't think there is any code that would create FLASH memory segment if it's not specified in your Platform.xdc, but let's try first running 'xdc' and check if it solves some of the problems.

    The platform parameters codeMemory, dataMemory and stackMemory are used to allocate sections for which there are no explicit allocations in Program.sectMap. So, if you don't have an entry for .text in Program.sectMap, .text will go to SRAM.

  • Sasha,

    Thank you for replying to my post.

    Success! I removed the "FLASH" memory segment from Platform.xdc and successfully ran the command C:/ti/xdctools_3_24_05_48/xdc. My build now creates the linker.cmd file that I'm expecting. Thanks a lot for the help.