From ca8cfaab23d4e9957aa8512141996d9fff0663c4 Mon Sep 17 00:00:00 2001 From: JongHyeon Lee Date: Tue, 15 Sep 2020 18:03:44 +0900 Subject: [PATCH 1/4] Add Aurora One Variant --- README.md | 6 + boards.txt | 81 +++++++++ variants/Aurora_One_G030K8/PeripheralPins.c | 156 +++++++++++++++++ variants/Aurora_One_G030K8/PinNamesVar.h | 25 +++ variants/Aurora_One_G030K8/ldscript.ld | 175 ++++++++++++++++++++ variants/Aurora_One_G030K8/variant.cpp | 135 +++++++++++++++ variants/Aurora_One_G030K8/variant.h | 113 +++++++++++++ 7 files changed, 691 insertions(+) create mode 100644 variants/Aurora_One_G030K8/PeripheralPins.c create mode 100644 variants/Aurora_One_G030K8/PinNamesVar.h create mode 100644 variants/Aurora_One_G030K8/ldscript.ld create mode 100644 variants/Aurora_One_G030K8/variant.cpp create mode 100644 variants/Aurora_One_G030K8/variant.h diff --git a/README.md b/README.md index 0ed295410c..54321d229a 100644 --- a/README.md +++ b/README.md @@ -217,6 +217,12 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d | :green_heart: | STM32L072RB | [PX-HER0](https://piconomix.com/fwlib/_p_i_c_o_n_o_m_i_x__s_t_m32__h_e_r_o__b_o_a_r_d.html) | *1.8.0* | | | :green_heart: | STM32L072KZ | [ThunderPack v1.0](https://github.com/jgillick/ThunderPack) | *1.8.0* | | +### Generic STM32G0 boards + +| Status | Device(s) | Name | Release | Notes | +| :----: | :-------: | ---- | :-----: | :---- | +| :green_heart: | STM32G030K8 | [Aurora One](https://www.bfykorea.com/aurora-one) | *2.0.0* | | + ### 3D printer boards | Status | Device(s) | Name | Release | Notes | diff --git a/boards.txt b/boards.txt index 65074d3a9f..a7cb4994ad 100644 --- a/boards.txt +++ b/boards.txt @@ -1718,6 +1718,45 @@ GenL0.menu.upload_method.bmpMethod=BMP (Black Magic Probe) GenL0.menu.upload_method.bmpMethod.upload.protocol=gdb_bmp GenL0.menu.upload_method.bmpMethod.upload.tool=bmp_upload +################################################################################ +# Generic G0 +GenG0.name=Generic STM32G0 series + +GenG0.build.core=arduino +GenG0.build.board=GenG0 +GenG0.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -D__CORTEX_SC=0 +GenG0.build.mcu=cortex-m0plus +GenG0.build.series=STM32G0xx +GenG0.build.cmsis_lib_gcc=arm_cortexM0l_math + +# Aurora One +GenG0.menu.pnum.AURORA_ONE=Aurora One +GenG0.menu.pnum.AURORA_ONE.upload.maximum_size=65536 +GenG0.menu.pnum.AURORA_ONE.upload.maximum_data_size=16384 +GenG0.menu.pnum.AURORA_ONE.build.board=Aurora_One +GenG0.menu.pnum.AURORA_ONE.build.product_line=STM32G030xx +GenG0.menu.pnum.AURORA_ONE.build.variant=Aurora_One_G030K8 + +# Upload menu +GenG0.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD) +GenG0.menu.upload_method.swdMethod.upload.protocol=0 +GenG0.menu.upload_method.swdMethod.upload.options=-g +GenG0.menu.upload_method.swdMethod.upload.tool=stm32CubeProg + +GenG0.menu.upload_method.serialMethod=STM32CubeProgrammer (Serial) +GenG0.menu.upload_method.serialMethod.upload.protocol=1 +GenG0.menu.upload_method.serialMethod.upload.options={serial.port.file} -s +GenG0.menu.upload_method.serialMethod.upload.tool=stm32CubeProg + +GenG0.menu.upload_method.dfuMethod=STM32CubeProgrammer (DFU) +GenG0.menu.upload_method.dfuMethod.upload.protocol=2 +GenG0.menu.upload_method.dfuMethod.upload.options=-g +GenG0.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg + +GenG0.menu.upload_method.bmpMethod=BMP (Black Magic Probe) +GenG0.menu.upload_method.bmpMethod.upload.protocol=gdb_bmp +GenG0.menu.upload_method.bmpMethod.upload.tool=bmp_upload + ################################################################################ # Electronic Speed Controller boards @@ -2283,6 +2322,12 @@ GenL0.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE GenL0.menu.xserial.disabled=Disabled (no Serial support) GenL0.menu.xserial.disabled.build.xSerial= +GenG0.menu.xserial.generic=Enabled (generic 'Serial') +GenG0.menu.xserial.none=Enabled (no generic 'Serial') +GenG0.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE +GenG0.menu.xserial.disabled=Disabled (no Serial support) +GenG0.menu.xserial.disabled.build.xSerial= + ESC_board.menu.xserial.generic=Enabled (generic 'Serial') ESC_board.menu.xserial.none=Enabled (no generic 'Serial') ESC_board.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE @@ -2443,6 +2488,14 @@ GenL0.menu.usb.CDC.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC -DDISABLE_G GenL0.menu.usb.HID=HID (keyboard and mouse) GenL0.menu.usb.HID.build.enable_usb={build.usb_flags} -DUSBD_USE_HID_COMPOSITE +GenG0.menu.usb.none=None +GenG0.menu.usb.CDCgen=CDC (generic 'Serial' supersede U(S)ART) +GenG0.menu.usb.CDCgen.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC +GenG0.menu.usb.CDC=CDC (no generic 'Serial') +GenG0.menu.usb.CDC.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB +GenG0.menu.usb.HID=HID (keyboard and mouse) +GenG0.menu.usb.HID.build.enable_usb={build.usb_flags} -DUSBD_USE_HID_COMPOSITE + 3dprinter.menu.usb.none=None 3dprinter.menu.usb.CDCgen=CDC (generic 'Serial' supersede U(S)ART) 3dprinter.menu.usb.CDCgen.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC @@ -2707,6 +2760,24 @@ GenL0.menu.opt.o3lto.build.flags.optimize=-O3 -flto GenL0.menu.opt.ogstd=Debug (-g) GenL0.menu.opt.ogstd.build.flags.optimize=-g -Og +GenG0.menu.opt.osstd=Smallest (-Os default) +GenG0.menu.opt.oslto=Smallest (-Os) with LTO +GenG0.menu.opt.oslto.build.flags.optimize=-Os -flto +GenG0.menu.opt.o1std=Fast (-O1) +GenG0.menu.opt.o1std.build.flags.optimize=-O1 +GenG0.menu.opt.o1lto=Fast (-O1) with LTO +GenG0.menu.opt.o1lto.build.flags.optimize=-O1 -flto +GenG0.menu.opt.o2std=Faster (-O2) +GenG0.menu.opt.o2std.build.flags.optimize=-O2 +GenG0.menu.opt.o2lto=Faster (-O2) with LTO +GenG0.menu.opt.o2lto.build.flags.optimize=-O2 -flto +GenG0.menu.opt.o3std=Fastest (-O3) +GenG0.menu.opt.o3std.build.flags.optimize=-O3 +GenG0.menu.opt.o3lto=Fastest (-O3) with LTO +GenG0.menu.opt.o3lto.build.flags.optimize=-O3 -flto +GenG0.menu.opt.ogstd=Debug (-g) +GenG0.menu.opt.ogstd.build.flags.optimize=-g -Og + ESC_board.menu.opt.osstd=Smallest (-Os default) ESC_board.menu.opt.oslto=Smallest (-Os) with LTO ESC_board.menu.opt.oslto.build.flags.optimize=-Os -flto @@ -2936,6 +3007,16 @@ GenL0.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_float GenL0.menu.rtlib.full=Newlib Standard GenL0.menu.rtlib.full.build.flags.ldspecs= +GenG0.menu.rtlib.nano=Newlib Nano (default) +GenG0.menu.rtlib.nanofp=Newlib Nano + Float Printf +GenG0.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float +GenG0.menu.rtlib.nanofs=Newlib Nano + Float Scanf +GenG0.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs -u _scanf_float +GenG0.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf +GenG0.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_float -u _scanf_float +GenG0.menu.rtlib.full=Newlib Standard +GenG0.menu.rtlib.full.build.flags.ldspecs= + ESC_board.menu.rtlib.nano=Newlib Nano (default) ESC_board.menu.rtlib.nanofp=Newlib Nano + Float Printf ESC_board.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float diff --git a/variants/Aurora_One_G030K8/PeripheralPins.c b/variants/Aurora_One_G030K8/PeripheralPins.c new file mode 100644 index 0000000000..1d46f9c604 --- /dev/null +++ b/variants/Aurora_One_G030K8/PeripheralPins.c @@ -0,0 +1,156 @@ +/* + ******************************************************************************* + * Copyright (c) 2020, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + * Automatically generated from STM32G030K(6-8)Tx.xml + */ +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Note: Commented lines are alternative possibilities which are not used per default. + * If you change them, you will have to know what you do + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +WEAK const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4 + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5 + {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6 + {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 + {NC, NP, 0} +}; +#endif + +//*** No DAC *** + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SDA[] = { + {PA_12, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)}, + {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SCL[] = { + {PA_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)}, + {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)}, + {NC, NP, 0} +}; +#endif + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_PWM[] = { + {PA_6, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM16, 1, 0)}, // TIM16_CH1 + {PA_7, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM14, 1, 0)}, // TIM14_CH1 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 1, 0)}, // TIM1_CH1 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM1, 4, 0)}, // TIM1_CH4 + {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 3, 0)}, // TIM3_CH3 + {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 4, 0)}, // TIM3_CH4 + {PB_3, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 1, 0)}, // TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM3, 2, 0)}, // TIM3_CH2 + {PB_9, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM17, 1, 0)}, // TIM17_CH1 + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_TX[] = { + {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)}, + {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RX[] = { + {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)}, + {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RTS[] = { + {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)}, + {PB_3, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_CTS[] = { + {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_USART2)}, + {PB_4, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MOSI[] = { + {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, + {PB_7, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, + {PB_2, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, + {PB_8, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SSEL[] = { + {PA_8, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_SPI2)}, + {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, + {NC, NP, 0} +}; +#endif + +//*** No CAN *** + +//*** No ETHERNET *** + +//*** No QUADSPI *** + +//*** No USB *** + +//*** No SD *** \ No newline at end of file diff --git a/variants/Aurora_One_G030K8/PinNamesVar.h b/variants/Aurora_One_G030K8/PinNamesVar.h new file mode 100644 index 0000000000..2474b38dc9 --- /dev/null +++ b/variants/Aurora_One_G030K8/PinNamesVar.h @@ -0,0 +1,25 @@ +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PA_4, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = PB_5, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif \ No newline at end of file diff --git a/variants/Aurora_One_G030K8/ldscript.ld b/variants/Aurora_One_G030K8/ldscript.ld new file mode 100644 index 0000000000..0c59059c8d --- /dev/null +++ b/variants/Aurora_One_G030K8/ldscript.ld @@ -0,0 +1,175 @@ +/** + ****************************************************************************** + * @file LinkerScript.ld + * @author Auto-generated by STM32CubeIDE + * @brief Linker script for STM32G030K8Tx Device from STM32G0 series + * 64Kbytes FLASH + * 8Kbytes RAM + * + * Set heap size, stack size and stack location according + * to application requirements. + * + * Set memory bank area and size if external memory is used + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ + +_Min_Heap_Size = 0x200 ; /* required amount of heap */ +_Min_Stack_Size = 0x400 ; /* required amount of stack */ + +/* Memories definition */ +MEMORY +{ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K + FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K +} + +/* Sections */ +SECTIONS +{ + /* The startup code into "FLASH" Rom type memory */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data into "FLASH" Rom type memory */ + .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 into "FLASH" Rom type memory */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { + . = ALIGN(4); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } >FLASH + + .ARM : { + . = ALIGN(4); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(4); + } >FLASH + + .preinit_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + } >FLASH + + .init_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + } >FLASH + + .fini_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(4); + } >FLASH + + /* Used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections into "RAM" Ram type memory */ + .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 into "RAM" Ram type memory */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + _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" Ram type memory left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + /* Remove information from the compiler libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/variants/Aurora_One_G030K8/variant.cpp b/variants/Aurora_One_G030K8/variant.cpp new file mode 100644 index 0000000000..ecd1a0aa24 --- /dev/null +++ b/variants/Aurora_One_G030K8/variant.cpp @@ -0,0 +1,135 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "pins_arduino.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Pin number +const PinName digitalPin[] = { + PA_10, //D0 + PA_9, //D1 + PA_6, //D2 + PA_7, //D3 + PA_8, //D4 + PC_6, //D5 + PA_11, //D6 + PA_12, //D7 + PB_2, //D8 + PB_1, //D9 + PB_0, //D10 + PB_5, //D11 + PB_4, //D12 + PB_3, //D13/LED + PB_7, //D14 + PB_6, //D15 + PB_9, //D16/MAINSL + PB_8, //D17/MAINSL + PA_15, //D18/MAINSL + PA_14, //D19/SWCLK + PA_13, //D20/SWDIO + PA_0, //D21/A0 + PA_1, //D22/A1 + PA_2, //D23/A2 + PA_3, //D24/A3 + PA_4, //D25/A4 + PA_5 //D26/A5 +}; + +// Analog (Ax) pin number array +const uint32_t analogInputPin[] = { + 21, //A0 + 22, //A1 + 23, //A2 + 24, //A3 + 25, //A4 + 26, //A5 + 2, //A6 + 3, //A7 + 10, //A8 + 9 //A9 +}; + +#ifdef __cplusplus +} +#endif + +// ---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief System Clock Configuration + * @param None + * @retval None + */ +WEAK void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; + + /** Configure the main internal regulator output voltage + */ + HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1); + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1; + RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1; + RCC_OscInitStruct.PLL.PLLN = 8; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + Error_Handler(); + } + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK + | RCC_CLOCKTYPE_PCLK1; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { + Error_Handler(); + } + /** Initializes the peripherals clocks + */ + PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 + | RCC_PERIPHCLK_ADC; + PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK1; + PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1; + PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_SYSCLK; + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { + Error_Handler(); + } +} + +#ifdef __cplusplus +} +#endif diff --git a/variants/Aurora_One_G030K8/variant.h b/variants/Aurora_One_G030K8/variant.h new file mode 100644 index 0000000000..b8452fe7d2 --- /dev/null +++ b/variants/Aurora_One_G030K8/variant.h @@ -0,0 +1,113 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_ARDUINO_STM32_ +#define _VARIANT_ARDUINO_STM32_ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +#define PA10 0 +#define PA9 1 +#define PA6 2 +#define PA7 3 +#define PA8 4 +#define PC6 5 +#define PA11 6 +#define PA12 7 +#define PB2 8 +#define PB1 9 +#define PB0 10 +#define PB5 A6 +#define PB4 A7 +#define PB3 13 // LED +#define PB7 14 +#define PB6 15 +#define PB9 16 +#define PB8 17 +#define PA15 18 +#define PA14 19 // SWD +#define PA13 20 // SWD +#define PA0 21 +#define PA1 22 +#define PA2 23 +#define PA3 24 +#define PA4 25 +#define PA5 26 + +// This must be a literal +#define NUM_DIGITAL_PINS 27 +// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS +#define NUM_ANALOG_INPUTS 10 + +// On-board LED pin number +#define LED_BUILTIN 13 +#define LED_GREEN LED_BUILTIN + +// On-board user button +//#define USER_BTN PC13 + +// Timer Definitions +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin +//#define TIMER_TONE TIM6 +//#define TIMER_SERVO TIM7 + +// UART Definitions +#define SERIAL_UART_INSTANCE 2 //Connected to ST-Link + +// Default pin used for 'Serial' instance (ex: ST-Link) +// Mandatory for Firmata +#define PIN_SERIAL_RX PA3 +#define PIN_SERIAL_TX PA2 + +/* Extra HAL modules */ +//#define HAL_DAC_MODULE_ENABLED + +#ifdef __cplusplus +} // extern "C" +#endif +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + // These serial port names are intended to allow libraries and architecture-neutral + // sketches to automatically default to the correct port name for a particular type + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, + // the first hardware serial port whose RX/TX pins are not dedicated to another use. + // + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor + // + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial + // + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library + // + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. + // + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX + // pins are NOT connected to anything by default. + #define SERIAL_PORT_MONITOR Serial + #define SERIAL_PORT_HARDWARE Serial2 +#endif + +#endif /* _VARIANT_ARDUINO_STM32_ */ From 84b0889b0353fa4820b43b04162340d217379cf2 Mon Sep 17 00:00:00 2001 From: JongHyeon Lee Date: Tue, 15 Sep 2020 18:05:31 +0900 Subject: [PATCH 2/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 54321d229a..5847ec7247 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d - [Generic STM32F4 boards](#generic-stm32f4-boards) - [Generic STM32H7 boards](#generic-stm32h7-boards) - [Generic STM32L0 boards](#generic-stm32l0-boards) + - [Generic STM32G0 boards](#generic-stm32g0-boards) - [3D printer boards](#3d-printer-boards) - [LoRa boards](#lora-boards) - [Electronic Speed Controller boards](#electronic-speed-controller-boards) From cfcb1deb3caa3070f8cd53175e4a89b91dddbcd2 Mon Sep 17 00:00:00 2001 From: JongHyeon Lee Date: Tue, 15 Sep 2020 18:46:06 +0900 Subject: [PATCH 3/4] Add newline at EOF --- variants/Aurora_One_G030K8/PeripheralPins.c | 2 +- variants/Aurora_One_G030K8/PinNamesVar.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/Aurora_One_G030K8/PeripheralPins.c b/variants/Aurora_One_G030K8/PeripheralPins.c index 1d46f9c604..f4c07b5ec8 100644 --- a/variants/Aurora_One_G030K8/PeripheralPins.c +++ b/variants/Aurora_One_G030K8/PeripheralPins.c @@ -153,4 +153,4 @@ WEAK const PinMap PinMap_SPI_SSEL[] = { //*** No USB *** -//*** No SD *** \ No newline at end of file +//*** No SD *** diff --git a/variants/Aurora_One_G030K8/PinNamesVar.h b/variants/Aurora_One_G030K8/PinNamesVar.h index 2474b38dc9..9428e0776e 100644 --- a/variants/Aurora_One_G030K8/PinNamesVar.h +++ b/variants/Aurora_One_G030K8/PinNamesVar.h @@ -22,4 +22,4 @@ #endif #ifdef PWR_WAKEUP_PIN8 SYS_WKUP8 = NC, -#endif \ No newline at end of file +#endif From 80e343b79cdfde52767ea2d2fbb8267cb2560a52 Mon Sep 17 00:00:00 2001 From: JongHyeon Lee Date: Wed, 16 Sep 2020 13:01:57 +0900 Subject: [PATCH 4/4] Update variant.h --- variants/Aurora_One_G030K8/variant.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/variants/Aurora_One_G030K8/variant.h b/variants/Aurora_One_G030K8/variant.h index b8452fe7d2..2039e3fa49 100644 --- a/variants/Aurora_One_G030K8/variant.h +++ b/variants/Aurora_One_G030K8/variant.h @@ -46,7 +46,7 @@ extern "C" { #define PB9 16 #define PB8 17 #define PA15 18 -#define PA14 19 // SWD +#define PA14 19 // SWD / BOOT0 #define PA13 20 // SWD #define PA0 21 #define PA1 22 @@ -64,24 +64,15 @@ extern "C" { #define LED_BUILTIN 13 #define LED_GREEN LED_BUILTIN -// On-board user button -//#define USER_BTN PC13 - -// Timer Definitions -// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin -//#define TIMER_TONE TIM6 -//#define TIMER_SERVO TIM7 - // UART Definitions -#define SERIAL_UART_INSTANCE 2 //Connected to ST-Link +#define SERIAL_UART_INSTANCE 2 //Connected to Aurora Connect Lite // Default pin used for 'Serial' instance (ex: ST-Link) // Mandatory for Firmata -#define PIN_SERIAL_RX PA3 -#define PIN_SERIAL_TX PA2 +#define PIN_SERIAL_RX PA10 +#define PIN_SERIAL_TX PA9 /* Extra HAL modules */ -//#define HAL_DAC_MODULE_ENABLED #ifdef __cplusplus } // extern "C"