EmbeddedRelated.com
Forums

What happens when MSP reads illegal instruction?

Started by ateichtmann March 20, 2006
Hi,

i found nothing in the manuals and datasheets:
What happens with the msp430 when it reads an illegal instruction 
(e.g. 0x0000) from the memory? Reset? Nothing?

The background of the question are safety matters:
Usually, unused flash memory is filled with 0xFFFF after a flash erase.
Is it better to fill unused flash memory with 0x0000 or 0xFFFF or a 
defined instruction? I think, 0xFFFF is a valid instruction (and.b) 
and if the program counter "gets astray" it would run up to the 
interrupt vector area at the end of the memory and then execute 
interrupt vector code.


Regards
Arvid





Beginning Microcontrollers with the MSP430

Arvid,

Weed city.

It is better to stuff memory with 0x3FFF that isn't used - that's
known
as a 'Jump Here' or 'Spin'.  In the IAR tools - you define
to write unused
memory with FF 3F in the window provided for that.

If you have a NULL pointer access - it'll try to read/write the 430's
config
registers which so happen to reside starting at 0x0000.  I consider this a 
'weakness'
in the architecuture and have spoken to the architect of the 430 personally
regarding this - maybe in a future version this will be fixed. Typically - 
you
want an exception vector or at least a spin defined at 0x0000 so you know
what happens.  Symptoms of NULL pointer accesses are all of a sudden
your UARTS don't work anymore, etc...

Regards,
John

----- Original Message ----- 
From: "ateichtmann" <arvid_teichtmann@arvi...>
To: <msp430@msp4...>
Sent: Monday, March 20, 2006 6:38 AM
Subject: [msp430] What happens when MSP reads illegal instruction?


> Hi,
>
> i found nothing in the manuals and datasheets:
> What happens with the msp430 when it reads an illegal instruction
> (e.g. 0x0000) from the memory? Reset? Nothing?
>
> The background of the question are safety matters:
> Usually, unused flash memory is filled with 0xFFFF after a flash erase.
> Is it better to fill unused flash memory with 0x0000 or 0xFFFF or a
> defined instruction? I think, 0xFFFF is a valid instruction (and.b)
> and if the program counter "gets astray" it would run up to the
> interrupt vector area at the end of the memory and then execute
> interrupt vector code.
>
>
> Regards
> Arvid
>
>
>
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
> 



> in the architecuture and have spoken to the architect of the 430
personally
> regarding this - maybe in a future version this
will be fixed. Typically -

That's funny, I thought there was 3 of them in Freising ?
(the original 3)

-- Kris

-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of John C. Westmoreland,
P.E.
Sent: Tuesday, 21 March 2006 6:42 AM
To: msp430@msp4...
Subject: Re: [msp430] What happens when MSP reads illegal instruction?

Arvid,

Weed city.

It is better to stuff memory with 0x3FFF that isn't used - that's
known
as a 'Jump Here' or 'Spin'.  In the IAR tools - you define
to write unused
memory with FF 3F in the window provided for that.

If you have a NULL pointer access - it'll try to read/write the 430's
config
registers which so happen to reside starting at 0x0000.  I consider this a 
'weakness'
in the architecuture and have spoken to the architect of the 430 personally
regarding this - maybe in a future version this will be fixed. Typically - 
you
want an exception vector or at least a spin defined at 0x0000 so you know
what happens.  Symptoms of NULL pointer accesses are all of a sudden
your UARTS don't work anymore, etc...

Regards,
John

----- Original Message ----- 
From: "ateichtmann" <arvid_teichtmann@arvi...>
To: <msp430@msp4...>
Sent: Monday, March 20, 2006 6:38 AM
Subject: [msp430] What happens when MSP reads illegal instruction?


> Hi,
>
> i found nothing in the manuals and datasheets:
> What happens with the msp430 when it reads an illegal instruction
> (e.g. 0x0000) from the memory? Reset? Nothing?
>
> The background of the question are safety matters:
> Usually, unused flash memory is filled with 0xFFFF after a flash erase.
> Is it better to fill unused flash memory with 0x0000 or 0xFFFF or a
> defined instruction? I think, 0xFFFF is a valid instruction (and.b)
> and if the program counter "gets astray" it would run up to the
> interrupt vector area at the end of the memory and then execute
> interrupt vector code.
>
>
> Regards
> Arvid
>
>
>
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
> 




.

 
Yahoo! Groups Links



 





Kris,

I've spoken to Horst Diewald, chief architect of the MSP430 regarding this.

He has 'the patent' on low power
microprocessor architecture - much of what the 430 relies upon.  I haven't 
personally looked up any of his patents
on www.uspto.gov.  Note my remarks aren't intended to take credit away from

people like Lutz Bierl, et. al.

Regards,
John

----- Original Message ----- 
From: "Microbit" <microbit@micr...>
To: <msp430@msp4...>
Sent: Monday, March 20, 2006 7:59 PM
Subject: RE: [msp430] What happens when MSP reads illegal instruction?


