GEX core repository.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
gex-core/template/old/plat_compat.h.txt

261 lines
8.1 KiB

//
// Created by MightyPork on 2017/12/08.
//
#ifndef GEX_PLAT_COMPAT_H
#define GEX_PLAT_COMPAT_H
#if defined(GEX_PLAT_F103_BLUEPILL)
// platform name for the version string
#define GEX_PLATFORM "STM32F103-Bluepill"
#define PLAT_AHB_MHZ 72
#define PLAT_APB1_MHZ 36
// feature flags
#define PLAT_FLASHBANKS 1
#define PLAT_NO_FLOATING_INPUTS 1
#define PLAT_NO_AFNUM 1
#include <stm32f1xx.h>
#include <stm32f1xx_hal.h>
#include <stm32f1xx_ll_adc.h>
#include <stm32f1xx_ll_bus.h>
#include <stm32f1xx_ll_cortex.h>
#include <stm32f1xx_ll_crc.h>
#include <stm32f1xx_ll_dac.h>
#include <stm32f1xx_ll_dma.h>
#include <stm32f1xx_ll_exti.h>
#include <stm32f1xx_ll_fsmc.h>
#include <stm32f1xx_ll_gpio.h>
#include <stm32f1xx_ll_i2c.h>
#include <stm32f1xx_ll_iwdg.h>
#include <stm32f1xx_ll_pwr.h>
#include <stm32f1xx_ll_rcc.h>
#include <stm32f1xx_ll_rtc.h>
#include <stm32f1xx_ll_sdmmc.h>
#include <stm32f1xx_ll_spi.h>
#include <stm32f1xx_ll_system.h>
#include <stm32f1xx_ll_tim.h>
#include <stm32f1xx_ll_usart.h>
#include <stm32f1xx_ll_usb.h>
#include <stm32f1xx_ll_utils.h>
#include <stm32f1xx_ll_wwdg.h>
// size, determines position of the flash storage
#define FLASH_SIZE (64*1024)
#define SETTINGS_BLOCK_SIZE (1024*2) // this must be a multiple of FLASH pages
#define SETTINGS_FLASH_ADDR (0x08000000 + FLASH_SIZE - SETTINGS_BLOCK_SIZE)
// Number of GPIO ports A,B,C...
#define PORTS_COUNT 5
// Lock jumper config - re-use BOOT1, closed = LOW
#define LOCK_JUMPER_PORT 'B'
#define LOCK_JUMPER_PIN 2
// Status LED config
#define STATUS_LED_PORT 'C'
#define STATUS_LED_PIN 13
#elif defined(STM32F072xB)
#define PLAT_AHB_MHZ 48
#define PLAT_APB1_MHZ 48
#include <stm32f0xx.h>
#include <stm32f0xx_ll_adc.h>
#include <stm32f0xx_ll_bus.h>
#include <stm32f0xx_ll_comp.h>
#include <stm32f0xx_ll_cortex.h>
#include <stm32f0xx_ll_crc.h>
#include <stm32f0xx_ll_crs.h>
#include <stm32f0xx_ll_dac.h>
#include <stm32f0xx_ll_dma.h>
#include <stm32f0xx_ll_exti.h>
#include <stm32f0xx_ll_gpio.h>
#include <stm32f0xx_ll_i2c.h>
#include <stm32f0xx_ll_iwdg.h>
#include <stm32f0xx_ll_pwr.h>
#include <stm32f0xx_ll_rcc.h>
#include <stm32f0xx_ll_rtc.h>
#include <stm32f0xx_ll_spi.h>
#include <stm32f0xx_ll_system.h>
#include <stm32f0xx_ll_tim.h>
#include <stm32f0xx_ll_usart.h>
#include <stm32f0xx_ll_utils.h>
#include <stm32f0xx_ll_wwdg.h>
// size, determines position of the flash storage
#define FLASH_SIZE (128*1024)
#define SETTINGS_BLOCK_SIZE (1024*2) // this must be a multiple of FLASH pages
#define SETTINGS_FLASH_ADDR (0x08000000 + FLASH_SIZE - SETTINGS_BLOCK_SIZE)
// Number of GPIO ports A,B,C...
#define PORTS_COUNT 6
#if defined(GEX_PLAT_F072_DISCOVERY)
// platform name for the version string
#define GEX_PLATFORM "STM32F072-Discovery"
// Lock jumper config
#define LOCK_JUMPER_PORT 'A'
#define LOCK_JUMPER_PIN 0
#define PLAT_LOCK_BTN 1 // toggle button instead of a jumper
#define PLAT_LOCK_1CLOSED 1 // toggle button active in log. 1
// Status LED config
#define STATUS_LED_PORT 'C'
#define STATUS_LED_PIN 6 // RED LED "UP"
#elif defined(GEX_PLAT_F072_HUB)
// platform name for the version string
#define GEX_PLATFORM "STM32F072-HUB"
#define PLAT_FULL_XTAL 1
// Lock jumper config
#define LOCK_JUMPER_PORT 'D'
#define LOCK_JUMPER_PIN 2
#define PLAT_LOCK_BTN 1 // toggle button instead of a jumper
#define PLAT_LOCK_1CLOSED 0 // toggle button active in log. 1
// Status LED config
#define STATUS_LED_PORT 'A'
#define STATUS_LED_PIN 15 // RED LED "UP"
#elif defined(GEX_PLAT_F072_ZERO)
// platform name for the version string
#define GEX_PLATFORM "STM32F072-ZERO"
#define PLAT_FULL_XTAL 1
// Lock jumper config
#define LOCK_JUMPER_PORT 'D'
#define LOCK_JUMPER_PIN 2
#define PLAT_LOCK_BTN 1 // toggle button instead of a jumper
#define PLAT_LOCK_1CLOSED 1 // toggle button active in log. 1
// Status LED config
#define STATUS_LED_PORT 'A'
#define STATUS_LED_PIN 15 // RED LED "UP"
#define SUPPORT_NRF 1
#else
#error Bad platform
#endif
#elif defined(GEX_PLAT_F303_DISCOVERY)
// platform name for the version string
#define GEX_PLATFORM "STM32F303-Discovery"
#define PLAT_AHB_MHZ 72
#define PLAT_APB1_MHZ 36
#define PLAT_APB2_MHZ 72
#include <stm32f3xx.h>
#include <stm32f3xx_hal.h>
#include <stm32f3xx_ll_adc.h>
#include <stm32f3xx_ll_bus.h>
#include <stm32f3xx_ll_comp.h>
#include <stm32f3xx_ll_cortex.h>
#include <stm32f3xx_ll_crc.h>
#include <stm32f3xx_ll_dac.h>
#include <stm32f3xx_ll_dma.h>
#include <stm32f3xx_ll_exti.h>
#include <stm32f3xx_ll_fmc.h>
#include <stm32f3xx_ll_gpio.h>
#include <stm32f3xx_ll_hrtim.h>
#include <stm32f3xx_ll_i2c.h>
#include <stm32f3xx_ll_iwdg.h>
#include <stm32f3xx_ll_opamp.h>
#include <stm32f3xx_ll_pwr.h>
#include <stm32f3xx_ll_rcc.h>
#include <stm32f3xx_ll_rtc.h>
#include <stm32f3xx_ll_spi.h>
#include <stm32f3xx_ll_system.h>
#include <stm32f3xx_ll_tim.h>
#include <stm32f3xx_ll_usart.h>
#include <stm32f3xx_ll_utils.h>
#include <stm32f3xx_ll_wwdg.h>
// size, determines position of the flash storage
#define FLASH_SIZE (256*1024)
#define SETTINGS_BLOCK_SIZE (1024*2) // this must be a multiple of FLASH pages
#define SETTINGS_FLASH_ADDR (0x08000000 + FLASH_SIZE - SETTINGS_BLOCK_SIZE)
// Number of GPIO ports A,B,C...
#define PORTS_COUNT 6
// Lock jumper config
#define LOCK_JUMPER_PORT 'A'
#define LOCK_JUMPER_PIN 0
#define PLAT_LOCK_BTN 1 // toggle button instead of a jumper
#define PLAT_LOCK_1CLOSED 1 // toggle button active in log. 1
// Status LED config
#define STATUS_LED_PORT 'E'
#define STATUS_LED_PIN 13
#elif defined(GEX_PLAT_F407_DISCOVERY)
// platform name for the version string
#define GEX_PLATFORM "STM32F407-Discovery"
#define PLAT_AHB_MHZ 168
#define PLAT_APB1_MHZ 48
#define PLAT_APB2_MHZ 96
#define PLAT_USB_PHYCLOCK 1
#define PLAT_USB_OTGFS 1
#include <stm32f4xx.h>
#include <stm32f4xx_hal.h>
#include <stm32f4xx_ll_adc.h>
#include <stm32f4xx_ll_crc.h>
#include <stm32f4xx_ll_dac.h>
#include <stm32f4xx_ll_dma.h>
#include <stm32f4xx_ll_dma2d.h>
#include <stm32f4xx_ll_exti.h>
#include <stm32f4xx_ll_fmc.h>
#include <stm32f4xx_ll_fsmc.h>
#include <stm32f4xx_ll_gpio.h>
#include <stm32f4xx_ll_i2c.h>
#include <stm32f4xx_ll_lptim.h>
#include <stm32f4xx_ll_pwr.h>
#include <stm32f4xx_ll_rcc.h>
#include <stm32f4xx_ll_rng.h>
#include <stm32f4xx_ll_rtc.h>
#include <stm32f4xx_ll_sdmmc.h>
#include <stm32f4xx_ll_spi.h>
#include <stm32f4xx_ll_tim.h>
#include <stm32f4xx_ll_usart.h>
#include <stm32f4xx_ll_usb.h>
#include <stm32f4xx_ll_utils.h>
// size, determines position of the flash storage
// we use the first 128kB sector. Unfortunately the whole sector must be erased before writing.
#define SETTINGS_FLASH_SECTOR FLASH_SECTOR_5
#define SETTINGS_BLOCK_SIZE (1024*2)
#define SETTINGS_FLASH_ADDR (0x08000000 + (16*4+64)*1024)
// Number of GPIO ports A,B,C...
#define PORTS_COUNT 6
// Lock jumper config
#define LOCK_JUMPER_PORT 'A'
#define LOCK_JUMPER_PIN 0
#define PLAT_LOCK_BTN 1 // toggle button instead of a jumper
#define PLAT_LOCK_1CLOSED 1 // toggle button active in log. 1
// Status LED config
#define STATUS_LED_PORT 'D' // orange
#define STATUS_LED_PIN 13
#else
#error "BAD PLATFORM! Please select GEX platform using a -DGEX_PLAT_* compile flag"
#endif
#define PLAT_AHB_HZ (PLAT_AHB_MHZ*1000000)
#define PLAT_APB1_HZ (PLAT_APB1_MHZ*1000000)
#define PLAT_APB2_HZ (PLAT_APB2_MHZ*1000000)
#endif //GEX_PLAT_COMPAT_H