Changed permissions; updated DAC src
This commit is contained in:
parent
e7b8823c4f
commit
00e45fdb63
|
@ -1,81 +0,0 @@
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file IO_Toggle/stm32f0xx_conf.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @version V1.0.0
|
|
||||||
* @date 23-March-2012
|
|
||||||
* @brief Library configuration file.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
|
|
||||||
* You may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at:
|
|
||||||
*
|
|
||||||
* http://www.st.com/software_license_agreement_liberty_v2
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F0XX_CONF_H
|
|
||||||
#define __STM32F0XX_CONF_H
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
/* Comment the line below to disable peripheral header file inclusion */
|
|
||||||
#include "stm32f0xx_adc.h"
|
|
||||||
#include "stm32f0xx_cec.h"
|
|
||||||
#include "stm32f0xx_crc.h"
|
|
||||||
#include "stm32f0xx_comp.h"
|
|
||||||
#include "stm32f0xx_dac.h"
|
|
||||||
#include "stm32f0xx_dbgmcu.h"
|
|
||||||
#include "stm32f0xx_dma.h"
|
|
||||||
#include "stm32f0xx_exti.h"
|
|
||||||
#include "stm32f0xx_flash.h"
|
|
||||||
#include "stm32f0xx_gpio.h"
|
|
||||||
#include "stm32f0xx_syscfg.h"
|
|
||||||
#include "stm32f0xx_i2c.h"
|
|
||||||
#include "stm32f0xx_iwdg.h"
|
|
||||||
#include "stm32f0xx_pwr.h"
|
|
||||||
#include "stm32f0xx_rcc.h"
|
|
||||||
#include "stm32f0xx_rtc.h"
|
|
||||||
#include "stm32f0xx_spi.h"
|
|
||||||
#include "stm32f0xx_tim.h"
|
|
||||||
#include "stm32f0xx_usart.h"
|
|
||||||
#include "stm32f0xx_wwdg.h"
|
|
||||||
#include "stm32f0xx_misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/* Uncomment the line below to expanse the "assert_param" macro in the
|
|
||||||
Standard Peripheral Library drivers code */
|
|
||||||
/* #define USE_FULL_ASSERT 1 */
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
#ifdef USE_FULL_ASSERT
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The assert_param macro is used for function's parameters check.
|
|
||||||
* @param expr: If expr is false, it calls assert_failed function which reports
|
|
||||||
* the name of the source file and the source line number of the call
|
|
||||||
* that failed. If expr is true, it returns no value.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
|
|
||||||
/* Exported functions ------------------------------------------------------- */
|
|
||||||
void assert_failed(uint8_t* file, uint32_t line);
|
|
||||||
#else
|
|
||||||
#define assert_param(expr) ((void)0)
|
|
||||||
#endif /* USE_FULL_ASSERT */
|
|
||||||
|
|
||||||
#endif /* __STM32F0XX_CONF_H */
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
|
@ -10,7 +10,7 @@ CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m0 -march=armv6s-m
|
||||||
CFLAGS += -ffreestanding -nostdlib
|
CFLAGS += -ffreestanding -nostdlib
|
||||||
CFLAGS += -Iinc -Iinc/core -Iinc/peripherals
|
CFLAGS += -Iinc -Iinc/core -Iinc/peripherals
|
||||||
|
|
||||||
#SRCS = stm32f0_discovery.c
|
SRCS = stm32f0_discovery.c
|
||||||
SRCS = stm32f0xx_adc.c stm32f0xx_cec.c stm32f0xx_comp.c stm32f0xx_crc.c \
|
SRCS = stm32f0xx_adc.c stm32f0xx_cec.c stm32f0xx_comp.c stm32f0xx_crc.c \
|
||||||
stm32f0xx_dac.c stm32f0xx_dbgmcu.c stm32f0xx_dma.c stm32f0xx_exti.c \
|
stm32f0xx_dac.c stm32f0xx_dbgmcu.c stm32f0xx_dma.c stm32f0xx_exti.c \
|
||||||
stm32f0xx_flash.c stm32f0xx_gpio.c stm32f0xx_i2c.c stm32f0xx_iwdg.c \
|
stm32f0xx_flash.c stm32f0xx_gpio.c stm32f0xx_i2c.c stm32f0xx_iwdg.c \
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32f0xx_dac.c
|
* @file stm32f0xx_dac.c
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @version V1.0.0
|
* @version V1.0.1
|
||||||
* @date 23-March-2012
|
* @date 20-April-2012
|
||||||
* @brief This file provides firmware functions to manage the following
|
* @brief This file provides firmware functions to manage the following
|
||||||
* functionalities of the Digital-to-Analog Converter (DAC) peripheral:
|
* functionalities of the Digital-to-Analog Converter (DAC) peripheral:
|
||||||
* + DAC channel configuration: trigger, output buffer, data format
|
* + DAC channel configuration: trigger, output buffer, data format
|
||||||
|
@ -98,6 +98,7 @@
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "stm32f0xx_dac.h"
|
#include "stm32f0xx_dac.h"
|
||||||
|
#include "stm32f0xx_rcc.h"
|
||||||
|
|
||||||
/** @addtogroup STM32F0xx_StdPeriph_Driver
|
/** @addtogroup STM32F0xx_StdPeriph_Driver
|
||||||
* @{
|
* @{
|
||||||
|
@ -157,11 +158,10 @@ void DAC_DeInit(void)
|
||||||
* @brief Initializes the DAC peripheral according to the specified
|
* @brief Initializes the DAC peripheral according to the specified
|
||||||
* parameters in the DAC_InitStruct.
|
* parameters in the DAC_InitStruct.
|
||||||
* @param DAC_Channel: the selected DAC channel.
|
* @param DAC_Channel: the selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @param DAC_InitStruct: pointer to a DAC_InitTypeDef structure that
|
* @param DAC_InitStruct: pointer to a DAC_InitTypeDef structure that
|
||||||
* contains the configuration information for the specified DAC channel.
|
* contains the configuration information for the specified DAC channel.
|
||||||
*
|
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct)
|
void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct)
|
||||||
|
@ -194,7 +194,7 @@ void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Fills each DAC_InitStruct member with its default value.
|
* @brief Fills each DAC_InitStruct member with its default value.
|
||||||
* @param DAC_InitStruct : pointer to a DAC_InitTypeDef structure which will
|
* @param DAC_InitStruct: pointer to a DAC_InitTypeDef structure which will
|
||||||
* be initialized.
|
* be initialized.
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
|
@ -210,12 +210,11 @@ void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct)
|
||||||
/**
|
/**
|
||||||
* @brief Enables or disables the specified DAC channel.
|
* @brief Enables or disables the specified DAC channel.
|
||||||
* @param DAC_Channel: The selected DAC channel.
|
* @param DAC_Channel: The selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @param NewState: new state of the DAC channel.
|
* @param NewState: new state of the DAC channel.
|
||||||
* This parameter can be: ENABLE or DISABLE.
|
* This parameter can be: ENABLE or DISABLE.
|
||||||
* @note When the DAC channel is enabled the trigger source can no more
|
* @note When the DAC channel is enabled the trigger source can no more be modified.
|
||||||
* be modified.
|
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState)
|
void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState)
|
||||||
|
@ -239,10 +238,10 @@ void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState)
|
||||||
/**
|
/**
|
||||||
* @brief Enables or disables the selected DAC channel software trigger.
|
* @brief Enables or disables the selected DAC channel software trigger.
|
||||||
* @param DAC_Channel: the selected DAC channel.
|
* @param DAC_Channel: the selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @param NewState: new state of the selected DAC channel software trigger.
|
* @param NewState: new state of the selected DAC channel software trigger.
|
||||||
* This parameter can be: ENABLE or DISABLE.
|
* This parameter can be: ENABLE or DISABLE.
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState)
|
void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState)
|
||||||
|
@ -266,11 +265,11 @@ void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState)
|
||||||
/**
|
/**
|
||||||
* @brief Set the specified data holding register value for DAC channel1.
|
* @brief Set the specified data holding register value for DAC channel1.
|
||||||
* @param DAC_Align: Specifies the data alignment for DAC channel1.
|
* @param DAC_Align: Specifies the data alignment for DAC channel1.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Align_8b_R: 8bit right data alignment selected
|
* @arg DAC_Align_8b_R: 8bit right data alignment selected
|
||||||
* @arg DAC_Align_12b_L: 12bit left data alignment selected
|
* @arg DAC_Align_12b_L: 12bit left data alignment selected
|
||||||
* @arg DAC_Align_12b_R: 12bit right data alignment selected
|
* @arg DAC_Align_12b_R: 12bit right data alignment selected
|
||||||
* @param Data : Data to be loaded in the selected data holding register.
|
* @param Data: Data to be loaded in the selected data holding register.
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data)
|
void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data)
|
||||||
|
@ -291,8 +290,8 @@ void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data)
|
||||||
/**
|
/**
|
||||||
* @brief Returns the last data output value of the selected DAC channel.
|
* @brief Returns the last data output value of the selected DAC channel.
|
||||||
* @param DAC_Channel: the selected DAC channel.
|
* @param DAC_Channel: the selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @retval The selected DAC channel data output value.
|
* @retval The selected DAC channel data output value.
|
||||||
*/
|
*/
|
||||||
uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel)
|
uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel)
|
||||||
|
@ -330,11 +329,11 @@ uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel)
|
||||||
* When enabled DMA1 is generated when an external trigger (EXTI Line9,
|
* When enabled DMA1 is generated when an external trigger (EXTI Line9,
|
||||||
* TIM2, TIM3, TIM6 or TIM15 but not a software trigger) occurs
|
* TIM2, TIM3, TIM6 or TIM15 but not a software trigger) occurs
|
||||||
* @param DAC_Channel: the selected DAC channel.
|
* @param DAC_Channel: the selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @param NewState: new state of the selected DAC channel DMA request.
|
* @param NewState: new state of the selected DAC channel DMA request.
|
||||||
* This parameter can be: ENABLE or DISABLE.
|
* This parameter can be: ENABLE or DISABLE.
|
||||||
* The DAC channel1 is mapped on DMA1 channel3 which must be already configured.
|
* @note The DAC channel1 is mapped on DMA1 channel3 which must be already configured.
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState)
|
void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState)
|
||||||
|
@ -374,15 +373,15 @@ void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState)
|
||||||
/**
|
/**
|
||||||
* @brief Enables or disables the specified DAC interrupts.
|
* @brief Enables or disables the specified DAC interrupts.
|
||||||
* @param DAC_Channel: the selected DAC channel.
|
* @param DAC_Channel: the selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @param DAC_IT: specifies the DAC interrupt sources to be enabled or disabled.
|
* @param DAC_IT: specifies the DAC interrupt sources to be enabled or disabled.
|
||||||
* This parameter can be the following values:
|
* This parameter can be the following values:
|
||||||
* @arg DAC_IT_DMAUDR: DMA underrun interrupt mask
|
* @arg DAC_IT_DMAUDR: DMA underrun interrupt mask
|
||||||
* @note The DMA underrun occurs when a second external trigger arrives before
|
* @note The DMA underrun occurs when a second external trigger arrives before
|
||||||
* the acknowledgement for the first external trigger is received (first request).
|
* the acknowledgement for the first external trigger is received (first request).
|
||||||
* @param NewState: new state of the specified DAC interrupts.
|
* @param NewState: new state of the specified DAC interrupts.
|
||||||
* This parameter can be: ENABLE or DISABLE.
|
* This parameter can be: ENABLE or DISABLE.
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState)
|
void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState)
|
||||||
|
@ -407,13 +406,13 @@ void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewStat
|
||||||
/**
|
/**
|
||||||
* @brief Checks whether the specified DAC flag is set or not.
|
* @brief Checks whether the specified DAC flag is set or not.
|
||||||
* @param DAC_Channel: thee selected DAC channel.
|
* @param DAC_Channel: thee selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @param DAC_FLAG: specifies the flag to check.
|
* @param DAC_FLAG: specifies the flag to check.
|
||||||
* This parameter can be only of the following value:
|
* This parameter can be only of the following value:
|
||||||
* @arg DAC_FLAG_DMAUDR: DMA underrun flag
|
* @arg DAC_FLAG_DMAUDR: DMA underrun flag
|
||||||
* @note The DMA underrun occurs when a second external trigger arrives before
|
* @note The DMA underrun occurs when a second external trigger arrives before
|
||||||
* the acknowledgement for the first external trigger is received (first request).
|
* the acknowledgement for the first external trigger is received (first request).
|
||||||
* @retval The new state of DAC_FLAG (SET or RESET).
|
* @retval The new state of DAC_FLAG (SET or RESET).
|
||||||
*/
|
*/
|
||||||
FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG)
|
FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG)
|
||||||
|
@ -442,11 +441,11 @@ FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG)
|
||||||
/**
|
/**
|
||||||
* @brief Clears the DAC channel's pending flags.
|
* @brief Clears the DAC channel's pending flags.
|
||||||
* @param DAC_Channel: the selected DAC channel.
|
* @param DAC_Channel: the selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @param DAC_FLAG: specifies the flag to clear.
|
* @param DAC_FLAG: specifies the flag to clear.
|
||||||
* This parameter can be of the following value:
|
* This parameter can be of the following value:
|
||||||
* @arg DAC_FLAG_DMAUDR: DMA underrun flag
|
* @arg DAC_FLAG_DMAUDR: DMA underrun flag
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG)
|
void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG)
|
||||||
|
@ -462,13 +461,13 @@ void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG)
|
||||||
/**
|
/**
|
||||||
* @brief Checks whether the specified DAC interrupt has occurred or not.
|
* @brief Checks whether the specified DAC interrupt has occurred or not.
|
||||||
* @param DAC_Channel: the selected DAC channel.
|
* @param DAC_Channel: the selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @param DAC_IT: specifies the DAC interrupt source to check.
|
* @param DAC_IT: specifies the DAC interrupt source to check.
|
||||||
* This parameter can be the following values:
|
* This parameter can be the following values:
|
||||||
* @arg DAC_IT_DMAUDR: DMA underrun interrupt mask
|
* @arg DAC_IT_DMAUDR: DMA underrun interrupt mask
|
||||||
* @note The DMA underrun occurs when a second external trigger arrives before
|
* @note The DMA underrun occurs when a second external trigger arrives before
|
||||||
* the acknowledgement for the first external trigger is received (first request).
|
* the acknowledgement for the first external trigger is received (first request).
|
||||||
* @retval The new state of DAC_IT (SET or RESET).
|
* @retval The new state of DAC_IT (SET or RESET).
|
||||||
*/
|
*/
|
||||||
ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT)
|
ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT)
|
||||||
|
@ -501,11 +500,11 @@ ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT)
|
||||||
/**
|
/**
|
||||||
* @brief Clears the DAC channel's interrupt pending bits.
|
* @brief Clears the DAC channel's interrupt pending bits.
|
||||||
* @param DAC_Channel: the selected DAC channel.
|
* @param DAC_Channel: the selected DAC channel.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg DAC_Channel_1: DAC Channel1 selected
|
* @arg DAC_Channel_1: DAC Channel1 selected
|
||||||
* @param DAC_IT: specifies the DAC interrupt pending bit to clear.
|
* @param DAC_IT: specifies the DAC interrupt pending bit to clear.
|
||||||
* This parameter can be the following values:
|
* This parameter can be the following values:
|
||||||
* @arg DAC_IT_DMAUDR: DMA underrun interrupt mask
|
* @arg DAC_IT_DMAUDR: DMA underrun interrupt mask
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT)
|
void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT)
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
* @date 23-March-2012
|
* @date 23-March-2012
|
||||||
* @brief STM32F0xx Devices vector table for RIDE7 toolchain.
|
* @brief STM32F0xx Devices vector table for Atollic toolchain.
|
||||||
* This module performs:
|
* This module performs:
|
||||||
* - Set the initial SP
|
* - Set the initial SP
|
||||||
* - Set the initial PC == Reset_Handler,
|
* - Set the initial PC == Reset_Handler,
|
||||||
* - Set the vector table entries with the exceptions ISR address
|
* - Set the vector table entries with the exceptions ISR address
|
||||||
|
* - Configure the clock system
|
||||||
* - Branches to main in the C library (which eventually
|
* - Branches to main in the C library (which eventually
|
||||||
* calls main()).
|
* calls main()).
|
||||||
* After Reset the Cortex-M0 processor is in Thread mode,
|
* After Reset the Cortex-M0 processor is in Thread mode,
|
||||||
|
@ -63,10 +64,12 @@ defined in linker script */
|
||||||
* @retval : None
|
* @retval : None
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.section .text.Reset_Handler
|
.section .text.Reset_Handler
|
||||||
.weak Reset_Handler
|
.weak Reset_Handler
|
||||||
.type Reset_Handler, %function
|
.type Reset_Handler, %function
|
||||||
Reset_Handler:
|
Reset_Handler:
|
||||||
|
ldr r0, =_estack
|
||||||
|
mov sp, r0 /* set stack pointer */
|
||||||
|
|
||||||
/* Copy the data segment initializers from flash to SRAM */
|
/* Copy the data segment initializers from flash to SRAM */
|
||||||
movs r1, #0
|
movs r1, #0
|
||||||
|
@ -89,17 +92,26 @@ LoopCopyDataInit:
|
||||||
/* Zero fill the bss segment. */
|
/* Zero fill the bss segment. */
|
||||||
FillZerobss:
|
FillZerobss:
|
||||||
movs r3, #0
|
movs r3, #0
|
||||||
str r3, [r2], #4
|
str r3, [r2]
|
||||||
|
adds r2, r2, #4
|
||||||
|
|
||||||
|
|
||||||
LoopFillZerobss:
|
LoopFillZerobss:
|
||||||
ldr r3, = _ebss
|
ldr r3, = _ebss
|
||||||
cmp r2, r3
|
cmp r2, r3
|
||||||
bcc FillZerobss
|
bcc FillZerobss
|
||||||
|
|
||||||
/* Call the clock system intitialization function.*/
|
/* Call the clock system intitialization function.*/
|
||||||
bl SystemInit
|
bl SystemInit
|
||||||
|
/* Call static constructors */
|
||||||
|
bl __libc_init_array
|
||||||
/* Call the application's entry point.*/
|
/* Call the application's entry point.*/
|
||||||
bl main
|
bl main
|
||||||
bx lr
|
|
||||||
|
LoopForever:
|
||||||
|
b LoopForever
|
||||||
|
|
||||||
|
|
||||||
.size Reset_Handler, .-Reset_Handler
|
.size Reset_Handler, .-Reset_Handler
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,20 +120,21 @@ LoopFillZerobss:
|
||||||
* the system state for examination by a debugger.
|
* the system state for examination by a debugger.
|
||||||
*
|
*
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval : None
|
||||||
*/
|
*/
|
||||||
.section .text.Default_Handler,"ax",%progbits
|
.section .text.Default_Handler,"ax",%progbits
|
||||||
Default_Handler:
|
Default_Handler:
|
||||||
Infinite_Loop:
|
Infinite_Loop:
|
||||||
b Infinite_Loop
|
b Infinite_Loop
|
||||||
.size Default_Handler, .-Default_Handler
|
.size Default_Handler, .-Default_Handler
|
||||||
/*******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* The minimal vector table for a Cortex M0. Note that the proper constructs
|
* The minimal vector table for a Cortex M0. Note that the proper constructs
|
||||||
* must be placed on this to ensure that it ends up at physical address
|
* must be placed on this to ensure that it ends up at physical address
|
||||||
* 0x0000.0000.
|
* 0x0000.0000.
|
||||||
*******************************************************************************/
|
*
|
||||||
.section .isr_vector,"a",%progbits
|
******************************************************************************/
|
||||||
|
.section .isr_vector,"a",%progbits
|
||||||
.type g_pfnVectors, %object
|
.type g_pfnVectors, %object
|
||||||
.size g_pfnVectors, .-g_pfnVectors
|
.size g_pfnVectors, .-g_pfnVectors
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "stm32f4xx_conf.h"
|
#include "stm32f0xx_conf.h"
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include "stm32f4xx_conf.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
//#elif CONFIG_STM32F0_DISCOVERY
|
||||||
|
//
|
||||||
|
//#define GPIOC 0x48000800 /* port C */
|
||||||
|
//#define GPIOC_MODER (GPIOC + 0x00) /* port mode register */
|
||||||
|
//#define LED_PORT_ODR (GPIOC + 0x14) /* port output data register */
|
||||||
|
//
|
||||||
|
//#define LED_BLUE (1 << 8) /* port C, pin 8 */
|
||||||
|
//#define LED_GREEN (1 << 9) /* port C, pin 9 */
|
||||||
|
//#define LED_ORANGE 0
|
||||||
|
//#define LED_RED 0
|
||||||
|
|
||||||
|
GPIOC->MODER = (1 << 16);
|
||||||
|
|
||||||
|
while(1) GPIOC->ODR ^= (1 << 16);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue