EmbeddedRelated.com
Forums

Running from MSP430 RAM

Started by flatman3000 April 11, 2006
Hi All,

Has anyone got any experience running a program out of the MSP's RAM?

I am keen to get hold of a small sample program if possible. Issues i 
am also keen to know about are:
 - setting up compiler to do program copy to RAM
 - setting up linker to reserve of RAM space for the RAM program
 - handling of interrupts during execution from RAM

Any other issues to look out for or tips would be very much appreciated.

Cheers,
Jon





Beginning Microcontrollers with the MSP430

Hi,

yes, there is an application note from TI about flash self programming, 
SLAA103. During flash operations you have to run code from RAM. The note 
comes with source code. Basically they show how to copy a small program 
onto stack and then run it. That worked for me "within an hour".

Your other questions depend on the programming environment used, and 
they normally deliver some examples. Anyway i guess for debugging any of 
the known IDEs will setup program code in flash and not in RAM. Maybe it 
is impossible to have the debugger copy data to RAM. Please note that 
for C variables, they are initialized from flash to RAM by the startup 
code, i.e. by the processor during boot. You can extend the startup 
sequence to init your RAM code. The pattern is there.

Interrupts are not affected by RAM versus flash, but since the primary 
interrupt vector table is in flash, it cannot be used during flash 
programming. I am not sure whether this applies to all MSP flash 
devices, but this is the link between RAM code and interrupt problems. 
Also i cannot imagine how to use interrupts in a flash-less processor.

Regards,
D. Teuchert

flatman3000 wrote:

>Hi All,
>
>Has anyone got any experience running a program out of the MSP's RAM?
>
>I am keen to get hold of a small sample program if possible. Issues i 
>am also keen to know about are:
> - setting up compiler to do program copy to RAM
> - setting up linker to reserve of RAM space for the RAM program
> - handling of interrupts during execution from RAM
>
>Any other issues to look out for or tips would be very much appreciated.
>
>Cheers,
>Jon
>
>
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>

Hi,

It depends on which IDE you're using, to execute code from RAM, most can do
it.
All you need (without interrupts from RAM) is to compile the code at one
address,
while it's linked to run from a different address....
Another option is PIC (Position Independent Code), but there's some
provisos there.
 
Also, you _can_ program from Flash with MSP430, you just have to ensure that the
interrupts
are disabled (if the MSP430 has only ONE bank of Flash, and the interrupt
vectors are in Flash,
not RAM).
The CPU just executes a "jump to same address" idle state while the
Flash controller is busy.
Future MSP430s that have multiple banks of Flash can program Flash on one bank
while executing
from another bank IIRC.

Finally, just as you can link code to execute from RAM, you can also point the
interrupt vector(s)
to RAM, and then modify the actual address of the handler(s) of the ISRs.

HTH
Kris


-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Dieter Teuchert
Sent: Wednesday, 12 April 2006 4:01 PM
To: msp430@msp4...
Subject: Re: [msp430] Running from MSP430 RAM

Hi,

yes, there is an application note from TI about flash self programming, 
SLAA103. During flash operations you have to run code from RAM. The note 
comes with source code. Basically they show how to copy a small program 
onto stack and then run it. That worked for me "within an hour".

Your other questions depend on the programming environment used, and 
they normally deliver some examples. Anyway i guess for debugging any of 
the known IDEs will setup program code in flash and not in RAM. Maybe it 
is impossible to have the debugger copy data to RAM. Please note that 
for C variables, they are initialized from flash to RAM by the startup 
code, i.e. by the processor during boot. You can extend the startup 
sequence to init your RAM code. The pattern is there.

Interrupts are not affected by RAM versus flash, but since the primary 
interrupt vector table is in flash, it cannot be used during flash 
programming. I am not sure whether this applies to all MSP flash 
devices, but this is the link between RAM code and interrupt problems. 
Also i cannot imagine how to use interrupts in a flash-less processor.

