On Tue, Jan 10, 2012 at 11:11 AM, Mark Rages <markra...@gmail.com> wrote: > On Mon, Dec 12, 2011 at 1:39 PM, Peter Bigot <big...@acm.org> wrote: >> On Mon, Dec 12, 2011 at 2:31 PM, Timothy Logan <timothy.lo...@gmail.com> >> wrote: >>> Hello, >>> >>> I am porting some code from IAR which involves me having to place a few >>> different structures in very specific addresses in the MSP430 memory. >>> >>> In IAR there is a pragma to do it: >>> http://supp.iar.com/Support/?note=27787&from=search+result >>> >>> The way I see doing it in mspgcc is to create a custom linker script with >>> custom memory sections, and simply use the "section" attribute to manage >>> specific variable memory locations in declarations. This seems a little >>> overkill though as I would have to make different memory sections for each >>> variable and would have to rewrite the entire memory table as a side >>> effect. >>> >>> My question: Is there an easier way to control which address in memory a >>> variable/structure is stored in without having to muck around with linker >>> scripts? >> >> You can use asm statements, as are done with the peripheral register >> declarations. Something like: >> >> volatile unsigned int specialdata __asm__("0x1320"); >> >> will force the definition of specialdata to be placed at address 0x1320. >> > > Is there a syntax that will allow placement of a initialized const > variables in memory? (I want my bootloader to place its version > number in a well-defined place in flash memory.) Is this possible > without mucking with the linker script?
The simplest answer is "no". A more complex answer would try various nasty tricks and likely also end up at "no". If you want to write specific data to a specific location in the image, you need to put that into the linker script, as somebody did recently with some BSL register that's outside the standard map. It seems this is becoming a common request. If you intend to target multiple MCUs and don't want to have to edit multiple memory.x and/or msp430.x* scripts, and want support from the toolchain for extending linker scripts, please file a request in the bugs tracker with specific details on what you think such support should look like. I'll be mucking with binutils soon, and it'd be a good time for such a feature to go in. Peter > > -- > Regards, > Mark > markrages@gmail > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users