From fbf7f727cb0182751bb672d9d9200c2ce7b7e26f Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Fri, 27 Sep 2019 09:30:56 +0200 Subject: [PATCH] Add NUCLEO-L452RE-P support Fixes #671 Signed-off-by: Frederic Pillon --- README.md | 1 + boards.txt | 13 +++ variants/NUCLEO_L452RE/PeripheralPins.c | 88 +++++++++----- variants/NUCLEO_L452RE/ldscript.ld | 56 +++++---- variants/NUCLEO_L452RE/variant.cpp | 144 ++++++++++++++++------- variants/NUCLEO_L452RE/variant.h | 148 +++++++++++++++++------- 6 files changed, 322 insertions(+), 128 deletions(-) diff --git a/README.md b/README.md index 2f1723a365..3ded60c696 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d | :green_heart: | [Nucleo L073RZ](http://www.st.com/en/evaluation-tools/nucleo-l073rz.html) | *1.4.0* | | | :green_heart: | [Nucleo L152RE](http://www.st.com/en/evaluation-tools/nucleo-l152re.html) | *1.0.0* | | | :green_heart: | [Nucleo L452RE](http://www.st.com/en/evaluation-tools/nucleo-l452re.html) | *1.5.0* | | +| :yellow_heart: | [Nucleo L452RE-P](http://www.st.com/en/evaluation-tools/nucleo-l452re-p.html) | **1.8.0** | | | :green_heart: | [Nucleo L476RG](http://www.st.com/en/evaluation-tools/nucleo-l476rg.html) | *0.1.0* | | | :green_heart: | [P-Nucleo-WB55RG](https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html) | *1.6.0* | No BLE support | diff --git a/boards.txt b/boards.txt index 4d6940f7b7..6877679229 100644 --- a/boards.txt +++ b/boards.txt @@ -358,6 +358,19 @@ Nucleo_64.menu.pnum.NUCLEO_L452RE.build.product_line=STM32L452xx Nucleo_64.menu.pnum.NUCLEO_L452RE.build.variant=NUCLEO_L452RE Nucleo_64.menu.pnum.NUCLEO_L452RE.build.cmsis_lib_gcc=arm_cortexM4l_math +# NUCLEO_L452RE-P board +Nucleo_64.menu.pnum.NUCLEO_L452REP=Nucleo L452RE-P +Nucleo_64.menu.pnum.NUCLEO_L452REP.node=NODE_L452RE +Nucleo_64.menu.pnum.NUCLEO_L452REP.upload.maximum_size=524288 +Nucleo_64.menu.pnum.NUCLEO_L452REP.upload.maximum_data_size=163840 +Nucleo_64.menu.pnum.NUCLEO_L452REP.build.mcu=cortex-m4 +Nucleo_64.menu.pnum.NUCLEO_L452REP.build.flags.fp=-mfpu=fpv4-sp-d16 -mfloat-abi=hard +Nucleo_64.menu.pnum.NUCLEO_L452REP.build.board=NUCLEO_L452RE_P +Nucleo_64.menu.pnum.NUCLEO_L452REP.build.series=STM32L4xx +Nucleo_64.menu.pnum.NUCLEO_L452REP.build.product_line=STM32L452xx +Nucleo_64.menu.pnum.NUCLEO_L452REP.build.variant=NUCLEO_L452RE +Nucleo_64.menu.pnum.NUCLEO_L452REP.build.cmsis_lib_gcc=arm_cortexM4l_math + # NUCLEO_L476RG board # Support: Serial1 (USART1 on PA10, PA9) Nucleo_64.menu.pnum.NUCLEO_L476RG=Nucleo L476RG diff --git a/variants/NUCLEO_L452RE/PeripheralPins.c b/variants/NUCLEO_L452RE/PeripheralPins.c index 48b49b4cae..41187c0e8e 100644 --- a/variants/NUCLEO_L452RE/PeripheralPins.c +++ b/variants/NUCLEO_L452RE/PeripheralPins.c @@ -3,30 +3,13 @@ * Copyright (c) 2019, STMicroelectronics * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * 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 * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************* - * Automatically generated from STM32L452RETxP.xml + * Automatically generated from STM32L452R(C-E)Tx.xml and STM32L452RETxP.xml */ #include "Arduino.h" #include "PeripheralPins.h" @@ -46,16 +29,27 @@ WEAK const PinMap PinMap_ADC[] = { // {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 // {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8 {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 - // {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10 +#ifdef ARDUINO_NUCLEO_L452RE + // {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10 - LED +#else + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10 +#endif {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11 {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12 {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15 +#ifdef ARDUINO_NUCLEO_L452RE + // {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_IN16 +#else {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_IN16 +#endif {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1 {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2 {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3 {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4 {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13 +#ifdef ARDUINO_NUCLEO_L452RE + // {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14 +#endif {NC, NP, 0} }; #endif @@ -75,14 +69,14 @@ WEAK const PinMap PinMap_DAC[] = { WEAK const PinMap PinMap_I2C_SDA[] = { {PA_10, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, {PB_4, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, - // {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, - {PB_7, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF5_I2C4)}, + {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + // {PB_7, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF5_I2C4)}, {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, // {PB_11, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF3_I2C4)}, {PB_14, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, - {PC_1, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, - // {PC_1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF2_I2C4)}, + // {PC_1, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PC_1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF2_I2C4)}, {NC, NP, 0} }; #endif @@ -97,8 +91,8 @@ WEAK const PinMap PinMap_I2C_SCL[] = { {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, // {PB_10, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF3_I2C4)}, {PB_13, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, - {PC_0, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, - // {PC_0, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF2_I2C4)}, + // {PC_0, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PC_0, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF2_I2C4)}, {NC, NP, 0} }; #endif @@ -154,8 +148,13 @@ WEAK const PinMap PinMap_PWM[] = { #ifdef HAL_UART_MODULE_ENABLED WEAK const PinMap PinMap_UART_TX[] = { {PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, +#ifdef ARDUINO_NUCLEO_L452RE // {PA_2, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, +#else + {PA_2, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, + //{PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, +#endif {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, {PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, @@ -171,14 +170,22 @@ WEAK const PinMap PinMap_UART_TX[] = { #ifdef HAL_UART_MODULE_ENABLED WEAK const PinMap PinMap_UART_RX[] = { {PA_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, +#ifdef ARDUINO_NUCLEO_L452RE // {PA_3, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, +#else + {PA_3, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, + //{PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, +#endif {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, {PA_15, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART2)}, {PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, {PB_10, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, {PB_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, {PC_0, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, +#ifdef ARDUINO_NUCLEO_L452RE + {PC_5, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, +#endif // {PC_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, {PC_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, {NC, NP, 0} @@ -196,6 +203,9 @@ WEAK const PinMap PinMap_UART_RTS[] = { {PB_3, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, {PB_12, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, {PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, +#ifdef ARDUINO_NUCLEO_L452RE + {PD_2, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, +#endif {NC, NP, 0} }; #endif @@ -323,3 +333,23 @@ WEAK const PinMap PinMap_USB[] = { //*** No USB_OTG_FS *** //*** No USB_OTG_HS *** + +//*** SD *** + +#ifdef HAL_SD_MODULE_ENABLED +#ifdef ARDUINO_NUCLEO_L452RE +WEAK const PinMap PinMap_SD[] = { + {PB_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D4 + {PB_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D5 + {PC_6, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D6 + {PC_7, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D7 + {PC_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D0 + {PC_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D1 + {PC_10, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D2 + {PC_11, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D3 + {PC_12, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CK + {PD_2, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CMD + {NC, NP, 0} +}; +#endif +#endif diff --git a/variants/NUCLEO_L452RE/ldscript.ld b/variants/NUCLEO_L452RE/ldscript.ld index 40b7406269..13bb41290d 100644 --- a/variants/NUCLEO_L452RE/ldscript.ld +++ b/variants/NUCLEO_L452RE/ldscript.ld @@ -1,11 +1,14 @@ /* -***************************************************************************** +****************************************************************************** ** ** File : ldscript.ld ** -** Abstract : Linker script for STM32L452RE Device with -** 512KByte FLASH, 160KByte RAM +** Author : Auto-generated by STM32CubeIDE +** +** Abstract : Linker script for NUCLEO-L452RE(-P) Board embedding STM32L452RETx(P) Device from STM32L4 series +** 512Kbytes FLASH +** 160Kbytes RAM ** ** Set heap size, stack size and stack location according ** to application requirements. @@ -14,13 +17,13 @@ ** ** Target : STMicroelectronics STM32 ** -** Distribution: The file is distributed as is, without any warranty +** Distribution: The file is distributed as is without any warranty ** of any kind. ** ***************************************************************************** ** @attention ** -**

