Add Discovery 407VG board

This commit is contained in:
Daniel Fekete 2017-04-21 20:12:08 +02:00
parent cad2ff1a14
commit 853431534a
5 changed files with 386 additions and 0 deletions

View File

@ -302,6 +302,38 @@ DISCOVERY_L053C8.menu.serial.SerialUSB=SerialUSB (USB connector)
DISCOVERY_L053C8.menu.serial.SerialUSB.build.extra_flags_serial=-DMENU_SERIAL=SerialUSB
################################################################################
# Discovery F407VG board
DISCOVERY_F407VG.name=Discovery F407VG
DISCOVERY_F407VG.vid.0=0x0483
DISCOVERY_F407VG.pid.0=0x5711
DISCOVERY_F407VG.upload.maximum_size=1048576
DISCOVERY_F407VG.upload.maximum_data_size=131072
DISCOVERY_F407VG.build.core=arduino
DISCOVERY_F407VG.build.board=DISCOVERY_F407VG
DISCOVERY_F407VG.build.mcu=cortex-m4
DISCOVERY_F407VG.build.series=STM32F4
DISCOVERY_F407VG.build.variant=DISCOVERY_F407VG
DISCOVERY_F407VG.build.extra_flags=-DSTM32F407VG -DHSE_VALUE=8000000
DISCOVERY_F407VG.upload.protocol=STLink
DISCOVERY_F407VG.upload.tool=stlink_upload
DISCOVERY_F407VG.menu.usb.SerialUSB=Serial [Virtual COM port]
DISCOVERY_F407VG.menu.usb.SerialUSB.build.extra_flags_usb=-DMENU_USB_SERIAL
DISCOVERY_F407VG.menu.usb.Disabled=Disabled, no USB
DISCOVERY_F407VG.menu.serial.SerialUSB=SerialUSB
DISCOVERY_F407VG.menu.serial.SerialUSB.build.extra_flags_serial=-DMENU_SERIAL=SerialUSB
DISCOVERY_F407VG.menu.serial.SerialUART1=SerialUART1 [PA9/PA10]
DISCOVERY_F407VG.menu.serial.SerialUART1.build.extra_flags_serial=-DMENU_SERIAL=SerialUART1
################################################################################
# Discovery F746NG board

View File

@ -0,0 +1,121 @@
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = 0x20000000 + 131072; /* end of RAM */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
}
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
/* Constant data goes into FLASH */
.rodata ALIGN(4) :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >FLASH
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >FLASH
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >FLASH
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} >FLASH
/* used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Initialized data sections goes into RAM, load LMA copy after code */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM AT> FLASH
/* Uninitialized data section */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
PROVIDE ( _end = . );
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}

View File

