Changeset - a3acc7c3a063
[Not reviewed]
cortex-f0
4 2 3
Ethan Zonca - 10 years ago 2015-01-03 00:12:55
ez@ethanzonca.com
Removed old system files, fixed _it files
8 files changed with 162 insertions and 597 deletions:
0 comments (0 inline, 0 general)
Makefile
Show inline comments
 

	
 
TARGET:=therm
 
TOOLCHAIN_PATH:=/usr/bin
 
TOOLCHAIN_PREFIX:=arm-none-eabi
 
OPTLVL:=3 # Optimization level, can be [0, 1, 2, 3, s].
 

	
 
#PROJECT_NAME:=$(notdir $(lastword $(CURDIR)))
 
TOP:=$(shell readlink -f "../..")
 
STMLIB:=libraries
 
OLEDDRV:=oleddrv
 
USBDRV:=USB
 
STD_PERIPH:=$(STMLIB)/STM32F0xx_StdPeriph_Driver
 
STARTUP:=$(STMLIB)/CMSIS/Device/ST/STM32F0xx/Source/Templates/gcc_ride7
 
LINKER_SCRIPT:=$(CURDIR)/stm32-flash.ld
 
#LINKER_SCRIPT:=$(CURDIR)/../stm32_flash.ld
 

	
 
INCLUDE=-I$(CURDIR)
 
INCLUDE+=-I$(STMLIB)/CMSIS/Include
 
INCLUDE+=-I$(STMLIB)/CMSIS/Device/ST/STM32F0xx/Include
 
INCLUDE+=-I$(STD_PERIPH)/inc
 
INCLUDE+=-I$(STMLIB)/$(OLEDDRV)
 
INCLUDE+=-I$(STMLIB)/$(USBDRV)
 

	
 
# vpath is used so object files are written to the current directory instead
 
# of the same directory as their source files
 
vpath %.c $(DISCOVERY) $(STD_PERIPH)/src \
 
          $(STMLIB)/USB \
 
          $(STMLIB)/STM32_USB-FS_Device_Library/Class/hid/src \
 
          $(STMLIB)/STM32_USB-FS_Device_Library/Core/src
 
vpath %.s $(STARTUP)
 

	
 
ASRC=startup_stm32f042.s
 

	
 
# Project Source Files
 
SRC=main.c
 
SRC+=stm32l1xx_it.c
 
SRC+=system_stm32l1xx.c
 
SRC+=stm32l100c_discovery.c
 
SRC+=stm32f0xx_it.c
 
SRC+=system_stm32f0xx.c
 
SRC+=ssd1306.c
 
SRC+=eeprom_min.c
 
SRC+=gpio.c
 
SRC+=spi.c
 
SRC+=stringhelpers.c
 

	
 
# Discovery Source Files
 
#SRC+=stm32f4_discovery_lis302dl.c
 
#SRC+=stm32f4_discovery.c
 
#SRC+=stm32f4_discovery_audio_codec.c
 

	
 
# Standard Peripheral Source Files
 
SRC+=stm32f0xx_syscfg.c
 
SRC+=misc.c
 
SRC+=stm32f0xx_adc.c
 
SRC+=stm32f0xx_dac.c
 
SRC+=stm32f0xx_dma.c
 
SRC+=stm32f0xx_exti.c
 
SRC+=stm32f0xx_flash.c
 
SRC+=stm32f0xx_gpio.c
 
SRC+=stm32f0xx_i2c.c
 
SRC+=stm32f0xx_rcc.c
 
SRC+=stm32f0xx_spi.c
 
SRC+=stm32f0xx_tim.c
 

	
 
# USB Source Files
 
SRC+=usb_core.c
 
SRC+=usb_init.c
 
SRC+=usb_int.c
 
SRC+=usb_mem.c
 
SRC+=usb_regs.c
 
SRC+=usb_sil.c
 
SRC+=hw_config.c
 
SRC+=usb_desc.c
 
SRC+=usb_endp.c
 
SRC+=usb_istr.c
 
SRC+=usb_prop.c
 
SRC+=usb_pwr.c
 

	
 
CDEFS=-DUSE_STDPERIPH_DRIVER
 
