Revision 470d0567 Target/Demo/ARMCM4_STM32F405_Power_Management_GCC/Boot/main.c
Target/Demo/ARMCM4_STM32F405_Power_Management_GCC/Boot/main.c | ||
---|---|---|
23 | 23 |
* You should have received a copy of the GNU General Public License along with OpenBLT. |
24 | 24 |
* If not, see <http://www.gnu.org/licenses/>. |
25 | 25 |
* |
26 |
* A special exception to the GPL is included to allow you to distribute a combined work
|
|
27 |
* that includes OpenBLT without being obliged to provide the source code for any
|
|
26 |
* A special exception to the GPL is included to allow you to distribute a combined work |
|
27 |
* that includes OpenBLT without being obliged to provide the source code for any |
|
28 | 28 |
* proprietary components. The exception text is included at the bottom of the license |
29 | 29 |
* file <license.html>. |
30 |
*
|
|
30 |
* |
|
31 | 31 |
* \endinternal |
32 | 32 |
****************************************************************************************/ |
33 | 33 |
|
... | ... | |
39 | 39 |
#include "stm32f4xx_conf.h" /* STM32 peripheral drivers */ |
40 | 40 |
#include "com.h" |
41 | 41 |
#include "ARMCM4_STM32/types.h" |
42 |
#include "AMiRo/interfaces.h"
|
|
42 |
#include "AMiRo/amiroblt.h"
|
|
43 | 43 |
#include "AMiRo/helper.h" |
44 | 44 |
|
45 | 45 |
/**************************************************************************************** |
... | ... | |
180 | 180 |
void shutdownToHibernate(); |
181 | 181 |
void shutdownAndRestart(); |
182 | 182 |
|
183 |
volatile BlBackupRegister backup_reg;
|
|
183 |
volatile blBackupRegister_t backup_reg;
|
|
184 | 184 |
|
185 | 185 |
/**************************************************************************************** |
186 | 186 |
* Callback configuration |
... | ... | |
191 | 191 |
void blCallbackShutdownRestart(void); |
192 | 192 |
void blCallbackHandleShutdownRequest(void); |
193 | 193 |
|
194 |
const BlCallbackTable cbtable __attribute__ ((section ("_callback_table"))) = {
|
|
194 |
const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) = {
|
|
195 | 195 |
.magicNumber = BL_MAGIC_NUMBER, |
196 |
.versionMajor = BL_VERSION_MAJOR,
|
|
197 |
.versionMinor = BL_VERSION_MINOR,
|
|
198 |
.versionHotfix = 0,
|
|
196 |
.vBootloader = {BL_VERSION_ID_AMiRoBLT_Release, BL_VERSION_MAJOR, BL_VERSION_MINOR, 0},
|
|
197 |
.vSSSP = {BL_VERSION_ID_SSSP, SSSP_VERSION_MAJOR, SSSP_VERSION_MINOR, 0},
|
|
198 |
.vCompiler = {BL_VERSION_ID_GCC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__}, // currently only GCC is supported
|
|
199 | 199 |
.cbShutdownHibernate = blCallbackShutdownHibernate, |
200 | 200 |
.cbShutdownDeepsleep = blCallbackShutdownDeepsleep, |
201 | 201 |
.cbShutdownTransportation = blCallbackShutdownTransportation, |
... | ... | |
211 | 211 |
}; |
212 | 212 |
|
213 | 213 |
/************************************************************************************//** |
214 |
** \brief This is the entry point for the bootloader application and is called
|
|
214 |
** \brief This is the entry point for the bootloader application and is called |
|
215 | 215 |
** by the reset interrupt vector after the C-startup routines executed. |
216 | 216 |
** \return none. |
217 | 217 |
** |
... | ... | |
321 | 321 |
|
322 | 322 |
|
323 | 323 |
/************************************************************************************//** |
324 |
** \brief Initializes the microcontroller.
|
|
324 |
** \brief Initializes the microcontroller. |
|
325 | 325 |
** \return none. |
326 | 326 |
** |
327 | 327 |
****************************************************************************************/ |
... | ... | |
334 | 334 |
USART_InitTypeDef USART_InitStructure; |
335 | 335 |
#elif (BOOT_COM_CAN_ENABLE > 0 || BOOT_GATE_CAN_ENABLE > 0) |
336 | 336 |
GPIO_InitTypeDef GPIO_InitStructure; |
337 |
#endif
|
|
337 |
#endif |
|
338 | 338 |
|
339 | 339 |
/* initialize the system and its clocks */ |
340 | 340 |
SystemInit(); |
... | ... | |
399 | 399 |
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); |
400 | 400 |
/* select alternate function for the CAN pins */ |
401 | 401 |
GPIO_PinAFConfig(GPIOA, GPIO_PinSource11, GPIO_AF_CAN1); |
402 |
GPIO_PinAFConfig(GPIOA, GPIO_PinSource12, GPIO_AF_CAN1);
|
|
402 |
GPIO_PinAFConfig(GPIOA, GPIO_PinSource12, GPIO_AF_CAN1); |
|
403 | 403 |
/* configure CAN RX and TX pins */ |
404 | 404 |
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11; |
405 | 405 |
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; |
... | ... | |
413 | 413 |
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; |
414 | 414 |
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; |
415 | 415 |
GPIO_Init(GPIOA, &GPIO_InitStructure); |
416 |
#endif
|
|
416 |
#endif |
|
417 | 417 |
|
418 | 418 |
} /*** end of Init ***/ |
419 | 419 |
|
... | ... | |
632 | 632 |
IWDG_ReloadCounter(); |
633 | 633 |
|
634 | 634 |
/* write some information to the backup register */ |
635 |
BlBackupRegister backup;
|
|
635 |
blBackupRegister_t backup;
|
|
636 | 636 |
backup.shutdown_pri_reason = BL_SHUTDOWN_PRI_RSN_TRANSPORT; |
637 | 637 |
backup.shutdown_sec_reason = BL_SHUTDOWN_SEC_RSN_UNKNOWN; |
638 | 638 |
backup.wakeup_pri_reason = BL_WAKEUP_PRI_RSN_UNKNOWN; |
... | ... | |
668 | 668 |
*/ |
669 | 669 |
|
670 | 670 |
/* write some information to the backup register */ |
671 |
BlBackupRegister backup;
|
|
671 |
blBackupRegister_t backup;
|
|
672 | 672 |
backup.shutdown_pri_reason = BL_SHUTDOWN_PRI_RSN_DEEPSLEEP; |
673 | 673 |
backup.shutdown_sec_reason = BL_SHUTDOWN_SEC_RSN_UNKNOWN; |
674 | 674 |
backup.wakeup_pri_reason = BL_WAKEUP_PRI_RSN_UNKNOWN; |
... | ... | |
701 | 701 |
systemPowerDown(); |
702 | 702 |
|
703 | 703 |
/* write some information to the backup register */ |
704 |
BlBackupRegister backup;
|
|
704 |
blBackupRegister_t backup;
|
|
705 | 705 |
backup.shutdown_pri_reason = BL_SHUTDOWN_PRI_RSN_HIBERNATE; |
706 | 706 |
backup.shutdown_sec_reason = BL_SHUTDOWN_SEC_RSN_UNKNOWN; |
707 | 707 |
backup.wakeup_pri_reason = BL_WAKEUP_PRI_RSN_UNKNOWN; |
... | ... | |
730 | 730 |
systemPowerDown(); |
731 | 731 |
|
732 | 732 |
/* write some information to the backup register */ |
733 |
BlBackupRegister backup;
|
|
733 |
blBackupRegister_t backup;
|
|
734 | 734 |
backup.shutdown_pri_reason = BL_SHUTDOWN_PRI_RSN_RESTART; |
735 | 735 |
backup.shutdown_sec_reason = BL_SHUTDOWN_SEC_RSN_UNKNOWN; |
736 | 736 |
backup.wakeup_pri_reason = BL_WAKEUP_PRI_RSN_UNKNOWN; |
Also available in: Unified diff