Add files via upload

This commit is contained in:
ErikIOT 2017-09-17 21:55:26 -04:00 committed by GitHub
parent ac11b8256b
commit 7b74c3d03f
3 changed files with 262 additions and 0 deletions

View File

@ -0,0 +1,122 @@
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
/* _estack = 0x20000000 + 131072; end of RAM 131072 is wrong see http://www.openstm32.org/forumthread2359 */
_estack = 0x20017FFF; /* end of RAM */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
}
/* 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,40 @@
#include "stm32_build_defines.h"
#include "stm32_def.h"
extern void SystemClock_Config(void) {
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.MSICalibrationValue = 0;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI;
RCC_OscInitStruct.PLL.PLLM = 1;
RCC_OscInitStruct.PLL.PLLN = 40;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
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_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4);
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
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,100 @@
#ifndef VARIANT_H
#define VARIANT_H
#define LED_BUILTIN PA5
#define LED2_BUILTIN PB14
#define LED3_BUILTIN PC9
#define MOSI PA7
#define MISO PA6
#define SCK PA5
#define SS PA15
#define SDA PB9
#define SCL PB8
#define A0 PC5
#define A1 PC4
#define A2 PC3
#define A3 PC2
#define A4 PC1
#define A5 PC0
#define D0 PA1
#define D1 PA0
#define D2 PD14
#define D3 PB0
#define D4 PA3
#define D5 PB4
#define D6 PB1
#define D7 PA4
#define D8 PB2
#define D9 PA15
#define D10 PA2
#define D11 PA7
#define D12 PA6
#define D13 PA5
#define D14 PB9
#define D15 PB8
#define USER_BUTTON PC13
#define VARIANT_PIN_LIST \
PIN(A,1 ), /* D0 */ \
PIN(A,0 ), /* D1 */ \
PIN(D,14), /* D2 */ \
PIN(B,0 ), /* D3 */ \
PIN(A,3 ), /* D4 */ \
PIN(B,4 ), /* D5 */ \
PIN(B,1), /* D6 */ \
PIN(A,4 ), /* D7 */ \
PIN(B,2 ), /* D8 */ \
PIN(A,15 ), /* D9 */ \
PIN(A,2 ), /* D10 */ \
PIN(A,7 ), /* D11 */ \
PIN(A,6 ), /* D12 */ \
PIN(A,5 ), /* D13 */ \
PIN(B,9 ), /* D14 */ \
PIN(B,8 ), /* D15 */ \
PIN(C,5 ), /* D16 / A0 */ \
PIN(C,4 ), /* D17 / A1 */ \
PIN(C,3 ), /* D18 / A2 */ \
PIN(C,2 ), /* D19 / A3 */ \
PIN(C,1 ), /* D20 / A4 */ \
PIN(C,0 ), /* D21 / A5 */ \
PIN(A,8), \
PIN(A,9), \
PIN(A,10), \
PIN(A,11), \
PIN(A,12), \
PIN(A,13), \
PIN(A,14), \
PIN(B,3), \
PIN(B,5), \
PIN(B,6), \
PIN(B,7 ), \
PIN(B,12), \
PIN(B,13), \
PIN(B,14), /* LED2_BUILTIN */ \
PIN(B,15), \
PIN(C,6 ), \
PIN(C,8 ), \
PIN(C,9 ), \
PIN(C,10), \
PIN(C,11), \
PIN(C,12), \
PIN(C,13), \
PIN(C,14), \
PIN(C,15), \
PIN(D,0 ), \
PIN(D,1 ), \
PIN(D,2 ), \
PIN(D,3 ), \
PIN(D,4 ), \
PIN(D,5 ), \
PIN(D,6 ), \
PIN(D,7 ), \
#endif