Fixed a bug found by Moritz Straube - writing to the internal flash would lock up contikimac. The problem was due to the IFG1 being reset to zero before writing to flash.
This commit is contained in:
parent
125656d3cd
commit
4fac3037e0
1 changed files with 11 additions and 10 deletions
|
@ -29,7 +29,7 @@
|
|||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: flash.c,v 1.2 2007/11/17 10:28:04 adamdunkels Exp $
|
||||
* $Id: flash.c,v 1.3 2010/11/15 21:52:54 adamdunkels Exp $
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
|
@ -51,11 +51,16 @@ static unsigned short ie1, ie2;
|
|||
void
|
||||
flash_setup(void)
|
||||
{
|
||||
|
||||
/* Disable all interrupts. */
|
||||
/* disable all interrupts to protect CPU
|
||||
during programming from system crash */
|
||||
_DINT();
|
||||
|
||||
/* Clear interrupt flag1. */
|
||||
IFG1 = 0;
|
||||
/* IFG1 = 0; */
|
||||
/* The IFG1 = 0; statement locks up contikimac - not sure if this
|
||||
statement needs to be here at all. I've removed it for now, since
|
||||
it seems to work, but leave this little note here in case someone
|
||||
stumbles over this code at some point. */
|
||||
|
||||
/* Stop watchdog. */
|
||||
watchdog_stop();
|
||||
|
@ -64,10 +69,6 @@ flash_setup(void)
|
|||
select SMCLK for flash timing, divider 5+1 */
|
||||
FCTL2 = 0xA5C5;
|
||||
|
||||
/* disable all interrupts to protect CPU
|
||||
during programming from system crash */
|
||||
_DINT();
|
||||
|
||||
/* disable all NMI-Interrupt sources */
|
||||
ie1 = IE1;
|
||||
ie2 = IE2;
|
||||
|
|
Loading…
Reference in a new issue