I copied the memory.x file from the shared install location, and I created a new section called "newconfig" and shrunk the available ROM space. Code is placed into ROM like normal, but by using the __attribute__((section ... stuff you can specify the data be placed into that specific location. In my case, all my code sits before FA00 and all my constants are placed into FA00 and later. If you have multiple variables you want organized together in a specific order, consider a struct to keep them all together so you don't need to create a section for each variable. You can place the struct at the start address and from there all the subsequent variables fall into place.
The following is an example of my modified memory.x file. MEMORY { sfr : ORIGIN = 0x0000, LENGTH = 0x0010 /* END=0x0010, size 16 */ peripheral_8bit : ORIGIN = 0x0010, LENGTH = 0x00f0 /* END=0x0100, size 240 */ peripheral_16bit : ORIGIN = 0x0100, LENGTH = 0x0100 /* END=0x0200, size 256 */ ram_mirror (wx) : ORIGIN = 0x0200, LENGTH = 0x0800 /* END=0x0a00, size 2K */ infomem : ORIGIN = 0x1000, LENGTH = 0x0100 /* END=0x1100, size 256 as 2 128-byte segments */ infob : ORIGIN = 0x1000, LENGTH = 0x0080 /* END=0x1080, size 128 */ infoa : ORIGIN = 0x1080, LENGTH = 0x0080 /* END=0x1100, size 128 */ ram (wx) : ORIGIN = 0x1100, LENGTH = 0x1400 /* END=0x2500, size 5K */ /* rom (rx) : ORIGIN = 0x2500, LENGTH = 0xdae0 */ /* END=0xffe0, size 56032 */ rom (rx) : ORIGIN = 0x2500, LENGTH = 0xd500 newconfig (r) : ORIGIN = 0xFA00, LENGTH = 0x05e0 vectors : ORIGIN = 0xffe0, LENGTH = 0x0020 /* END=0x10000, size 32 as 16 2-byte segments */ /* Remaining banks are absent */ bsl : ORIGIN = 0x0000, LENGTH = 0x0000 infoc : ORIGIN = 0x0000, LENGTH = 0x0000 infod : ORIGIN = 0x0000, LENGTH = 0x0000 ram2 (wx) : ORIGIN = 0x0000, LENGTH = 0x0000 usbram (wx) : ORIGIN = 0x0000, LENGTH = 0x0000 far_rom : ORIGIN = 0x00000000, LENGTH = 0x00000000 } -----Original Message----- From: Wayne Uroda [mailto:w.ur...@gmail.com] Sent: Monday, January 28, 2013 6:38 PM To: mspgcc-users@lists.sourceforge.net Subject: Re: [Mspgcc-users] Fixing const char string in memory using linker script Hi Bob, I do the following: in my linker script, I have something like .text : { *(.swversection) // no need to manually advance `.' // other input sections follow } > text Then in the code: __attribute__ ((section(".swversection"))) const char swVer[] = ...; I hope this helps - Wayne On 29/01/2013 8:11 AM, Robert Henig wrote: > I am trying to force a string into a fixed location using a linker script. > The script contains: > > .text : > { > swVer = .; > . += 8; > } > > The code contains: > > const char swVer[] = "01.0904\0"; > > After compiling the .map file shows that eight bytes are reserved at 0xc000 > and a symbol named swVer at that location. As expected .init0 is at 0xc008. > However the linker does not initialize the memory with the version string. It > is initialized to zeros. Anyone have any idea how to make this work? > > Thanks, > Bob. > > > > ---------------------------------------------------------------------- > -------- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, > HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your > skills current with LearnDevNow - 3,200 step-by-step video tutorials > by Microsoft MVPs and experts. ON SALE this month only -- learn more > at: > http://p.sf.net/sfu/learnnow-d2d > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users This email, including any attachments and files transmitted with it, are for the sole use of the intended recipient(s) to whom this email is addressed, and may contain confidential and/or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please be advised that you have received this email in error, and please contact the sender by reply email and destroy all copies (including all electronic and hard copies) of the original message. Thank you. ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users