Regards,
D. Teuchert

flatman3000 wrote:

>Hi All,
>
>Has anyone got any experience running a program out of the MSP's RAM?
>
>I am keen to get hold of a small sample program if possible. Issues i 
>am also keen to know about are:
> - setting up compiler to do program copy to RAM
> - setting up linker to reserve of RAM space for the RAM program
> - handling of interrupts during execution from RAM
>
>Any other issues to look out for or tips would be very much appreciated.
>
>Cheers,
>Jon
>
>
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>


.

 
Yahoo! Groups Links



 





Thanks for you help :-)





Thankyou both :-)

--- In msp430@msp4..., "Microbit" <microbit@...> wrote:
>
> Hi,
> 
> It depends on which IDE you're using, to execute code from RAM, 
most can do it.
> All you need (without interrupts from RAM) is to
compile the code 
at one address,
> while it's linked to run from a different
address....
> Another option is PIC (Position Independent Code), but there's some 
provisos there.
>  
> Also, you _can_ program from Flash with MSP430, you just have to 
ensure that the interrupts
> are disabled (if the MSP430 has only ONE bank of
Flash, and the 
interrupt vectors are in Flash,
> not RAM).
> The CPU just executes a "jump to same address" idle state while
the 
Flash controller is busy.
> Future MSP430s that have multiple banks of Flash
can program Flash 
on one bank while executing
> from another bank IIRC.
> 
> Finally, just as you can link code to execute from RAM, you can 
also point the interrupt vector(s)
> to RAM, and then modify the actual address of the
handler(s) of the 
ISRs.
> 
> HTH
> Kris
> 
> 
> -----Original Message-----
> From: msp430@msp4... [mailto:msp430@msp4...] On 
Behalf Of Dieter Teuchert
> Sent: Wednesday, 12 April 2006 4:01 PM
> To: msp430@msp4...
> Subject: Re: [msp430] Running from MSP430 RAM
> 
> Hi,
> 
> yes, there is an application note from TI about flash self 
programming, 
> SLAA103. During flash operations you have to run
code from RAM. The 
note 
> comes with source code. Basically they show how to
copy a small 
program 
> onto stack and then run it. That worked for me
"within an hour".
> 
> Your other questions depend on the programming environment used, 
and 
> they normally deliver some examples. Anyway i
guess for debugging 
any of 
> the known IDEs will setup program code in flash
and not in RAM. 
Maybe it 
> is impossible to have the debugger copy data to
RAM. Please note 
that 
> for C variables, they are initialized from flash
to RAM by the 
startup 
> code, i.e. by the processor during boot. You can
extend the startup 
> sequence to init your RAM code. The pattern is there.
> 
> Interrupts are not affected by RAM versus flash, but since the 
primary 
> interrupt vector table is in flash, it cannot be
used during flash 
> programming. I am not sure whether this applies to all MSP flash 
> devices, but this is the link between RAM code and interrupt 
problems. 
> Also i cannot imagine how to use interrupts in a
flash-less 
processor.
> 
> Regards,
> D. Teuchert
> 
> flatman3000 wrote:
> 
> >Hi All,
> >
> >Has anyone got any experience running a program out of the MSP's 
RAM?
> >
> >I am keen to get hold of a small sample program if possible. 
Issues i 
> >am also keen to know about are:
> > - setting up compiler to do program copy to RAM
> > - setting up linker to reserve of RAM space for the RAM program
> > - handling of interrupts during execution from RAM
> >
> >Any other issues to look out for or tips would be very much 
appreciated.
> >
> >Cheers,
> >Jon
> >
> >
> >
> >
> >
> >
> >.
> >
> > 
> >Yahoo! Groups Links
> >
> >
> >
> > 
> >
> >
> >
> >
> >  
> >
> 
> 
> .
> 
>  
> Yahoo! Groups Links
>