1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #include "app_loader.h"
-
- void IAP_Init(void)
- {
- #if (STM32F103 == 1)
-
- #ifdef VECT_TAB_SRAM
- SCB->VTOR = SRAM_BASE | NEW_VECTOR_OFFSET; /* Vector Table Relocation in Internal SRAM. */
- #else
- SCB->VTOR = FLASH_BASE | NEW_VECTOR_OFFSET; /* Vector Table Relocation in Internal FLASH. */
- #endif
- #elif (STM32F072 == 1)
- /* Relocate by software the vector table to the internal SRAM at 0x20000000 ***/
- uint32_t i = 0;
- /* Copy the vector table from the Flash (mapped at the base of the application
- load address 0x08003000) to the base address of the SRAM at 0x20000000. */
- for(i = 0; i < 48; i++)
- {
- *((uint32_t*)(NEW_VECTOR_ADDRESS + (i << 2)))=*(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2));
- }
- /* Enable the SYSCFG peripheral clock*/
- __HAL_RCC_SYSCFG_CLK_ENABLE();
-
- /* Remap SRAM at 0x00000000 */
- __HAL_SYSCFG_REMAPMEMORY_SRAM();
- #endif
- }
- MCU_Manufacturter_Struct_t IdentifyMCUManufacturer( void )
- {
- MCU_Manufacturter_Struct_t manufacturer = STM32F103RBT6;
- if( (*(uint8_t *)0xE00FFFD0 == 0x05)&&(*(uint8_t *)0xE00FFFE0 == 0x9B)&&(*(uint8_t *)0xE00FFFE4 == 0x52)&&(*(uint8_t *)0xE00FFFE8 == 0x05) )
- {
- manufacturer = HK32F103RBT6;
- MC_VerInfo.HW_Version[10] = '3';
- }
- else if( (*(uint32_t *)0xE0042000) == 0x13030410 )
- {
- manufacturer = GD32F103RBT6;
- MC_VerInfo.HW_Version[10] = '4';
- }
- else if( (*(uint8_t *)0xE00FFFD0 == 0x04)&&(*(uint8_t *)0xE00FFFE0 == 0xC3)&&(*(uint8_t *)0xE00FFFE4 == 0xB4)&&(*(uint8_t *)0xE00FFFE8 == 0x0B) )
- {
- manufacturer = APM32F103RBT6;
- MC_VerInfo.HW_Version[10] = '2';
- }
- else if( (*(uint8_t *)0xE00FFFD0 == 0x00)&&(*(uint8_t *)0xE00FFFE0 == 0x10)&&(*(uint8_t *)0xE00FFFE4 == 0x04)&&(*(uint8_t *)0xE00FFFE8 == 0x0A) ) //4̨ÑéÖ¤ÕýÈ·
- {
- manufacturer = STM32F103RBT6;
- MC_VerInfo.HW_Version[10] = '1';
- }
- else
- {
- manufacturer = NoName;
- MC_VerInfo.HW_Version[10] = '0';
- }
-
- return manufacturer;}
|