compatibility for F072
This commit is contained in:
@@ -36,7 +36,15 @@ void DebugUart_PreInit(void)
|
||||
// LL_USART_SetStopBitsLength(USART2, LL_USART_STOPBITS_1);
|
||||
// LL_USART_SetHWFlowCtrl(USART2, LL_USART_HWCONTROL_NONE);
|
||||
LL_USART_EnableDirectionTx(USART2);
|
||||
|
||||
#if GEX_PLAT_F072_DISCOVERY
|
||||
LL_USART_SetBaudRate(USART2, SystemCoreClock, LL_USART_OVERSAMPLING_16, 115200); // This is not great, let's hope it's like this on all platforms...
|
||||
#elif GEX_PLAT_F103_BLUEPILL
|
||||
LL_USART_SetBaudRate(USART2, SystemCoreClock/2, 115200); // This is not great, let's hope it's like this on all platforms...
|
||||
#else
|
||||
#error "BAD PLATFORM!"
|
||||
#endif
|
||||
|
||||
LL_USART_Enable(USART2);
|
||||
}
|
||||
|
||||
|
||||
+51
-3
@@ -5,10 +5,14 @@
|
||||
#ifndef GEX_PLAT_COMPAT_H
|
||||
#define GEX_PLAT_COMPAT_H
|
||||
|
||||
#ifdef GEX_PLAT_F103_BLUEPILL
|
||||
#if defined(GEX_PLAT_F103_BLUEPILL)
|
||||
|
||||
// platform name for the version string
|
||||
#define GEX_PLATFORM "STM32F103-Bluepill"
|
||||
|
||||
// This platform has the Banks field on the Flash config struct for settings save
|
||||
#define PLAT_FLASHBANKS 1
|
||||
|
||||
// platform name for the version string
|
||||
#define GEX_PLATFORM "STM32F103-Bluepill"
|
||||
#include <stm32f1xx.h>
|
||||
#include <stm32f1xx_hal.h>
|
||||
#include <stm32f1xx_ll_adc.h>
|
||||
@@ -49,6 +53,50 @@
|
||||
// Status LED config
|
||||
#define STATUS_LED_PORT 'C'
|
||||
#define STATUS_LED_PIN 13
|
||||
|
||||
#elif defined(GEX_PLAT_F072_DISCOVERY)
|
||||
|
||||
// platform name for the version string
|
||||
#define GEX_PLATFORM "STM32F072-Discovery"
|
||||
|
||||
#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
|
||||
|
||||
// Lock jumper config
|
||||
#define LOCK_JUMPER_PORT 'F'
|
||||
#define LOCK_JUMPER_PIN 1 // OSC OUT, not used in BYPASS mode (receiving clock from the ST-Link MCO)
|
||||
|
||||
// Status LED config
|
||||
#define STATUS_LED_PORT 'C'
|
||||
#define STATUS_LED_PIN 6 // RED LED "UP"
|
||||
#else
|
||||
#error "BAD PLATFORM! Please select GEX platform using a -DGEX_PLAT_* compile flag"
|
||||
#endif
|
||||
|
||||
+56
-1
@@ -34,7 +34,7 @@ void plat_init_resources(void)
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
|
||||
#ifdef GEX_PLAT_F103_BLUEPILL
|
||||
#if defined(GEX_PLAT_F103_BLUEPILL)
|
||||
|
||||
// Platform F103C8T6 - free all present resources
|
||||
{
|
||||
@@ -77,6 +77,61 @@ void plat_init_resources(void)
|
||||
|
||||
assert_param(ok);
|
||||
}
|
||||
#elif defined(GEX_PLAT_F072_DISCOVERY)
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
|
||||
// Platform F073RBT - free all present resources
|
||||
{
|
||||
rsc_free(NULL, R_ADC1);
|
||||
rsc_free(NULL, R_CAN);
|
||||
rsc_free(NULL, R_COMP1);
|
||||
rsc_free(NULL, R_COMP2);
|
||||
rsc_free(NULL, R_DAC1);
|
||||
rsc_free(NULL, R_HDMI_CEC);
|
||||
rsc_free(NULL, R_I2C1);
|
||||
rsc_free(NULL, R_I2C2);
|
||||
rsc_free(NULL, R_I2S1);
|
||||
rsc_free(NULL, R_I2S2);
|
||||
rsc_free(NULL, R_SPI1);
|
||||
rsc_free(NULL, R_SPI2);
|
||||
rsc_free(NULL, R_TIM1);
|
||||
rsc_free(NULL, R_TIM2);
|
||||
rsc_free(NULL, R_TIM3);
|
||||
rsc_free(NULL, R_TIM6);
|
||||
rsc_free(NULL, R_TIM7);
|
||||
rsc_free_range(NULL, R_TIM14, R_TIM17);
|
||||
rsc_free(NULL, R_USART1);
|
||||
rsc_free(NULL, R_USART2);
|
||||
rsc_free(NULL, R_USART3);
|
||||
rsc_free(NULL, R_USART4);
|
||||
rsc_free_range(NULL, R_PA0, R_PA15);
|
||||
rsc_free_range(NULL, R_PB0, R_PB15);
|
||||
rsc_free_range(NULL, R_PC0, R_PC15);
|
||||
rsc_free_range(NULL, R_PF0, R_PF1);
|
||||
}
|
||||
|
||||
// Claim resources not available due to board layout or internal usage
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
// HAL timebase
|
||||
ok &= rsc_claim(&UNIT_SYSTEM, R_TIM1);
|
||||
// HSE crystal
|
||||
ok &= rsc_claim(&UNIT_SYSTEM, R_PF0);
|
||||
//ok &= rsc_claim(&UNIT_SYSTEM, R_PD1); // - not used in BYPASS mode
|
||||
// SWD
|
||||
ok &= rsc_claim(&UNIT_SYSTEM, R_PA13);
|
||||
ok &= rsc_claim(&UNIT_SYSTEM, R_PA14);
|
||||
// USB
|
||||
ok &= rsc_claim(&UNIT_SYSTEM, R_PA11);
|
||||
ok &= rsc_claim(&UNIT_SYSTEM, R_PA12);
|
||||
// BOOT pin(s)
|
||||
ok &= rsc_claim(&UNIT_SYSTEM, R_PB2); // BOOT1
|
||||
|
||||
assert_param(ok);
|
||||
}
|
||||
#else
|
||||
#error "BAD PLATFORM!"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user