lpc1768 board or the MCB1700
does anybody know how to switch bins files using the hardware reset route, so when I press the reset button it will switch bins.
I know for software it could be something like this perharps
<
> int main (void) { for (;;) If extern "C" void lpc1768_reset(); flash.write = binfile1 else flash.write = binfile2 endif } <
>
thanks,
thomas
would any of you know how to detect when the mbed's hardware reset button has been pushed, so I can then use that to trigger a copy rename and delete of my bin file.
I have the code for a software reset and plan to use an external push button to that if I can not figure out how to do above.
I have a blue reset button on my MCB1700 as well I don't mind using that one if you prefer
> NVIC_SystemReset() #define NVIC_SYSRESETREQ 2 /*!< System Reset Request */ #define NVIC_AIRCR_VECTKEY (0x5FA << 16) /*!< AIRCR Key for write access */ static __INLINE void NVIC_SystemReset(void) { SCB->AIRCR = (NVIC_AIRCR_VECTKEY | (1<<NVIC_SYSRESETREQ)); /* Keep priority group unchanged */ asm("DSB"); while(1); /* wait until reset */ } <
> /** * @brief Initiate a system reset request. * * Initiate a system reset request to reset the MCU */ static __INLINE void NVIC_SystemReset(void) { SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | SCB_AIRCR_SYSRESETREQ_Msk); /* Keep priority group unchanged */ __DSB(); /* Ensure completion of memory access */ while(1); /* wait until reset */ } /*@}*/ /* end of group CMSIS_CM3_Core_FunctionInterface */ <