Skip to content

New board Discovery L475VG IOT #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from Sep 13, 2017
Merged
14 changes: 14 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,20 @@ Disco.menu.board_part_num.DISCO_F746NG.build.product_line=STM32F746xx
Disco.menu.board_part_num.DISCO_F746NG.build.variant=DISCO_F746NG
Disco.menu.board_part_num.DISCO_F746NG.build.cmsis_lib_gcc=arm_cortexM7l_math

# DISCO_L475VG_IOT board
# Support: USB HID, Serial1 (USART1 on PA1, PA0)
Disco.menu.board_part_num.DISCO_L475VG_IOT=STM32L475VG-DISCOVERY-IOT
Disco.menu.board_part_num.DISCO_L475VG_IOT.node=DIS_L4IOT
Disco.menu.board_part_num.DISCO_L475VG_IOT.upload.maximum_size=1048576
Disco.menu.board_part_num.DISCO_L475VG_IOT.upload.maximum_data_size=98304
Disco.menu.board_part_num.DISCO_L475VG_IOT.build.mcu=cortex-m4
Disco.menu.board_part_num.DISCO_L475VG_IOT.build.f_cpu=80000000L
Disco.menu.board_part_num.DISCO_L475VG_IOT.build.board=DISCO_L475VG_IOT
Disco.menu.board_part_num.DISCO_L475VG_IOT.build.series=STM32L4xx
Disco.menu.board_part_num.DISCO_L475VG_IOT.build.product_line=STM32L475xx
Disco.menu.board_part_num.DISCO_L475VG_IOT.build.variant=DISCO_L475VG_IOT
Disco.menu.board_part_num.DISCO_L475VG_IOT.build.cmsis_lib_gcc=arm_cortexM4l_math

# Upload menu
Disco.menu.upload_method.MassStorageMethod=Mass Storage
Disco.menu.upload_method.MassStorageMethod.upload.protocol=
Expand Down
3 changes: 3 additions & 0 deletions cores/arduino/stm32/PeripheralPins.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,8 @@ extern const PinMap PinMap_CAN_TD[];
//*** ETHERNET ***
extern const PinMap PinMap_Ethernet[];

//*** QUADSPI ***
extern const PinMap PinMap_QUADSPI[];

#endif

2 changes: 2 additions & 0 deletions cores/arduino/stm32/usbd_hid_composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ __ALIGN_BEGIN static uint8_t HID_KEYBOARD_ReportDesc[HID_KEYBOARD_REPORT_DESC_SI
static uint8_t USBD_HID_Init (USBD_HandleTypeDef *pdev,
uint8_t cfgidx)
{
UNUSED(cfgidx);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's ok, but why do you remove them ? can you explain in commit message ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removed only function parameters not used inside the function. There is no impact on the rest of the code but allow to remove some warning messages at compilation time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sorry - this is clear enough in the commit title already !

uint8_t ret = 0;

/* Open EP IN */
Expand Down Expand Up @@ -407,6 +408,7 @@ static uint8_t USBD_HID_Init (USBD_HandleTypeDef *pdev,
static uint8_t USBD_HID_DeInit (USBD_HandleTypeDef *pdev,
uint8_t cfgidx)
{
UNUSED(cfgidx);
/* Close HID EPs */
USBD_LL_CloseEP(pdev,
HID_MOUSE_EPIN_ADDR);
Expand Down
25 changes: 25 additions & 0 deletions libraries/SPI/src/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,31 @@ void SPIClass::transfer(uint8_t _pin, void *_buf, size_t _count, SPITransferMode
digitalWrite(_pin, HIGH);
}

void SPIClass::transfer(byte _pin, void *_bufout, void *_bufin, size_t _count, SPITransferMode _mode)
{
if ((_count == 0) || (_bufout == NULL) || (_bufin == NULL) || (_pin > NUM_DIGITAL_PINS))
return;

if(_pin != _CSpin) {
uint8_t idx = pinIdx(_pin, GET_IDX);
if(idx == NB_SPI_SETTINGS) {
return;
}
spi_init(&_spi, spiSettings[idx].clk,
spiSettings[idx].dMode,
spiSettings[idx].msb);
_CSpin = _pin;
}

if((_pin != CS_PIN_CONTROLLED_BY_USER) && (_spi.pin_ssel == NC))
digitalWrite(_pin, LOW);

spi_transfer(&_spi, ((uint8_t*)_bufout), ((uint8_t*)_bufin), _count, SPI_TRANSFER_TIMEOUT);

if((_pin != CS_PIN_CONTROLLED_BY_USER) && (_mode == SPI_LAST) && (_spi.pin_ssel == NC))
digitalWrite(_pin, HIGH);
}

void SPIClass::attachInterrupt(void) {
// Should be enableInterrupt()
}
Expand Down
6 changes: 6 additions & 0 deletions libraries/SPI/src/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class SPIClass {
byte transfer(uint8_t pin, uint8_t _data, SPITransferMode _mode = SPI_LAST);
uint16_t transfer16(uint8_t pin, uint16_t _data, SPITransferMode _mode = SPI_LAST);
void transfer(uint8_t pin, void *_buf, size_t _count, SPITransferMode _mode = SPI_LAST);
void transfer(byte _pin, void *_bufout, void *_bufin, size_t _count, SPITransferMode _mode = SPI_LAST);

// Transfer functions when user controls himself the CS pin.
byte transfer(uint8_t _data, SPITransferMode _mode = SPI_LAST)
Expand All @@ -131,6 +132,11 @@ class SPIClass {
transfer(CS_PIN_CONTROLLED_BY_USER, _buf, _count, _mode);
}

void transfer(void *_bufout, void *_bufin, size_t _count, SPITransferMode _mode = SPI_LAST)
{
transfer(CS_PIN_CONTROLLED_BY_USER, _bufout, _bufin, _count, _mode);
}

// Transaction Functions
void usingInterrupt(uint8_t interruptNumber);

Expand Down
374 changes: 374 additions & 0 deletions variants/DISCO_L475VG_IOT/PeripheralPins.c

Large diffs are not rendered by default.

201 changes: 201 additions & 0 deletions variants/DISCO_L475VG_IOT/ldscript.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
/*
*****************************************************************************
**

** File : LinkerScript.ld
**
** Abstract : Linker script for STM32L475VGTx Device with
** 1024KByte FLASH, 128KByte 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.
**
*****************************************************************************
** @attention
**
** <h2><center>&copy; COPYRIGHT(c) 2014 Ac6</center></h2>
**
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
** 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 Ac6 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.
**
*****************************************************************************
*/

/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = 0x20018000; /* 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 = 96K
RAM2 (xrw) : ORIGIN = 0x10000000, LENGTH = 32K
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(4):
{
. = 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);
*(.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 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(4);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(4);
} >RAM



/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}

.ARM.attributes 0 : { *(.ARM.attributes) }
}
Loading