mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-09-09 23:54:32 +00:00
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
@ -29,7 +29,7 @@
|
|||||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
* OF SUCH DAMAGE.
|
* 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>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
@ -51,27 +51,28 @@ static unsigned short ie1, ie2;
|
|||||||
void
|
void
|
||||||
flash_setup(void)
|
flash_setup(void)
|
||||||
{
|
{
|
||||||
|
/* disable all interrupts to protect CPU
|
||||||
/* Disable all interrupts. */
|
during programming from system crash */
|
||||||
|
_DINT();
|
||||||
|
|
||||||
/* Clear interrupt flag1. */
|
/* 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. */
|
/* Stop watchdog. */
|
||||||
watchdog_stop();
|
watchdog_stop();
|
||||||
|
|
||||||
/* DCO(SMCLK) is 2,4576MHz, /6 = 409600 Hz
|
/* DCO(SMCLK) is 2,4576MHz, /6 = 409600 Hz
|
||||||
select SMCLK for flash timing, divider 5+1 */
|
select SMCLK for flash timing, divider 5+1 */
|
||||||
FCTL2 = 0xA5C5;
|
FCTL2 = 0xA5C5;
|
||||||
|
|
||||||
/* disable all interrupts to protect CPU
|
|
||||||
during programming from system crash */
|
|
||||||
_DINT();
|
|
||||||
|
|
||||||
/* disable all NMI-Interrupt sources */
|
/* disable all NMI-Interrupt sources */
|
||||||
ie1 = IE1;
|
ie1 = IE1;
|
||||||
ie2 = IE2;
|
ie2 = IE2;
|
||||||
IE1 = 0x00;
|
IE1 = 0x00;
|
||||||
IE2 = 0x00;
|
IE2 = 0x00;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
Loading…
Reference in New Issue
Block a user