CDEFS+=-DSTM32F0XX
 
CDEFS+=-DMANGUSTA_DISCOVERY
 
#CDEFS+=-DUSE_USB_OTG_FS
 

	
 
# EMZ FIXME
 
CDEFS+=-DHSE_VALUE=8000000
 

	
 

	
 
#EMZ Optimized: 
 
MCUFLAGS=-mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections -mfloat-abi=soft
 

	
 
# Default:  MCUFLAGS=-mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections
 

	
 
#MCUFLAGS=-mcpu=cortex-m4 -mthumb -mlittle-endian -mfpu=fpa -mfloat-abi=hard -mthumb-interwork
 
#MCUFLAGS=-mcpu=cortex-m4 -mfpu=vfpv4-sp-d16 -mfloat-abi=hard
 
COMMONFLAGS=-O$(OPTLVL) -g -Wall
 
CFLAGS=$(COMMONFLAGS) $(MCUFLAGS) $(INCLUDE) $(CDEFS)
 

	
 
LDLIBS=
 
LDFLAGS=$(COMMONFLAGS) -fno-exceptions -ffunction-sections -fdata-sections \
 
        -nostartfiles -Wl,--gc-sections,-T$(LINKER_SCRIPT)
 

	
 
#####
 
#####
 

	
 
OBJ = $(SRC:%.c=%.o) $(ASRC:%.s=%.o)
 

	
 
CC=$(TOOLCHAIN_PATH)/$(TOOLCHAIN_PREFIX)-gcc
 
LD=$(TOOLCHAIN_PATH)/$(TOOLCHAIN_PREFIX)-gcc
 
OBJCOPY=$(TOOLCHAIN_PATH)/$(TOOLCHAIN_PREFIX)-objcopy
 
AS=$(TOOLCHAIN_PATH)/$(TOOLCHAIN_PREFIX)-as
 
AR=$(TOOLCHAIN_PATH)/$(TOOLCHAIN_PREFIX)-ar
 
GDB=$(TOOLCHAIN_PATH)/$(TOOLCHAIN_PREFIX)-gdb
 
SIZE=$(TOOLCHAIN_PATH)/$(TOOLCHAIN_PREFIX)-size
 

	
 

	
 
all: $(OBJ)
 
	$(CC) -o $(TARGET).elf $(LDFLAGS) $(OBJ)	$(LDLIBS)
 
	$(OBJCOPY) -O ihex   $(TARGET).elf $(TARGET).hex
 
	$(OBJCOPY) -O binary $(TARGET).elf $(TARGET).bin
 

	
 
.PHONY: clean
 

	
 
clean:
 
	rm -f $(OBJ)
 
	rm -f $(TARGET).elf
 
	rm -f $(TARGET).hex
 
	rm -f $(TARGET).bin
 

	
 
# Display size
 
size: $(TARGET).elf
 
	@echo Invoking: ARM GNU Print Size
 
	$(SIZE) --format=berkeley $<
 
	@echo
platform_config.h
Show inline comments
 
/**
 
  ******************************************************************************
 
  * @file    platform_config.h
 
  * @author  MCD Application Team
 
  * @version V4.0.0
 
  * @date    21-January-2013
 
  * @brief   Evaluation board specific configuration file.
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; COPYRIGHT 2013 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 __PLATFORM_CONFIG_H
 
#define __PLATFORM_CONFIG_H
 
 
/* Includes ------------------------------------------------------------------*/
 
#include "stm32l1xx.h"
 
#include "stm32f0xx.h"
 
 
/* Exported types ------------------------------------------------------------*/
 
 
/*Unique Devices IDs register set*/
 
#define         ID1          (0x1FF80050)
 
#define         ID2          (0x1FF80054)
 
#define         ID3          (0x1FF80064)
 
 
#if !defined(USB_USE_EXTERNAL_PULLUP)
 
  #define STM32L15_USB_CONNECT                SYSCFG_USBPuCmd(ENABLE)
 
  #define STM32L15_USB_DISCONNECT             SYSCFG_USBPuCmd(DISABLE)
 
 
