123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #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) ) //2̨ÑéÖ¤ÕýÈ·
- {
- manufacturer = HK32F103RBT6;
- }
- else if( (*(uint8_t *)0xE00FFFD0 == 0x04)&&(*(uint8_t *)0xE00FFFE0 == 0xC3)&&(*(uint8_t *)0xE00FFFE4 == 0xB4)&&(*(uint8_t *)0xE00FFFE8 == 0x0B) ) //4̨ÑéÖ¤ÕýÈ·
- {
- if(*(uint16_t*)(0x1FFFF7E0) == 0x0080)
- manufacturer = APM32F103RBT6;
- else if(*(uint16_t*)(0x1FFFF7E0) == 0x0100)
- manufacturer = APM32F103RCT7;
- }
- else if( (*(uint8_t *)0xE00FFFD0 == 0x00)&&(*(uint8_t *)0xE00FFFE0 == 0x10)&&(*(uint8_t *)0xE00FFFE4 == 0x04)&&(*(uint8_t *)0xE00FFFE8 == 0x0A) ) //4̨ÑéÖ¤ÕýÈ·
- {
- manufacturer = STM32F103RBT6;
- }
- else if( (*(uint32_t *)0xE0042000) == 0x13030410 ) //2̨ÑéÖ¤ÕýÈ·
- {
- manufacturer = GD32F103RBT6;
- }
- else
- {
- manufacturer = NoName;
- }
- return manufacturer;
- }
|