2012/1/10 Mark Rages <markra...@gmail.com>

> 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,
> >>
> >>
> >> 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?
>
>
I do that programmatically, i.e. by code. We have a "factory data"
structure with information like:
- version of the structure (to handle software upgrade)
- build number of the last run firmware (as above)
- serial number
- more specific stuff...
- CRC16

After reset, this structure is loaded from the information memory starting
at address 0x1000 (it's the same in every MSP430); then we check if it is
valid or not and then....you can do what is best for your application.

The point is that information memory can be written and erased separately
from the rest of the Flash, and we also have a builtin, runtime, routine to
write this data in case of a firmware upgrade (last run build number lower
of current one).

Also, you can also easily "compile" a few lines long Intel Hex program
file, which starts writing at address 0x1000 in order to load your data.

The only limite is the 256 byte in total that you have....but it's ok for
the kind of special data above.

R#
------------------------------------------------------------------------------
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

Reply via email to