#elif defined(USB_USE_EXTERNAL_PULLUP)
 
  /* PA0 is chosen just as illustrating example, you should modify the defines
 
    below according to your hardware configuration. */ 
 
  #define USB_DISCONNECT                      GPIOA
 
  #define USB_DISCONNECT_PIN                  GPIO_Pin_0
 
  #define RCC_AHBPeriph_GPIO_DISCONNECT       RCC_AHBPeriph_GPIOA
 
  #define STM32L15_USB_CONNECT                GPIO_ResetBits(USB_DISCONNECT, USB_DISCONNECT_PIN)
 
  #define STM32L15_USB_DISCONNECT             GPIO_SetBits(USB_DISCONNECT, USB_DISCONNECT_PIN)
 
#endif /* USB_USE_EXTERNAL_PULLUP */
 
 
/* Exported macro ------------------------------------------------------------*/
 
/* Exported functions ------------------------------------------------------- */
 
 
#endif /* __PLATFORM_CONFIG_H */
 
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32f0xx_conf.h
Show inline comments
 
new file 100644
 
/**
 
  ******************************************************************************
 
  * @file    stm32F0xx_conf.h
 
  * @author  MCD Application Team
 
  * @version V1.0.0
 
  * @date    23-March-2012
 
  * @brief   Library configuration file.
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; 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****/
 

	
stm32f0xx_it.c
Show inline comments
 
file renamed from stm32l1xx_it.c to stm32f0xx_it.c
 
/**
 
  ******************************************************************************
 
  * @file    stm32l1xx_it.c 
 
  * @file    stm32f0xx_it.c 
 
  * @author  MCD Application Team
 
  * @version V1.0.0
 
  * @date    29-July-2013
 
  * @brief   Main Interrupt Service Routines.
 
  *          This file provides template for all exceptions handler and 
 
  *          peripherals interrupt service routine.
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; COPYRIGHT 2013 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.
 
  *
 
  ******************************************************************************
 
  */
 
 
/* Includes ------------------------------------------------------------------*/
 
#include "hw_config.h"
 
#include "stm32l1xx_it.h"
 
#include "stm32f0xx_it.h"
 
#include "main.h"
 
#include "usb_lib.h"
 
#include "usb_istr.h"
 
 
/** @addtogroup STM32L100C-Discovery_Demo
 
  * @{
 
  */
 
//#include "usb_lib.h"
 
//#include "usb_istr.h"
 
 
/* Private typedef -----------------------------------------------------------*/
 
/* Private define ------------------------------------------------------------*/
 
/* Private macro -------------------------------------------------------------*/
 
/* Private variables ---------------------------------------------------------*/
 
/* Private function prototypes -----------------------------------------------*/
 
/* Private functions ---------------------------------------------------------*/
 
 
/******************************************************************************/
 
/*            Cortex-M3 Processor Exceptions Handlers                         */
 
/******************************************************************************/
 
 
/**
 
  * @brief  This function handles NMI exception.
 
  * @param  None
 
  * @retval None
 
  */
 
void NMI_Handler(void)
 
{
 
}
 
 
/**
 
  * @brief  This function handles Hard Fault exception.
 
  * @param  None
 
  * @retval None
 
  */
 
void HardFault_Handler(void)
 
{
 
  /* Go to infinite loop when Hard Fault exception occurs */
 
  while (1)
 
  {
 
  }
 
}
 
 
/**
 
  * @brief  This function handles Memory Manage exception.
 
  * @param  None
 
  * @retval None
 
  */
 
void MemManage_Handler(void)
 
{
 
  /* Go to infinite loop when Memory Manage exception occurs */
 
  while (1)
 
  {
 
  }
 
}
 
 
/**
 
  * @brief  This function handles Bus Fault exception.
 
  * @param  None
 
  * @retval None
 
  */
 
void BusFault_Handler(void)
 
{
 
  /* Go to infinite loop when Bus Fault exception occurs */
 
  while (1)
 
  {
 
  }
 
}
 
 
/**
 
  * @brief  This function handles Usage Fault exception.
 
  * @param  None
 
  * @retval None
 
  */
 
void UsageFault_Handler(void)
 
{
 
  /* Go to infinite loop when Usage Fault exception occurs */
 
  while (1)
 
  {
 
  }
 
}
 
 
/**
 
  * @brief  This function handles SVCall exception.
 
  * @param  None
 
  * @retval None
 
  */
 
