Fisheye: Tag dad52d69c15f96d2b7ca7e22138f5d07a3948a9f refers to a dead (removed) revision in file `firmware/App/Modes/ModeUpdate.c'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dad52d69c15f96d2b7ca7e22138f5d07a3948a9f refers to a dead (removed) revision in file `firmware/App/Modes/ModeUpdate.h'. Fisheye: No comparison available. Pass `N' to diff? Index: firmware/App/Modes/Update.c =================================================================== diff -u -r4f56aa3ae41d5beeedce5946a0cb3ebec2348a07 -rdad52d69c15f96d2b7ca7e22138f5d07a3948a9f --- firmware/App/Modes/Update.c (.../Update.c) (revision 4f56aa3ae41d5beeedce5946a0cb3ebec2348a07) +++ firmware/App/Modes/Update.c (.../Update.c) (revision dad52d69c15f96d2b7ca7e22138f5d07a3948a9f) @@ -8,7 +8,7 @@ * @file Update.c * * @author (last) Dana Rich -* @date (last) 25-April-2023 +* @date (last) 7-March-2023 * * @author (original) Dana Rich * @date (original) 7-March-2023 @@ -20,9 +20,11 @@ #include "system.h" #include "Update.h" +#define APP_STATUS_ADDRESS 0x00010000 #define BL_START_ADDRESS 0x00000000 uint32_t bootloaderStartAddress = (uint32_t)BL_START_ADDRESS; +uint32_t g_pulUpdateSuccess[2] = {0x5A5A5A5A, 0x00}; /*********************************************************************//** * @brief @@ -39,13 +41,35 @@ /*********************************************************************//** * @brief + * Sets the flag in FLASH that indicates the devices requests to enter into + * update mode from the bootloader. + * @details Inputs: none + * @details Outputs: Memory location reflects desired status + * @return none + *************************************************************************/ +bool setBootloaderFlag( void ) +{ + register uint32_t src = (uint32_t)&g_pulUpdateSuccess[1]; + register uint32_t dst = APP_STATUS_ADDRESS; + unsigned int bytes = 16; + + Fapi_issueProgrammingCommand((uint32_t *)dst, + (uint8_t *)src, + (uint32_t) bytes, + 0, + 0, + Fapi_AutoEccGeneration); + + while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy); + + return (FAPI_GET_FSM_STATUS == Fapi_Status_Success); +} + +/*********************************************************************//** + * @brief * Sets the software reset bits [15-14] of the System Exception Control * Register. Setting bit 15, or clearing bit 14 will cause a system * software reset. - * - * This will leave the device in a state where the bootloader will not be - * left until the next power cycle or a command the start the main app - * is received by the bootloader. * @details Inputs: none * @details Outputs: RM46x reboots * @return none Index: firmware/App/Modes/Update.h =================================================================== diff -u -r72831229355e23d75b0e48dbbf134cf0b3e77001 -rdad52d69c15f96d2b7ca7e22138f5d07a3948a9f --- firmware/App/Modes/Update.h (.../Update.h) (revision 72831229355e23d75b0e48dbbf134cf0b3e77001) +++ firmware/App/Modes/Update.h (.../Update.h) (revision dad52d69c15f96d2b7ca7e22138f5d07a3948a9f) @@ -19,6 +19,7 @@ #define __UPDATE_H__ void startBootloader( void ); +bool setBootloaderFlag( void ); void rebootSystemNow( void ); #endif /* __UPDATE_H__ */ Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r72831229355e23d75b0e48dbbf134cf0b3e77001 -rdad52d69c15f96d2b7ca7e22138f5d07a3948a9f --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 72831229355e23d75b0e48dbbf134cf0b3e77001) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision dad52d69c15f96d2b7ca7e22138f5d07a3948a9f) @@ -1766,6 +1766,18 @@ handleBloodPumpHardStopRequest( message ); break; + case MSG_ID_FW_SET_ENTER_BOOTLOADER: + handleSetBootloaderRequest( message ); + break; + + case MSG_ID_FW_ENTER_BOOTLOADER_NOW: + handleEnterBootloaderNowRequest( message ); + break; + + case MSG_ID_FW_REBOOT_NOW: + handleRebootNowRequest( message ); + break; + // The default cannot be reached in VectorCAST since the cases are run in a for loop default: // Unrecognized message ID received - ignore Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r329acf53eb90ccf47c5b3f68623b87ec38de5fda -rdad52d69c15f96d2b7ca7e22138f5d07a3948a9f --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 329acf53eb90ccf47c5b3f68623b87ec38de5fda) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision dad52d69c15f96d2b7ca7e22138f5d07a3948a9f) @@ -976,6 +976,15 @@ // MSG_ID_HD_REBOOT_NOW void handleRebootNowRequest( MESSAGE_T *message ); +// MSG_ID_HD_SET_ENTER_BOOTLOADER +void handleSetBootloaderRequest( MESSAGE_T *message ); + +// MSG_ID_HD_ENTER_BOOTLOADER_NOW +void handleEnterBootloaderNowRequest( MESSAGE_T *message ); + +// MSG_ID_HD_REBOOT_NOW +void handleRebootNowRequest( MESSAGE_T *message ); + /**@}*/ #endif