>> in the architecuture and have spoken to the
architect of the 430 
>> personally
>> regarding this - maybe in a future version this will be fixed. 
>> Typically -
>
> That's funny, I thought there was 3 of them in Freising ?
> (the original 3)
>
> -- Kris
>
> -----Original Message-----
> From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of 
> John C. Westmoreland,
> P.E.
> Sent: Tuesday, 21 March 2006 6:42 AM
> To: msp430@msp4...
> Subject: Re: [msp430] What happens when MSP reads illegal instruction?
>
> Arvid,
>
> Weed city.
>
> It is better to stuff memory with 0x3FFF that isn't used - that's
known
> as a 'Jump Here' or 'Spin'.  In the IAR tools - you
define to write unused
> memory with FF 3F in the window provided for that.
>
> If you have a NULL pointer access - it'll try to read/write the
430's 
> config
> registers which so happen to reside starting at 0x0000.  I consider this a
> 'weakness'
> in the architecuture and have spoken to the architect of the 430 
> personally
> regarding this - maybe in a future version this will be fixed. Typically -
> you
> want an exception vector or at least a spin defined at 0x0000 so you know
> what happens.  Symptoms of NULL pointer accesses are all of a sudden
> your UARTS don't work anymore, etc...
>
> Regards,
> John
>
> ----- Original Message ----- 
> From: "ateichtmann" <arvid_teichtmann@arvi...>
> To: <msp430@msp4...>
> Sent: Monday, March 20, 2006 6:38 AM
> Subject: [msp430] What happens when MSP reads illegal instruction?
>
>
>> Hi,
>>
>> i found nothing in the manuals and datasheets:
>> What happens with the msp430 when it reads an illegal instruction
>> (e.g. 0x0000) from the memory? Reset? Nothing?
>>
>> The background of the question are safety matters:
>> Usually, unused flash memory is filled with 0xFFFF after a flash erase.
>> Is it better to fill unused flash memory with 0x0000 or 0xFFFF or a
>> defined instruction? I think, 0xFFFF is a valid instruction (and.b)
>> and if the program counter "gets astray" it would run up to
the
>> interrupt vector area at the end of the memory and then execute
>> interrupt vector code.
>>
>>
>> Regards
>> Arvid
>>
>>
>>
>>
>>
>>
>> .
>>
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
> 



Arvid,
 
I think that there are two good solutions for this. You can fill unused
memory with instruction 'MOV  #0,&WDTCTL'  (triggers Reset
instantaneous)
with the fill pattern 0x82432001. Or you can use the command 'JMP  $'
(Reset
is triggered when WDT expires) with the pattern 0xFF3F.
 
Regards,
 
Nando
  _____  

From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of
John C. Westmoreland, P.E.
Sent: Tuesday, March 21, 2006 7:35 AM
To: msp430@msp4...
Subject: Re: [msp430] What happens when MSP reads illegal instruction?


Kris,

I've spoken to Horst Diewald, chief architect of the MSP430 regarding this.

He has 'the patent' on low power
microprocessor architecture - much of what the 430 relies upon.  I haven't 
personally looked up any of his patents
on www.uspto.gov.  Note my remarks aren't intended to take credit away from

people like Lutz Bierl, et. al.

Regards,
John

----- Original Message ----- 
From: "Microbit" <microbit@micr...>
To: <msp430@msp4...>
Sent: Monday, March 20, 2006 7:59 PM
Subject: RE: [msp430] What happens when MSP reads illegal instruction?


>> in the architecuture and have spoken to the
architect of the 430 
>> personally
>> regarding this - maybe in a future version this will be fixed. 
>> Typically -
>
> That's funny, I thought there was 3 of them in Freising ?
> (the original 3)
>
> -- Kris
>
> -----Original Message-----
> From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of 
> John C. Westmoreland,
> P.E.
> Sent: Tuesday, 21 March 2006 6:42 AM
> To: msp430@msp4...
> Subject: Re: [msp430] What happens when MSP reads illegal instruction?
>
> Arvid,
>
> Weed city.
>
> It is better to stuff memory with 0x3FFF that isn't used - that's
known
> as a 'Jump Here' or 'Spin'.  In the IAR tools - you
define to write unused
> memory with FF 3F in the window provided for that.
>
> If you have a NULL pointer access - it'll try to read/write the
430's 
> config
> registers which so happen to reside starting at 0x0000.  I consider this a
> 'weakness'
> in the architecuture and have spoken to the architect of the 430 
> personally
> regarding this - maybe in a future version this will be fixed. Typically -
> you
> want an exception vector or at least a spin defined at 0x0000 so you know
> what happens.  Symptoms of NULL pointer accesses are all of a sudden
> your UARTS don't work anymore, etc...
>
> Regards,
> John
>
> ----- Original Message ----- 
> From: "ateichtmann" <arvid_teichtmann@arvi...>
> To: <msp430@msp4...>
> Sent: Monday, March 20, 2006 6:38 AM
> Subject: [msp430] What happens when MSP reads illegal instruction?
>
>
>> Hi,
>>
>> i found nothing in the manuals and datasheets:
>> What happens with the msp430 when it reads an illegal instruction
>> (e.g. 0x0000) from the memory? Reset? Nothing?
>>
>> The background of the question are safety matters:
>> Usually, unused flash memory is filled with 0xFFFF after a flash erase.
>> Is it better to fill unused flash memory with 0x0000 or 0xFFFF or a
>> defined instruction? I think, 0xFFFF is a valid instruction (and.b)
>> and if the program counter "gets astray" it would run up to
the
>> interrupt vector area at the end of the memory and then execute
>> interrupt vector code.
>>
>>
>> Regards
>> Arvid
>>
>>
>>
>>
>>
>>
>> .
>>
>>
>> > . 


  _____