void SVC_Handler(void)
 
{
 
}
 
 
/**
 
  * @brief  This function handles Debug Monitor exception.
 
  * @param  None
 
  * @retval None
 
  */
 
void DebugMon_Handler(void)
 
{
 
}
 
 
/**
 
  * @brief  This function handles PendSVC exception.
 
  * @param  None
 
  * @retval None
 
  */
 
void PendSV_Handler(void)
 
{
 
}
 
 
/**
 
  * @brief  This function handles SysTick Handler.
 
  * @param  None
 
  * @retval None
 
  */
 
void SysTick_Handler(void)
 
{
 
  TimingDelay_Decrement();
 
}
 
 
 
 
 
 
 
/*******************************************************************************
 
* Function Name  : USB_IRQHandler
 
* Description    : This function handles USB Low Priority interrupts
 
*                  requests.
 
* Input          : None
 
* Output         : None
 
* Return         : None
 
*******************************************************************************/
 
void USB_LP_IRQHandler(void)
 
{
 
  USB_Istr();
 
}
 
//void USB_LP_IRQHandler(void)
 
//{
 
//  USB_Istr();
 
//}
 
 
/*******************************************************************************
 
* Function Name  : USB_FS_WKUP_IRQHandler
 
* Description    : This function handles USB WakeUp interrupt request.
 
* Input          : None
 
* Output         : None
 
* Return         : None
 
*******************************************************************************/
 
void USB_FS_WKUP_IRQHandler(void)
 
{
 
  EXTI_ClearITPendingBit(EXTI_Line18);
 
}
 
//void USB_FS_WKUP_IRQHandler(void)
 
//{
 
//  EXTI_ClearITPendingBit(EXTI_Line18);
 
//}
 
 
 
 
 
 
 
/******************************************************************************/
 
/*                 STM32L1xx Peripherals Interrupt Handlers                   */
 
/*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */
 
/*  available peripheral interrupt handler's name please refer to the startup */
 
/*  file (startup_stm32l1xx_xx.s).                                            */
 
/******************************************************************************/
 
 
/**
 
  * @brief  This function handles PPP interrupt request.
 
  * @param  None
 
  * @retval None
 
  */
 
/*void PPP_IRQHandler(void)
 
{
 
}*/
 
 
/**
 
  * @}
 
  */ 
 
 
 
 
 
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32f0xx_it.h
Show inline comments
 
new file 100644
 
/**
 
  ******************************************************************************
 
  * @file    stm32f0xx_it.h 
 
  * @author  MCD Application Team
 
  * @version V1.0.0
 
  * @date    29-July-2013
 
  * @brief   This file contains the headers of the interrupt handlers.
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; COPYRIGHT 2013 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_IT_H
 
#define __STM32F0xx_IT_H
 

	
 
#ifdef __cplusplus
 
 extern "C" {
 
#endif 
 

	
 
/* Includes ------------------------------------------------------------------*/
 
#include "stm32f0xx.h"
 
#include "platform_config.h"
 

	
 

	
 
/* Exported types ------------------------------------------------------------*/
 
/* Exported constants --------------------------------------------------------*/
 
/* Exported macro ------------------------------------------------------------*/
 
/* Exported functions ------------------------------------------------------- */
 

	
 
void NMI_Handler(void);
 
void HardFault_Handler(void);
 
void MemManage_Handler(void);
 
void BusFault_Handler(void);
 
void UsageFault_Handler(void);
 
void SVC_Handler(void);
 
void DebugMon_Handler(void);
 
void PendSV_Handler(void);
 
void SysTick_Handler(void);
 
void USBWakeUp_IRQHandler(void);
 
void USB_FS_WKUP_IRQHandler(void);
 

	
 

	
 
#ifdef __cplusplus
 
}
 
#endif
 

	
 
#endif /* __STM32F0xx_IT_H */
 

	
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
 

	
stm32l1xx_it.h
Show inline comments
 
deleted file
system_stm32l1xx.c
Show inline comments
 
deleted file
system_stm32l1xx.h
Show inline comments
 
deleted file
0 comments (0 inline, 0 general)