© COPYRIGHT(c) 2014 Ac6

+**

© COPYRIGHT(c) 2019 STMicroelectronics

** ** Redistribution and use in source and binary forms, with or without modification, ** are permitted provided that the following conditions are met: @@ -29,7 +32,7 @@ ** 2. Redistributions in binary form must reproduce the above copyright notice, ** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. -** 3. Neither the name of Ac6 nor the names of its contributors +** 3. Neither the name of STMicroelectronics nor the names of its contributors ** may be used to endorse or promote products derived from this software ** without specific prior written permission. ** @@ -51,22 +54,21 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ -_estack = 0x20028000; /* end of RAM */ -/* Generate a link error if heap and stack don't fit into RAM */ +_estack = 0x20028000; /* end of "RAM" Ram type memory */ _Min_Heap_Size = 0x200; /* required amount of heap */ _Min_Stack_Size = 0x400; /* required amount of stack */ -/* Specify the memory areas */ +/* Memories definition */ MEMORY { RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 160K FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K } -/* Define output sections */ +/* Sections */ SECTIONS { - /* The startup code goes first into FLASH */ + /* The startup code into "FLASH" Rom type memory */ .isr_vector : { . = ALIGN(4); @@ -74,7 +76,7 @@ SECTIONS . = ALIGN(4); } >FLASH - /* The program code and other data goes into FLASH */ + /* The program code and other data into "FLASH" Rom type memory */ .text : { . = ALIGN(4); @@ -91,7 +93,7 @@ SECTIONS _etext = .; /* define a global symbols at end of code */ } >FLASH - /* Constant data goes into FLASH */ + /* Constant data into "FLASH" Rom type memory */ .rodata : { . = ALIGN(4); @@ -100,38 +102,50 @@ SECTIONS . = ALIGN(4); } >FLASH - .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >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 */ + /* Used by the startup to initialize data */ _sidata = LOADADDR(.data); - /* Initialized data sections goes into RAM, load LMA copy after code */ + /* Initialized data sections into "RAM" Ram type memory */ .data : { . = ALIGN(4); @@ -144,7 +158,7 @@ SECTIONS } >RAM AT> FLASH - /* Uninitialized data section */ + /* Uninitialized data section into "RAM" Ram type memory */ . = ALIGN(4); .bss : { @@ -160,20 +174,20 @@ SECTIONS __bss_end__ = _ebss; } >RAM - /* User_heap_stack section, used to check that there is enough RAM left */ + /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */ ._user_heap_stack : { - . = ALIGN(4); + . = ALIGN(8); PROVIDE ( end = . ); PROVIDE ( _end = . ); . = . + _Min_Heap_Size; . = . + _Min_Stack_Size; - . = ALIGN(4); + . = ALIGN(8); } >RAM - /* Remove information from the standard libraries */ + /* Remove information from the compiler libraries */ /DISCARD/ : { libc.a ( * ) diff --git a/variants/NUCLEO_L452RE/variant.cpp b/variants/NUCLEO_L452RE/variant.cpp index 3bf47dc840..1caf06d596 100644 --- a/variants/NUCLEO_L452RE/variant.cpp +++ b/variants/NUCLEO_L452RE/variant.cpp @@ -24,6 +24,7 @@ extern "C" { // Pin number const PinName digitalPin[] = { +#ifdef ARDUINO_NUCLEO_L452RE PA_3, //D0 PA_2, //D1 PA_10, //D2 @@ -44,49 +45,114 @@ const PinName digitalPin[] = { // CN7 Left Side PC_10, //D16 PC_12, //D17 - NC, //D18 - BOOT0 - PA_13, //D19 - SWD - PA_14, //D20 - SWD - PA_15, //D21 - PB_7, //D22 - PC_13, //D23 - PC_14, //D24 - PC_15, //D25 - PH_0, //D26 - PH_1, //D27 - PC_2, //D28 - PC_3, //D29 + PA_13, //D18 - SWD + PA_14, //D19 - SWD + PA_15, //D20 + PB_7, //D21 + PC_13, //D22 + PC_14, //D23 + PC_15, //D24 + PH_0, //D25 + PH_1, //D26 + PC_2, //D27 + PC_3, //D28 // CN7 Right Side - PC_11, //D30 - PD_2, //D31 + PC_11, //D29 + PD_2, //D30 // CN10 Left Side - PC_9, //D32 + PC_9, //D31 // CN10 Right side - PC_8, //D33 - PC_6, //D34 - PC_5, //D35 - PA_12, //D36 - PA_11, //D37 - PB_12, //D38 - PB_11, //D39 - PB_2, //D40 - PB_1, //D41 - PB_15, //D42 - PB_14, //D43 - PB_13, //D44 - PC_4, //D45 - PA_0, //D46/A0 - PA_1, //D47/A1 - PA_4, //D48/A2 - PB_0, //D49/A3 - PC_1, //D50/A4 - PC_0, //D51/A5 + PC_8, //D32 + PC_6, //D33 + PC_5, //D34 + PA_12, //D35 + PA_11, //D36 + PB_12, //D37 + PB_11, //D38 + PB_2, //D39 + PB_1, //D40 + PB_15, //D41 + PB_14, //D42 + PB_13, //D43 + PC_4, //D44 + PA_0, //D45/A0 + PA_1, //D46/A1 + PA_4, //D47/A2 + PB_0, //D48/A3 + PC_1, //D49/A4 + PC_0, //D50/A5 // Duplicated pins in order to be aligned with PinMap_ADC - PA_7, //D52/A6 = D11 - PA_6, //D53/A7 = D12 - PC_2, //D54/A8 = D28 - PC_3, //D55/A9 = D29 - PC_4 //D56/A10 = D45 + PA_7, //D51/A6 = D11 + PA_6, //D52/A7 = D12 + PC_2, //D53/A8 = D27 + PC_3, //D54/A9 = D28 + PC_4 //D55/A10 = D44 +#else + PA_10, //D0 + PA_9, //D1 + PA_12, //D2 + PB_3, //D3 + PB_5, //D4 + PA_15, //D5 + PB_10, //D6 + PC_7, //D7 + PB_6, //D8 + PA_8, //D9 + PA_11, //D10 + PB_15, //D11 + PB_14, //D12 + PB_13, //D13 - LED + PB_7, //D14 + PB_8, //D15 + // ST Morpho + // CN5 Left Side + PC_10, //D16 + PC_12, //D17 + PB_12, //D18 + PA_13, //D19 - SWD + PA_14, //D20 - SWD + PC_13, //D21 + PC_14, //D22 + PC_15, //D23 + PH_0, //D24 + PH_1, //D25 + PB_4, //D26 + PB_9, //D27 + // CN5 Right Side + PC_11, //D28 + PD_2, //D29 + // CN6 Left Side + PC_9, //D30 + // CN6 Right side + PC_8, //D31 + PC_6, //D32 + PC_5, //D33 + PB_0, //D34 + PB_11, //D35 + PB_2, //D36 + PB_1, //D37 + PA_7, //D38 + PA_6, //D39 + PA_5, //D40 + PA_4, //D41 + PC_4, //D42 + PA_3, //D43 + PA_2, //D44 + PA_0, //D45 // A0 + PA_1, //D46 // A1 + PC_3, //D47 // A2 + PC_2, //D48 // A3 + PC_1, //D49 // A4 + PC_0, //D50 // A5 + // Duplicated pins in order to be aligned with PinMap_ADC + PA_4, //D51 // A6 = D41 + PA_5, //D52 // A7 = D40 + PA_6, //D53 // A8 = D39 + PA_7, //D54 // A9 = D38 + PB_0, //D55 // A10 = D34 + PB_1, //D56 // A11 = D37 + PC_4 //D57 // A12 = D42 +#endif }; #ifdef __cplusplus diff --git a/variants/NUCLEO_L452RE/variant.h b/variants/NUCLEO_L452RE/variant.h index 0ed4fafcc5..8cea14c221 100644 --- a/variants/NUCLEO_L452RE/variant.h +++ b/variants/NUCLEO_L452RE/variant.h @@ -26,7 +26,7 @@ extern "C" { /*---------------------------------------------------------------------------- * Pins *----------------------------------------------------------------------------*/ - +#ifdef ARDUINO_NUCLEO_L452RE #define PA3 0 #define PA2 1 #define PA10 2 @@ -47,49 +47,115 @@ extern "C" { // CN7 Left Side #define PC10 16 #define PC12 17 -// 18 is NC - BOOT0 -#define PA13 19 // SWD -#define PA14 20 // SWD -#define PA15 21 -#define PB7 22 -#define PC13 23 -#define PC14 24 -#define PC15 25 -#define PH0 26 -#define PH1 27 -#define PC2 28 // A8 -#define PC3 29 // A9 +#define PA13 18 // SWD +#define PA14 19 // SWD +#define PA15 20 +#define PB7 21 +#define PC13 22 +#define PC14 23 +#define PC15 24 +#define PH0 25 +#define PH1 26 +#define PC2 27 // A8 +#define PC3 28 // A9 // CN7 Right Side -#define PC11 30 -#define PD2 31 +#define PC11 29 +#define PD2 30 // CN10 Left Side -#define PC9 32 +#define PC9 31 // CN10 Right side -#define PC8 33 -#define PC6 34 -#define PC5 35 -#define PA12 36 -#define PA11 37 -#define PB12 38 -#define PB11 39 -#define PB2 40 -#define PB1 41 -#define PB15 42 -#define PB14 43 -#define PB13 44 -#define PC4 45 // A10 -#define PA0 46 // A0 -#define PA1 47 // A1 -#define PA4 48 // A2 -#define PB0 49 // A3 -#define PC1 50 // A4 -#define PC0 51 // A5 +#define PC8 32 +#define PC6 33 +#define PC5 34 // A12 +#define PA12 35 +#define PA11 36 +#define PB12 37 +#define PB11 38 +#define PB2 39 +#define PB1 40 // A11 +#define PB15 41 +#define PB14 42 +#define PB13 43 +#define PC4 44 // A10 +#define PA0 45 // A0 +#define PA1 46 // A1 +#define PA4 47 // A2 +#define PB0 48 // A3 +#define PC1 19 // A4 +#define PC0 50 // A5 +#else +#define PA10 0 +#define PA9 1 +#define PA12 2 +#define PB3 3 +#define PB5 4 +#define PA15 5 +#define PB10 6 +#define PC7 7 +#define PB6 8 +#define PA8 9 +#define PA11 10 +#define PB15 11 +#define PB14 12 +#define PB13 13 // LED +#define PB7 14 +#define PB8 15 +// ST Morpho +// CN5 Left Side +#define PC10 16 +#define PC12 17 +#define PB12 18 +#define PA13 19 // SWD +#define PA14 20 // SWD +#define PC13 21 +#define PC14 22 +#define PC15 23 +#define PH0 24 +#define PH1 25 +#define PB4 26 +#define PB9 27 +// CN5 Right Side +#define PC11 28 +#define PD2 29 +// CN6 Left Side +#define PC9 30 +// CN6 Right side +#define PC8 31 +#define PC6 32 +#define PC5 33 +#define PB0 34 // A10 +#define PB11 35 +#define PB2 36 +#define PB1 37 // A11 +#define PA7 38 // A9 +#define PA6 39 // A8 +#define PA5 40 // A7 +#define PA4 41 // A6 +#define PC4 42 // A12 +#define PA3 43 +#define PA2 44 +#define PA0 45 // A0 +#define PA1 46 // A1 +#define PC3 47 // A2 +#define PC2 48 // A3 +#define PC1 49 // A4 +#define PC0 50 // A5 +#endif // This must be a literal -#define NUM_DIGITAL_PINS 57 +#ifdef ARDUINO_NUCLEO_L452RE +// This must be a literal +#define NUM_DIGITAL_PINS 56 // This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS #define NUM_ANALOG_INPUTS 11 -#define NUM_ANALOG_FIRST 46 +#else +// This must be a literal +#define NUM_DIGITAL_PINS 58 +// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS +#define NUM_ANALOG_INPUTS 13 +#endif + +#define NUM_ANALOG_FIRST 45 // On-board LED pin number #define LED_BUILTIN 13 @@ -104,12 +170,16 @@ extern "C" { #define TIMER_SERVO TIM2 // UART Definitions +#ifdef ARDUINO_NUCLEO_L452RE #define SERIAL_UART_INSTANCE 2 //Connected to ST-Link +#else +#define SERIAL_UART_INSTANCE 0 //Connected to ST-Link +#endif // Default pin used for 'Serial' instance (ex: ST-Link) // Mandatory for Firmata -#define PIN_SERIAL_RX 0 -#define PIN_SERIAL_TX 1 +#define PIN_SERIAL_RX PA3 +#define PIN_SERIAL_TX PA2 /* Extra HAL modules */ #define HAL_DAC_MODULE_ENABLED