@ -0,0 +1,42 @@
#include "stm32_build_defines.h"
#include "stm32_def.h"
void SystemClock_Config(void) {
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 4;
RCC_OscInitStruct.PLL.PLLN = 168;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
{
Error_Handler();
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

View File

@ -0,0 +1,89 @@
#include <Arduino.h>
#include "stm32_gpio.h"
const stm32_port_pin_type variant_pin_list[] = {
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_3 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_9 },
{ GPIOA, GPIO_PIN_10},
{ GPIOA, GPIO_PIN_11},
{ GPIOA, GPIO_PIN_12},
{ GPIOA, GPIO_PIN_13},
{ GPIOA, GPIO_PIN_14},
{ GPIOA, GPIO_PIN_15},
{ GPIOB, GPIO_PIN_0 },
{ GPIOB, GPIO_PIN_1 },
{ GPIOB, GPIO_PIN_2 },
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOB, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_11},
{ GPIOB, GPIO_PIN_12},
{ GPIOB, GPIO_PIN_13},
{ GPIOB, GPIO_PIN_14},
{ GPIOB, GPIO_PIN_15},
{ GPIOC, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_2 },
{ GPIOC, GPIO_PIN_3 },
{ GPIOC, GPIO_PIN_4 },
{ GPIOC, GPIO_PIN_5 },
{ GPIOC, GPIO_PIN_6 },
{ GPIOC, GPIO_PIN_7 },
{ GPIOC, GPIO_PIN_8 },
{ GPIOC, GPIO_PIN_9 },
{ GPIOC, GPIO_PIN_10},
{ GPIOC, GPIO_PIN_11},
{ GPIOC, GPIO_PIN_12},
{ GPIOC, GPIO_PIN_13},
{ GPIOC, GPIO_PIN_14},
{ GPIOC, GPIO_PIN_15},
{ GPIOD, GPIO_PIN_0 },
{ GPIOD, GPIO_PIN_1 },
{ GPIOD, GPIO_PIN_2 },
{ GPIOD, GPIO_PIN_3 },
{ GPIOD, GPIO_PIN_4 },
{ GPIOD, GPIO_PIN_5 },
{ GPIOD, GPIO_PIN_6 },
{ GPIOD, GPIO_PIN_7 },
{ GPIOD, GPIO_PIN_8 },
{ GPIOD, GPIO_PIN_9 },
{ GPIOD, GPIO_PIN_10},
{ GPIOD, GPIO_PIN_11},
{ GPIOD, GPIO_PIN_12},
{ GPIOD, GPIO_PIN_13},
{ GPIOD, GPIO_PIN_14},
{ GPIOD, GPIO_PIN_15},
{ GPIOE, GPIO_PIN_0 },
{ GPIOE, GPIO_PIN_1 },
{ GPIOE, GPIO_PIN_2 },
{ GPIOE, GPIO_PIN_3 },
{ GPIOE, GPIO_PIN_4 },
{ GPIOE, GPIO_PIN_5 },
{ GPIOE, GPIO_PIN_6 },
{ GPIOE, GPIO_PIN_7 },
{ GPIOE, GPIO_PIN_8 },
{ GPIOE, GPIO_PIN_9 },
{ GPIOE, GPIO_PIN_10},
{ GPIOE, GPIO_PIN_11},
{ GPIOE, GPIO_PIN_12},
{ GPIOE, GPIO_PIN_13},
{ GPIOE, GPIO_PIN_14},
{ GPIOE, GPIO_PIN_15},
{ GPIOH, GPIO_PIN_0 },
{ GPIOH, GPIO_PIN_1 },
};

View File

@ -0,0 +1,102 @@
#ifndef VARIANT_H
#define VARIANT_H
#define LED_BUILTIN PD12
// Connected to on board LIS3DSH accelerometer, CS: PE3
#define MOSI PA7
#define MISO PA6
#define SCK PA5
#define SS PA4
// Connected to on board CS43L22 audio
#define SDA PB9
#define SCL PB6
enum {
PA0 ,
PA1 ,
PA2 ,
PA3 ,
PA4 ,
PA5 ,
PA6 ,
PA7 ,
PA8 ,
PA9 ,
PA10,
PA11,
PA12,
PA13,
PA14,
PA15,
PB0 ,
PB1 ,
PB2 ,
PB3 ,
PB4 ,
PB5 ,
PB6 ,
PB7 ,
PB8 ,
PB9 ,
PB10,
PB11,
PB12,
PB13,
PB14,
PB15,
PC0 ,
PC1 ,
PC2 ,
PC3 ,
PC4 ,
PC5 ,
PC6 ,
PC7 ,
PC8 ,
PC9 ,
PC10,
PC11,
PC12,
PC13,
PC14,
PC15,
PD0 ,
PD1 ,
PD2 ,
PD3 ,
PD4 ,
PD5 ,
PD6 ,
PD7 ,
PD8 ,
PD9 ,
PD10,
PD11,
PD12,
PD13,
PD14,
PD15,
PE0 ,
PE1 ,
PE2 ,
PE3 ,
PE4 ,
PE5 ,
PE6 ,
PE7 ,
PE8 ,
PE9 ,
PE10,
PE11,
PE12,
PE13,
PE14,
PE15,
PH0 ,
PH1 ,
NUM_PINS,
};
#endif