/**
******************************************************************************
* @file system_stm32f1xx.c
* @author MCD Application Team
* @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Source File.
*
* 1. This file provides two functions and one global variable to be called from
* user application:
* - SystemInit(): Setups the system clock (System clock source, PLL Multiplier
* factors, AHB/APBx prescalers and Flash settings).
* This function is called at startup just after reset and
* before branch to main program. This call is made inside
* the "startup_stm32f1xx_xx.s" file.
*
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
* by the user application to setup the SysTick
* timer or configure other parameters.
*
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
* be called whenever the core clock is changed
* during program execution.
*
* 2. After each device reset the HSI (8 MHz) is used as system clock source.
* Then SystemInit() function is called, in "startup_stm32f1xx_xx.s" file, to
* configure the system clock before to branch to main program.
*
* 4. The default value of HSE crystal is set to 8 MHz (or 25 MHz, depending on
* the product used), refer to "HSE_VALUE".
* When HSE is used as system clock source, directly or through PLL, and you
* are using different crystal you have to adapt the HSE value to your own
* configuration.
*
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/
/** @addtogroup stm32f1xx_system
* @{
*/
/** @addtogroup STM32F1xx_System_Private_Includes
* @{
*/
#include "stm32f1xx.h"
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_Defines
* @{
*/
#if !defined (HSE_VALUE)
#define HSE_VALUE 8000000U /*!< Default value of the External oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSE_VALUE */
#if !defined (HSI_VALUE)
#define HSI_VALUE 8000000U /*!< Default value of the Internal oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSI_VALUE */
/*!< Uncomment the following line if you need to use external SRAM */
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
/* #define DATA_IN_ExtSRAM */
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
/* Note: Following vector table addresses must be defined in line with linker
configuration. */
/*!< Uncomment the following line if you need to relocate the vector table
anywhere in Flash or Sram, else the vector table is kept at the automatic
remap of boot address selected */
/* #define USER_VECT_TAB_ADDRESS */
#if defined(USER_VECT_TAB_ADDRESS)
/*!< Uncomment the following line if you need to relocate your vector Table
in Sram else user remap will be done in Flash. */
/* #define VECT_TAB_SRAM */
#if defined(VECT_TAB_SRAM)
#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#else
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#endif /* VECT_TAB_SRAM */
#endif /* USER_VECT_TAB_ADDRESS */
/******************************************************************************/
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_Macros
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_Variables
* @{
*/
/* This variable is updated in three ways:
1) by calling CMSIS function SystemCoreClockUpdate()
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
Note: If you use this function to configure the system clock; then there
is no need to call the 2 first functions listed above, since SystemCoreClock
variable is updated automatically.
*/
uint32_t SystemCoreClock = 16000000;
const uint8_t AHBPrescTable[16U] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
const uint8_t APBPrescTable[8U] = {0, 0, 0, 0, 1, 2, 3, 4};
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_FunctionPrototypes
* @{
*/
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
#ifdef DATA_IN_ExtSRAM
static void SystemInit_ExtMemCtl(void);
#endif /* DATA_IN_ExtSRAM */
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_Functions
* @{
*/
/**
* @brief Setup the microcontroller system
* Initialize the Embedded Flash Interface, the PLL and update the
* SystemCoreClock variable.
* @note This function should be used only after reset.
* @param None
* @retval None
*/
void SystemInit (void)
{
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
#ifdef DATA_IN_ExtSRAM
SystemInit_ExtMemCtl();
#endif /* DATA_IN_ExtSRAM */
#endif
/* Configure the Vector Table location -------------------------------------*/
#if defined(USER_VECT_TAB_ADDRESS)
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */
#endif /* USER_VECT_TAB_ADDRESS */
}
/**
* @brief Update SystemCoreClock variable according to Clock Register Values.
* The SystemCoreClock variable contains the core clock (HCLK), it can
* be used by the user application to setup the SysTick timer or configure
* other parameters.
*
* @note Each time the core clock (HCLK) changes, this function must be called
* to update SystemCoreClock variable value. Otherwise, any configuration
* based on this variable will be incorrect.
*
* @note - The system frequency computed by this function is not the real
* frequency in the chip. It is calculated based on the predefined
* constant and the selected clock source:
*
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
*
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于stm32f103的 ICM20602驱动程序工程 (114个子文件)
icm20602forf103.axf 586KB
icm20602forf103_sct.Bak 478B
system_stm32f1xx.c 14KB
icm20602.c 10KB
main.c 6KB
stm32f1xx_it.c 5KB
attitude_solution.c 5KB
spi.c 3KB
usart.c 3KB
stm32f1xx_hal_msp.c 2KB
gpio.c 2KB
stm32f1xx_hal_spi.crf 594KB
stm32f1xx_hal_uart.crf 586KB
stm32f1xx_hal_dma.crf 581KB
stm32f1xx_hal_rcc.crf 580KB
main.crf 578KB
stm32f1xx_hal_flash_ex.crf 574KB
icm20602.crf 574KB
stm32f1xx_hal_flash.crf 573KB
stm32f1xx_hal_gpio.crf 572KB
stm32f1xx_hal_exti.crf 572KB
stm32f1xx_hal_pwr.crf 571KB
stm32f1xx_hal_rcc_ex.crf 571KB
stm32f1xx_hal.crf 570KB
spi.crf 570KB
usart.crf 570KB
gpio.crf 570KB
stm32f1xx_hal_cortex.crf 569KB
stm32f1xx_it.crf 569KB
stm32f1xx_hal_msp.crf 569KB
system_stm32f1xx.crf 569KB
stm32f1xx_hal_gpio_ex.crf 569KB
stm32f1xx_hal_tim_ex.crf 568KB
stm32f1xx_hal_tim.crf 568KB
attitude_solution.crf 16KB
stm32f1xx_hal_flash_ex.d 3KB
stm32f1xx_hal_gpio_ex.d 3KB
stm32f1xx_hal_cortex.d 3KB
stm32f1xx_hal_rcc_ex.d 3KB
stm32f1xx_hal_tim_ex.d 3KB
stm32f1xx_hal_flash.d 3KB
stm32f1xx_hal_msp.d 3KB
stm32f1xx_hal_exti.d 3KB
stm32f1xx_hal_gpio.d 3KB
stm32f1xx_hal_uart.d 3KB
stm32f1xx_hal_tim.d 2KB
stm32f1xx_hal_pwr.d 2KB
stm32f1xx_hal_rcc.d 2KB
stm32f1xx_hal_spi.d 2KB
stm32f1xx_hal_dma.d 2KB
system_stm32f1xx.d 2KB
main.d 2KB
stm32f1xx_it.d 2KB
stm32f1xx_hal.d 2KB
icm20602.d 2KB
usart.d 2KB
gpio.d 2KB
spi.d 2KB
attitude_solution.d 273B
startup_stm32f103xe.d 62B
icm20602forf103_STM32F103VE.dbgconf 7KB
icm20602forf103_STM32F103VE_1.0.0.dbgconf 2KB
icm20602forf103_icm20602forf103.dep 59KB
stm32f1xx_hal_conf.h 15KB
icm20602.h 4KB
main.h 2KB
stm32f1xx_it.h 2KB
usart.h 1KB
spi.h 1KB
gpio.h 1KB
RTE_Components.h 362B
RTE_Components.h 342B
attitude_solution.h 309B
icm20602forf103.hex 39KB
icm20602forf103.htm 74KB
icm20602forf103.build_log.htm 3KB
ExtDll.iex 17B
icm20602forf103.ioc 5KB
icm20602forf103.lnp 1KB
startup_stm32f103xe.lst 46KB
icm20602forf103.map 160KB
.mxproject 7KB
stm32f1xx_hal_spi.o 725KB
stm32f1xx_hal_uart.o 719KB
stm32f1xx_hal.o 671KB
stm32f1xx_hal_pwr.o 662KB
stm32f1xx_hal_cortex.o 661KB
stm32f1xx_hal_rcc.o 661KB
stm32f1xx_hal_dma.o 660KB
stm32f1xx_hal_flash.o 659KB
stm32f1xx_hal_flash_ex.o 658KB
icm20602.o 654KB
main.o 653KB
stm32f1xx_hal_exti.o 651KB
stm32f1xx_hal_gpio.o 651KB
stm32f1xx_it.o 649KB
usart.o 643KB
spi.o 643KB
stm32f1xx_hal_rcc_ex.o 643KB
stm32f1xx_hal_gpio_ex.o 641KB
共 114 条
- 1
- 2
资源评论
DreamGoo
- 粉丝: 5
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功