Add files via upload

This commit is contained in:
Morten 2018-01-11 23:13:49 +01:00 committed by GitHub
parent 799043dccb
commit c6cb2734e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 393 additions and 0 deletions

View File

@ -0,0 +1,167 @@
/*
*****************************************************************************
**
** File : LinkerScript.ld
**
** Abstract : Linker script for STM32F765ZGTx Device with
** 1024KByte FLASH, 512KByte RAM
**
** Set heap size, stack size and stack location according
** to application requirements.
**
** Set memory bank area and size if external memory is used.
**
** Target : STMicroelectronics STM32
**
**
** Distribution: The file is distributed as is, without any warranty
** of any kind.
**
** (c)Copyright Ac6.
** You may use this file as-is or modify it according to the needs of your
** project. Distribution of this file (unmodified or modified) is not
** permitted. Ac6 permit registered System Workbench for MCU users the
** rights to distribute the assembled, compiled & linked contents of this
** file as part of an application binary file, provided that it is built
** using the System Workbench for MCU toolchain.
**
*****************************************************************************
*/
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = 0x20080000; /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x200; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
}
/* 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(8);
*(.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(8);
_etext = .; /* define a global symbols at end of code */
} >FLASH
/* Constant data goes into FLASH */
.rodata :
{
. = ALIGN(8);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(8);
} >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
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >RAM
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}

View File

@ -0,0 +1,83 @@
#include "stm32_build_defines.h"
#include "stm32_def.h"
#include "Arduino.h"
#include "syscalls.h"
extern "C" void SystemClock_Config(void) {
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
/**Configure the main internal regulator output voltage
*/
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
/**Initializes the CPU, AHB and APB busses clocks
*/
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 = 6;
RCC_OscInitStruct.PLL.PLLN = 216;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 9;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
HAL_PWREx_EnableOverDrive();
/**Initializes the CPU, AHB and APB busses clocks
*/
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_DIV4;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7);
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_UART4
|RCC_PERIPHCLK_UART5|RCC_PERIPHCLK_CLK48;
PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
PeriphClkInitStruct.Uart4ClockSelection = RCC_UART4CLKSOURCE_PCLK1;
PeriphClkInitStruct.Uart5ClockSelection = RCC_UART5CLKSOURCE_PCLK1;
PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48SOURCE_PLL;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
/**Configure the Systick interrupt time
*/
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
/**Configure the Systick
*/
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}
extern "C" void initVariant() {
//UART ans I2C setup
SerialUART3.stm32SetTX(PB10);
SerialUART3.stm32SetRX(PB11);
SerialUART4.stm32SetTX(PC10);
SerialUART4.stm32SetRX(PC11);
SerialUART5.stm32SetTX(PC12);
SerialUART5.stm32SetRX(PD2);
//Wire.stm32SetSDA(PB9);
//Wire.stm32SetSCL(PB8);
}

View File

@ -0,0 +1,143 @@
#ifndef VARIANT_H
#define VARIANT_H
#define LED_BUILTIN PA2
#define STM32_LED_BUILTIN_ACTIVE_HIGH
#define MOSI PA7
#define MISO PA6
#define SCK PA5
#define SS PB6
#define SDA PB9
#define SCL PB8
#define A0 PC3
#define A1 PC2
#define A2 PC1
#define A3 PC0
#define A4 PF10
#define A5 PE12
#define EEPROM_BLOCK_0_SECTOR 6
#define EEPROM_BLOCK_1_SECTOR 7
#define EEPROM_BLOCK_0_SIZE 128
#define EEPROM_BLOCK_1_SIZE 128
#define VARIANT_PIN_LIST \
PIN(A,0), \
PIN(A,1), \
PIN(A,2), \
PIN(A,3), \
PIN(A,4), \
PIN(A,5), \
PIN(A,6), \
PIN(A,7), \
PIN(A,8), \
PIN(A,9), \
PIN(A,10), \
PIN(A,11), \
PIN(A,12), \
PIN(A,13), \
PIN(A,14), \
PIN(A,15), \
PIN(B,0), \
PIN(B,1), \
PIN(B,2), \
PIN(B,3), \
PIN(B,4), \
PIN(B,5), \
PIN(B,6), \
PIN(B,7), \
PIN(B,8), \
PIN(B,9), \
PIN(B,10), \
PIN(B,11), \
PIN(B,12), \
PIN(B,13), \
PIN(B,14), \
PIN(B,15), \
PIN(C,0), \
PIN(C,1), \
PIN(C,2), \
PIN(C,3), \
PIN(C,4), \
PIN(C,5), \
PIN(C,6), \
PIN(C,7), \
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), \
PIN(D,8), \
PIN(D,9), \
PIN(D,10), \
PIN(D,11), \
PIN(D,12), \
PIN(D,13), \
PIN(D,14), \
PIN(D,15), \
PIN(E,0), \
PIN(E,1), \
PIN(E,2), \
PIN(E,3), \
PIN(E,4), \
PIN(E,5), \
PIN(E,6), \
PIN(E,7), \
PIN(E,8), \
PIN(E,9), \
PIN(E,10), \
PIN(E,11), \
PIN(E,12), \
PIN(E,13), \
PIN(E,14), \
PIN(E,15), \
PIN(F,0), \
PIN(F,1), \
PIN(F,2), \
PIN(F,3), \
PIN(F,4), \
PIN(F,5), \
PIN(F,6), \
PIN(F,7), \
PIN(F,8), \
PIN(F,9), \
PIN(F,10), \
PIN(F,11), \
PIN(F,12), \
PIN(F,13), \
PIN(F,14), \
PIN(F,15), \
PIN(G,0), \
PIN(G,1), \
PIN(G,2), \
PIN(G,3), \
PIN(G,4), \
PIN(G,5), \
PIN(G,6), \
PIN(G,7), \
PIN(G,8), \
PIN(G,9), \
PIN(G,10), \
PIN(G,11), \
PIN(G,12), \
PIN(G,13), \
PIN(G,14), \
PIN(G,15), \
#endif