nucleo-l552ze: Board Support
Support for the STMicroelectronics NUCLEO-L552ZE-Q development board. Signed-off-by: Michael Jung <mijung@gmx.net>
This commit is contained in:
parent
f3a5675cc4
commit
70c9d38437
@ -1275,6 +1275,15 @@ config ARCH_BOARD_NUCLEO_L476RG
|
||||
---help---
|
||||
STMicro Nucleo L476RG board based on the STMicro STM32L476RGT6 MCU.
|
||||
|
||||
config ARCH_BOARD_NUCLEO_L552ZE
|
||||
bool "STM32L552 Nucleo L552ZE"
|
||||
depends on ARCH_CHIP_STM32L552ZE
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
STMicro Nucleo STM32L552 board based on the STMicro STM32L552ZET6 MCU.
|
||||
|
||||
config ARCH_BOARD_QEMU_I486
|
||||
bool "Qemu i486 Mode"
|
||||
depends on ARCH_X86 || ARCH_I486
|
||||
@ -2303,6 +2312,7 @@ config ARCH_BOARD
|
||||
default "nucleo-l452re" if ARCH_BOARD_NUCLEO_L452RE
|
||||
default "nucleo-l476rg" if ARCH_BOARD_NUCLEO_L476RG
|
||||
default "nucleo-l496zg" if ARCH_BOARD_NUCLEO_L496ZG
|
||||
default "nucleo-l552ze" if ARCH_BOARD_NUCLEO_L552ZE
|
||||
default "nutiny-nuc120" if ARCH_BOARD_NUTINY_NUC120
|
||||
default "olimex-efm32g880f128-stk" if ARCH_BOARD_OLIMEX_EFM32G880F128_STK
|
||||
default "olimex-lpc1766stk" if ARCH_BOARD_LPC1766STK
|
||||
@ -2774,6 +2784,9 @@ endif
|
||||
if ARCH_BOARD_NUCLEO_L496ZG
|
||||
source "boards/arm/stm32l4/nucleo-l496zg/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_NUCLEO_L552ZE
|
||||
source "boards/arm/stm32l5/nucleo-l552ze/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_STM32L476_MDK
|
||||
source "boards/arm/stm32l4/stm32l476-mdk/Kconfig"
|
||||
endif
|
||||
|
4
boards/arm/stm32l5/drivers/Kconfig
Normal file
4
boards/arm/stm32l5/drivers/Kconfig
Normal file
@ -0,0 +1,4 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
8
boards/arm/stm32l5/nucleo-l552ze/Kconfig
Normal file
8
boards/arm/stm32l5/nucleo-l552ze/Kconfig
Normal file
@ -0,0 +1,8 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_NUCLEO_L552ZE
|
||||
|
||||
endif
|
216
boards/arm/stm32l5/nucleo-l552ze/README.txt
Normal file
216
boards/arm/stm32l5/nucleo-l552ze/README.txt
Normal file
@ -0,0 +1,216 @@
|
||||
Nucleo-L552ZE-Q README
|
||||
======================
|
||||
|
||||
This README file discusses the port of NuttX to the STMicro Nucleo-L552ZE
|
||||
board. That board features the STM32L552ZET6Q MCU with 512KiB of FLASH
|
||||
and 256KiB of SRAM.
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
- Status
|
||||
- LEDs
|
||||
- Buttons
|
||||
- Serial Console
|
||||
- Configurations
|
||||
|
||||
Status
|
||||
======
|
||||
2021-03-03: The board now boots and the basic NSH configuration works
|
||||
without problem.
|
||||
|
||||
LEDs
|
||||
====
|
||||
|
||||
The Board provides a 3 user LEDs, LD1-LD3
|
||||
LED1 (Green) PC_7
|
||||
LED2 (Blue) PB_7
|
||||
LED3 (Red) PA_9
|
||||
|
||||
- When the I/O is HIGH value, the LEDs are on.
|
||||
- When the I/O is LOW, the LEDs are off.
|
||||
|
||||
These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
|
||||
defined. In that case, the usage by the board port is defined in
|
||||
include/board.h and src/stm32_autoleds.c. The LEDs are used to encode OS
|
||||
related events as follows when the LEDs are available:
|
||||
|
||||
SYMBOL Meaning RED GREEN BLUE
|
||||
------------------- ----------------------- --- ----- ----
|
||||
|
||||
LED_STARTED NuttX has been started OFF OFF OFF
|
||||
LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
|
||||
LED_IRQSENABLED Interrupts enabled OFF ON OFF
|
||||
LED_STACKCREATED Idle stack created OFF ON ON
|
||||
LED_INIRQ In an interrupt NC NC ON (momentary)
|
||||
LED_SIGNAL In a signal handler NC ON OFF (momentary)
|
||||
LED_ASSERTION An assertion failed ON NC ON (momentary)
|
||||
LED_PANIC The system has crashed ON OFF OFF (flashing 2Hz)
|
||||
LED_IDLE MCU is is sleep mode ON OFF OFF
|
||||
|
||||
|
||||
OFF - means that the OS is still initializing. Initialization is very fast
|
||||
so if you see this at all, it probably means that the system is
|
||||
hanging up somewhere in the initialization phases.
|
||||
|
||||
GREEN - This means that the OS completed initialization.
|
||||
|
||||
BLUE - Whenever and interrupt or signal handler is entered, the BLUE LED is
|
||||
illuminated and extinguished when the interrupt or signal handler
|
||||
exits.
|
||||
|
||||
VIOLET - If a recovered assertion occurs, the RED and blue LED will be
|
||||
illuminated briefly while the assertion is handled. You will
|
||||
probably never see this.
|
||||
|
||||
Flashing RED - In the event of a fatal crash, all other LEDs will be
|
||||
extinguished and RED LED will FLASH at a 2Hz rate.
|
||||
|
||||
|
||||
Thus if the GREEN LED is lit, NuttX has successfully booted and is,
|
||||
apparently, running normally. If the RED LED is flashing at
|
||||
approximately 2Hz, then a fatal error has been detected and the system has
|
||||
halted.
|
||||
|
||||
Buttons
|
||||
=======
|
||||
|
||||
B1 USER: the user button is connected to the I/O PC13 (pin 2) of the STM32
|
||||
microcontroller.
|
||||
|
||||
Serial Consoles
|
||||
===============
|
||||
|
||||
USART3
|
||||
------
|
||||
|
||||
Default board is configured to use USART3 as console.
|
||||
|
||||
Pins and Connectors:
|
||||
|
||||
FUNC GPIO Connector
|
||||
Pin NAME
|
||||
---- --- ------- -----
|
||||
TXD: PD8 CN10-14 D1 TX
|
||||
RXD: PD9 CN10-16 D0 RX
|
||||
---- --- ------- -----
|
||||
|
||||
You must use a 3.3 TTL to RS-232 converter or a USB to 3.3V TTL
|
||||
|
||||
Nucleo 144 FTDI TTL-232R-3V3
|
||||
------------- -------------------
|
||||
TXD - CN10-14 - RXD - Pin 5 (Yellow)
|
||||
RXD - CN10-16 - TXD - Pin 4 (Orange)
|
||||
GND - GND Pin 1 (Black)
|
||||
------------- -------------------
|
||||
|
||||
*Note you will be reverse RX/TX
|
||||
|
||||
Use make menuconfig to configure USART3 as the console:
|
||||
|
||||
CONFIG_STM32L5_USART3=y
|
||||
CONFIG_USART3_SERIALDRIVER=y
|
||||
CONFIG_USART3_SERIAL_CONSOLE=y
|
||||
CONFIG_USART3_RXBUFSIZE=256
|
||||
CONFIG_USART3_TXBUFSIZE=256
|
||||
CONFIG_USART3_BAUD=115200
|
||||
CONFIG_USART3_BITS=8
|
||||
CONFIG_USART3_PARITY=0
|
||||
CONFIG_USART3_2STOP=0
|
||||
|
||||
Virtual COM Port
|
||||
----------------
|
||||
Yet another option is to use LPUART1 and the USB virtual COM port. This
|
||||
option may be more convenient for long term development, but is painful
|
||||
to use during board bring-up. However as LPUART peripheral has not been
|
||||
implemented for STM32L5, this cannot currently be used.
|
||||
|
||||
Solder Bridges. This configuration requires:
|
||||
|
||||
PG7 LPUART1 TX SB127 ON and SB124 OFF (Default)
|
||||
PG8 LPUART1 RX SB129 ON and SB126 OFF (Default)
|
||||
|
||||
You can also put USART3 on the virtual COM port by reworking the solder
|
||||
bridges as follows:
|
||||
|
||||
PD8 USART3 TX SB127 OFF and SB124 ON
|
||||
PD9 USART3 RX SB129 OFF and SB126 ON
|
||||
|
||||
Default
|
||||
-------
|
||||
As shipped, the virtual COM port is enabled.
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
Information Common to All Configurations
|
||||
----------------------------------------
|
||||
Each configuration is maintained in a sub-directory and can be
|
||||
selected as follow:
|
||||
|
||||
tools/configure.sh nucleo-l552ze:<subdir>
|
||||
|
||||
Before building, make sure the PATH environment variable includes the
|
||||
correct path to the directory than holds your toolchain binaries.
|
||||
|
||||
And then build NuttX by simply typing the following. At the conclusion of
|
||||
the make, the nuttx binary will reside in an ELF file called, simply, nuttx.
|
||||
|
||||
make oldconfig
|
||||
make
|
||||
|
||||
The <subdir> that is provided above as an argument to the tools/configure.sh
|
||||
must be is one of the following.
|
||||
|
||||
NOTES:
|
||||
|
||||
1. These configurations use the mconf-based configuration tool. To
|
||||
change any of these configurations using that tool, you should:
|
||||
|
||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
||||
see additional README.txt files in the NuttX tools repository.
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
2. Unless stated otherwise, all configurations generate console
|
||||
output on USART3, as described above under "Serial Console". The
|
||||
elevant configuration settings are listed below:
|
||||
|
||||
CONFIG_STM32L5_USART3=y
|
||||
CONFIG_STM32L5_USART3_SERIALDRIVER=y
|
||||
CONFIG_STM32L5_USART=y
|
||||
|
||||
CONFIG_USART3_SERIALDRIVER=y
|
||||
CONFIG_USART3_SERIAL_CONSOLE=y
|
||||
|
||||
CONFIG_USART3_RXBUFSIZE=256
|
||||
CONFIG_USART3_TXBUFSIZE=256
|
||||
CONFIG_USART3_BAUD=115200
|
||||
CONFIG_USART3_BITS=8
|
||||
CONFIG_USART3_PARITY=0
|
||||
CONFIG_USART3_2STOP=0
|
||||
|
||||
3. All of these configurations are set up to build under Linux using the
|
||||
"GNU Tools for ARM Embedded Processors" that is maintained by ARM
|
||||
(unless stated otherwise in the description of the configuration).
|
||||
|
||||
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
|
||||
|
||||
That toolchain selection can easily be reconfigured using
|
||||
'make menuconfig'. Here are the relevant current settings:
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_LINUX=y : Linux environment
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV8M_TOOLCHAIN_GNU_EABIL=y : GNU ARM EABI toolchain
|
||||
|
||||
Configuration sub-directories
|
||||
-----------------------------
|
||||
|
||||
nsh:
|
||||
|
||||
Configures the NuttShell (nsh) located at examples/nsh. This
|
||||
configuration is focused on low level, command-line driver testing.
|
||||
|
64
boards/arm/stm32l5/nucleo-l552ze/configs/nsh/defconfig
Normal file
64
boards/arm/stm32l5/nucleo-l552ze/configs/nsh/defconfig
Normal file
@ -0,0 +1,64 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDPARMS is not set
|
||||
# CONFIG_STANDARD_SERIAL is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="nucleo-l552ze"
|
||||
CONFIG_ARCH_BOARD_NUCLEO_L552ZE=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32l5"
|
||||
CONFIG_ARCH_CHIP_STM32L552ZE=y
|
||||
CONFIG_ARCH_CHIP_STM32L5=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_IRQBUTTONS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=4230
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_BUTTONS=y
|
||||
CONFIG_BUTTONS_LOWER=y
|
||||
CONFIG_DEBUG_ASSERTIONS=y
|
||||
CONFIG_DEBUG_ERROR=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEBUG_WARN=y
|
||||
CONFIG_EXAMPLES_BUTTONS=y
|
||||
CONFIG_EXAMPLES_BUTTONS_NAME0="USER"
|
||||
CONFIG_EXAMPLES_BUTTONS_NAMES=y
|
||||
CONFIG_EXAMPLES_BUTTONS_QTD=1
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_INPUT=y
|
||||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_NFILE_DESCRIPTORS=8
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_DISABLE_IFUPDOWN=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=131072
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_READLINE_CMD_HISTORY=y
|
||||
CONFIG_READLINE_TABCOMPLETION=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_STM32L5_USART3=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_STACKMONITOR=y
|
||||
CONFIG_SYSTEM_TEE=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USART3_SERIAL_CONSOLE=y
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
277
boards/arm/stm32l5/nucleo-l552ze/include/board.h
Normal file
277
boards/arm/stm32l5/nucleo-l552ze/include/board.h
Normal file
@ -0,0 +1,277 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l5/nucleo-l552ze/include/board.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_STM32L5_NUCLEO_L552ZE_INCLUDE_BOARD_H
|
||||
#define __BOARDS_ARM_STM32L5_NUCLEO_L552ZE_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
/* The NUCLEO-L552ZE-Q supports both HSE and LSE crystals (X2 and X3).
|
||||
* However, as shipped, the X3 crystal is not populated. Therefore the
|
||||
* Nucleo-L552ZE-Q will need to run off the 16MHz HSI clock, or the
|
||||
* 32kHz-synced MSI. This configuration uses the MSI.
|
||||
*
|
||||
* System Clock source : PLL (MSI)
|
||||
* SYSCLK(Hz) : 110000000 Determined by PLL configuration
|
||||
* HCLK(Hz) : 110000000 (STM32L5_RCC_CFGR_HPRE) (Max 110MHz)
|
||||
* AHB Prescaler : 1 (STM32L5_RCC_CFGR_HPRE) (Max 110MHz)
|
||||
* APB1 Prescaler : 1 (STM32L5_RCC_CFGR_PPRE1) (Max 110MHz)
|
||||
* APB2 Prescaler : 1 (STM32L5_RCC_CFGR_PPRE2) (Max 110MHz)
|
||||
* MSI Frequency(Hz) : 4000000 (nominal)
|
||||
* PLLM : 1 (STM32L5_PLLCFG_PLLM)
|
||||
* PLLN : 55 (STM32L5_PLLCFG_PLLN)
|
||||
* PLLP : 0 (STM32L5_PLLCFG_PLLP)
|
||||
* PLLQ : 0 (STM32L5_PLLCFG_PLLQ)
|
||||
* PLLR : 2 (STM32L5_PLLCFG_PLLR)
|
||||
* Flash Latency(WS) : 5
|
||||
*/
|
||||
|
||||
/* HSI - 16 MHz RC factory-trimmed
|
||||
* LSI - 32 KHz RC
|
||||
* MSI - 4 MHz, autotrimmed via LSE
|
||||
* HSE - not installed
|
||||
* LSE - 32.768 kHz installed
|
||||
*/
|
||||
|
||||
#define STM32L5_HSI_FREQUENCY 16000000ul
|
||||
#define STM32L5_LSI_FREQUENCY 32000
|
||||
#define STM32L5_LSE_FREQUENCY 32768
|
||||
|
||||
#define STM32L5_BOARD_USEMSI 1
|
||||
#define STM32L5_BOARD_MSIRANGE RCC_CR_MSIRANGE_4M
|
||||
|
||||
/* prescaler common to all PLL inputs */
|
||||
|
||||
#define STM32L5_PLLCFG_PLLM RCC_PLLCFG_PLLM(1)
|
||||
|
||||
/* 'main' PLL config; we use this to generate our system clock */
|
||||
|
||||
#define STM32L5_PLLCFG_PLLN RCC_PLLCFG_PLLN(55)
|
||||
#define STM32L5_PLLCFG_PLLP 0
|
||||
#undef STM32L5_PLLCFG_PLLP_ENABLED
|
||||
#define STM32L5_PLLCFG_PLLQ 0
|
||||
#undef STM32L5_PLLCFG_PLLQ_ENABLED
|
||||
#define STM32L5_PLLCFG_PLLR RCC_PLLCFG_PLLR_2
|
||||
#define STM32L5_PLLCFG_PLLR_ENABLED
|
||||
|
||||
/* 'SAIPLL1' is not used in this application */
|
||||
|
||||
#define STM32L5_PLLSAI1CFG_PLLN RCC_PLLSAI1CFG_PLLN(24)
|
||||
#define STM32L5_PLLSAI1CFG_PLLP 0
|
||||
#undef STM32L5_PLLSAI1CFG_PLLP_ENABLED
|
||||
#define STM32L5_PLLSAI1CFG_PLLQ 0
|
||||
#undef STM32L5_PLLSAI1CFG_PLLQ_ENABLED
|
||||
#define STM32L5_PLLSAI1CFG_PLLR 0
|
||||
#undef STM32L5_PLLSAI1CFG_PLLR_ENABLED
|
||||
|
||||
/* 'SAIPLL2' is not used in this application */
|
||||
|
||||
#define STM32L5_PLLSAI2CFG_PLLN RCC_PLLSAI2CFG_PLLN(8)
|
||||
#define STM32L5_PLLSAI2CFG_PLLP 0
|
||||
#undef STM32L5_PLLSAI2CFG_PLLP_ENABLED
|
||||
#define STM32L5_PLLSAI2CFG_PLLR 0
|
||||
#undef STM32L5_PLLSAI2CFG_PLLR_ENABLED
|
||||
|
||||
#define STM32L5_SYSCLK_FREQUENCY 110000000ul
|
||||
|
||||
/* Enable CLK48; get it from HSI48 */
|
||||
|
||||
#if defined(CONFIG_STM32L5_USBFS) || defined(CONFIG_STM32L5_RNG)
|
||||
# define STM32L5_USE_CLK48 1
|
||||
# define STM32L5_CLK48_SEL RCC_CCIPR_CLK48SEL_HSI48
|
||||
# define STM32L5_HSI48_SYNCSRC SYNCSRC_NONE
|
||||
#endif
|
||||
|
||||
/* Enable LSE (for the RTC and for MSI autotrimming) */
|
||||
|
||||
#define STM32L5_USE_LSE 1
|
||||
|
||||
/* Configure the HCLK divisor (for the AHB bus, core, memory, and DMA */
|
||||
|
||||
#define STM32L5_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK /* HCLK = SYSCLK / 1 */
|
||||
#define STM32L5_HCLK_FREQUENCY STM32L5_SYSCLK_FREQUENCY
|
||||
#define STM32L5_BOARD_HCLK STM32L5_HCLK_FREQUENCY /* Same as above, to satisfy compiler */
|
||||
|
||||
/* Configure the APB1 prescaler */
|
||||
|
||||
#define STM32L5_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLK /* PCLK1 = HCLK / 1 */
|
||||
#define STM32L5_PCLK1_FREQUENCY (STM32L5_HCLK_FREQUENCY / 1)
|
||||
|
||||
#define STM32L5_APB1_TIM2_CLKIN (STM32L5_PCLK1_FREQUENCY)
|
||||
#define STM32L5_APB1_TIM3_CLKIN (STM32L5_PCLK1_FREQUENCY)
|
||||
#define STM32L5_APB1_TIM4_CLKIN (STM32L5_PCLK1_FREQUENCY)
|
||||
#define STM32L5_APB1_TIM5_CLKIN (STM32L5_PCLK1_FREQUENCY)
|
||||
#define STM32L5_APB1_TIM6_CLKIN (STM32L5_PCLK1_FREQUENCY)
|
||||
#define STM32L5_APB1_TIM7_CLKIN (STM32L5_PCLK1_FREQUENCY)
|
||||
|
||||
/* Configure the APB2 prescaler */
|
||||
|
||||
#define STM32L5_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK /* PCLK2 = HCLK / 1 */
|
||||
#define STM32L5_PCLK2_FREQUENCY (STM32L5_HCLK_FREQUENCY / 1)
|
||||
|
||||
#define STM32L5_APB2_TIM1_CLKIN (STM32L5_PCLK2_FREQUENCY)
|
||||
#define STM32L5_APB2_TIM15_CLKIN (STM32L5_PCLK2_FREQUENCY)
|
||||
#define STM32L5_APB2_TIM16_CLKIN (STM32L5_PCLK2_FREQUENCY)
|
||||
|
||||
/* The timer clock frequencies are automatically defined by hardware. If the
|
||||
* APB prescaler equals 1, the timer clock frequencies are set to the same
|
||||
* frequency as that of the APB domain. Otherwise they are set to twice.
|
||||
* Note: TIM1,15,16 are on APB2, others on APB1
|
||||
*/
|
||||
|
||||
#define BOARD_TIM1_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_TIM2_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_TIM3_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_TIM4_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_TIM5_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_TIM6_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_TIM7_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_TIM15_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_TIM16_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_LPTIM1_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
#define BOARD_LPTIM2_FREQUENCY STM32L5_HCLK_FREQUENCY
|
||||
|
||||
/* DMA Channel/Stream Selections ********************************************/
|
||||
|
||||
/* Alternate function pin selections ****************************************/
|
||||
|
||||
/* USART3: Connected to Arduino connector D0/D1 (or to STLink VCP if solder
|
||||
* bridges SB123 to SB130 are re-worked accordingly).
|
||||
*/
|
||||
|
||||
#define GPIO_USART3_RX GPIO_USART3_RX_4 /* PD9 */
|
||||
#define GPIO_USART3_TX GPIO_USART3_TX_4 /* PD8 */
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* The Nucleo-144 board has numerous LEDs but only three, LD1 a Green LED,
|
||||
* LD2 a Blue LED and LD3 a Red LED, that can be controlled by software.
|
||||
* The following definitions assume the default Solder Bridges are installed.
|
||||
*
|
||||
* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs
|
||||
* in any way.
|
||||
* The following definitions are used to access individual LEDs.
|
||||
*/
|
||||
|
||||
/* LED index values for use with board_userled() */
|
||||
|
||||
#define BOARD_LED1 0
|
||||
#define BOARD_LED2 1
|
||||
#define BOARD_LED3 2
|
||||
#define BOARD_NLEDS 3
|
||||
|
||||
#define BOARD_LED_GREEN BOARD_LED1
|
||||
#define BOARD_LED_BLUE BOARD_LED2
|
||||
#define BOARD_LED_RED BOARD_LED3
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
||||
#define BOARD_LED3_BIT (1 << BOARD_LED3)
|
||||
|
||||
/* If CONFIG_ARCH_LEDS is defined, the usage by the board port is defined in
|
||||
* include/board.h and src/stm32_autoleds.c. The LEDs are used to encode OS-
|
||||
* related events as follows:
|
||||
*
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* Red Green Blue
|
||||
* ---------------------- -------------------------- ------ ------ ----
|
||||
*/
|
||||
#define LED_STARTED 0 /* NuttX has been started OFF OFF OFF */
|
||||
#define LED_HEAPALLOCATE 1 /* Heap has been allocated OFF OFF ON */
|
||||
#define LED_IRQSENABLED 2 /* Interrupts enabled OFF ON OFF */
|
||||
#define LED_STACKCREATED 3 /* Idle stack created OFF ON ON */
|
||||
#define LED_INIRQ 4 /* In an interrupt N/C N/C GLOW */
|
||||
#define LED_SIGNAL 5 /* In a signal handler N/C GLOW N/C */
|
||||
#define LED_ASSERTION 6 /* An assertion failed GLOW N/C GLOW */
|
||||
#define LED_PANIC 7 /* The system has crashed Blink OFF N/C */
|
||||
#define LED_IDLE 8 /* MCU is is sleep mode ON OFF OFF */
|
||||
|
||||
/* Thus if the Green LED is statically on, NuttX has successfully booted and
|
||||
* is, apparently, running normally. If the Red LED is flashing at
|
||||
* approximately 2Hz, then a fatal error has been detected and the system
|
||||
* has halted.
|
||||
*/
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/* The Nucleo-L552ZE supports one button: Pushbutton B1, labeled "User", is
|
||||
* connected to GPIO PC13.
|
||||
* A high value will be sensed when the button is pressed.
|
||||
*/
|
||||
|
||||
#define BUTTON_USER 0
|
||||
#define NUM_BUTTONS 1
|
||||
#define BUTTON_USER_BIT (1 << BUTTON_USER)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32l5_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All STM32L5 architectures must provide the following entry point.
|
||||
* This entry point is called early in the initialization -- after all
|
||||
* memory has been configured and mapped but before any devices
|
||||
* have been initialized.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void stm32l5_board_initialize(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_STM32L5_NUCLEO_L552ZE_INCLUDE_BOARD_H */
|
69
boards/arm/stm32l5/nucleo-l552ze/scripts/Make.defs
Normal file
69
boards/arm/stm32l5/nucleo-l552ze/scripts/Make.defs
Normal file
@ -0,0 +1,69 @@
|
||||
##############################################################################
|
||||
# boards/arm/stm32l5/nucleo-l552ze/scripts/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv8-m/Toolchain.defs
|
||||
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.ld}"
|
||||
else
|
||||
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.ld
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
# enable precise stack overflow tracking
|
||||
ifeq ($(CONFIG_ARMV8M_STACKCHECK),y)
|
||||
INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) $(INSTRUMENTATIONDEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) $(INSTRUMENTATIONDEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
ifneq ($(CROSSDEV),arm-nuttx-eabi-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
103
boards/arm/stm32l5/nucleo-l552ze/scripts/flash.ld
Normal file
103
boards/arm/stm32l5/nucleo-l552ze/scripts/flash.ld
Normal file
@ -0,0 +1,103 @@
|
||||
/*****************************************************************************
|
||||
* boards/arm/stm32l5/nucleo-l552ze/scripts/flash.ld
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The STM32L5xx has 512Kb of FLASH beginning at address 0x0800:0000 and
|
||||
* 256Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
|
||||
* FLASH memory is aliased to address 0x0000:0000 where the code expects to
|
||||
* begin execution by jumping to the entry point in the 0x0800:0000 address
|
||||
* range.
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
.init_section : {
|
||||
_sinit = ABSOLUTE(.);
|
||||
*(.init_array .init_array.*)
|
||||
_einit = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} > flash
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} > flash
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
_eronly = ABSOLUTE(.);
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
2
boards/arm/stm32l5/nucleo-l552ze/src/.gitignore
vendored
Normal file
2
boards/arm/stm32l5/nucleo-l552ze/src/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/.depend
|
||||
/Make.dep
|
40
boards/arm/stm32l5/nucleo-l552ze/src/Makefile
Normal file
40
boards/arm/stm32l5/nucleo-l552ze/src/Makefile
Normal file
@ -0,0 +1,40 @@
|
||||
##############################################################################
|
||||
# boards/arm/stm32l5/nucleo-l552ze/src/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = stm32_boot.c stm32_bringup.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += stm32_autoleds.c
|
||||
else
|
||||
CSRCS += stm32_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += stm32_buttons.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += stm32_appinit.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
120
boards/arm/stm32l5/nucleo-l552ze/src/nucleo-l552ze.h
Normal file
120
boards/arm/stm32l5/nucleo-l552ze/src/nucleo-l552ze.h
Normal file
@ -0,0 +1,120 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l5/nucleo-l55ze/src/nucleo-l552ze.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_STM32L5_NUCLEO_L552ZE_SRC_NUCLEO_L552ZE_H
|
||||
#define __BOARDS_ARM_STM32L5_NUCLEO_L552ZE_SRC_NUCLEO_L552ZE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "stm32l5_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#define HAVE_PROC 1
|
||||
#define HAVE_RTC_DRIVER 1
|
||||
|
||||
#if !defined(CONFIG_FS_PROCFS)
|
||||
# undef HAVE_PROC
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PROC) && defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# warning Mountpoints disabled. No procfs support
|
||||
# undef HAVE_PROC
|
||||
#endif
|
||||
|
||||
/* Check if we can support the RTC driver */
|
||||
|
||||
#if !defined(CONFIG_RTC) || !defined(CONFIG_RTC_DRIVER)
|
||||
# undef HAVE_RTC_DRIVER
|
||||
#endif
|
||||
|
||||
/* Nucleo-L552ZE GPIOs ******************************************************/
|
||||
|
||||
/* LED I/O Pin Color
|
||||
* LD1 PC7 97 Green
|
||||
* LD2 PB7 136 Blue
|
||||
* LD3 PA9 101 Red
|
||||
*
|
||||
* - When the I/O is HIGH value, the LED is on.
|
||||
* - When the I/O is LOW, the LED is off.
|
||||
*/
|
||||
|
||||
#define GPIO_LD1 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHZ | \
|
||||
GPIO_OUTPUT_CLEAR | GPIO_PORTC | GPIO_PIN7)
|
||||
#define GPIO_LD2 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHZ | \
|
||||
GPIO_OUTPUT_CLEAR | GPIO_PORTB | GPIO_PIN7)
|
||||
#define GPIO_LD3 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHZ | \
|
||||
GPIO_OUTPUT_CLEAR | GPIO_PORTA | GPIO_PIN9)
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/* B1 USER: the user button is connected to the I/O PC13 (pin 7) of the STM32
|
||||
* microcontroller.
|
||||
*/
|
||||
|
||||
#define MIN_IRQBUTTON BUTTON_USER
|
||||
#define MAX_IRQBUTTON BUTTON_USER
|
||||
#define NUM_IRQBUTTONS 1
|
||||
|
||||
#define GPIO_BTN_USER (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | \
|
||||
GPIO_PORTC | GPIO_PIN13)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_STM32L5_NUCLEO_L552ZE_SRC_NUCLEO_L552ZE_H */
|
71
boards/arm/stm32l5/nucleo-l552ze/src/stm32_appinit.c
Normal file
71
boards/arm/stm32l5/nucleo-l552ze/src/stm32_appinit.c
Normal file
@ -0,0 +1,71 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l5/nucleo-l552ze/src/stm32_appinit.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nucleo-l552ze.h"
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value cold be such things as a
|
||||
* mode enumeration value, a set of DIP switch switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
/* Did we already initialize via board_late_initialize()? */
|
||||
|
||||
#ifndef CONFIG_BOARD_LATE_INITIALIZE
|
||||
return stm32_bringup();
|
||||
#else
|
||||
return OK;
|
||||
#endif
|
||||
}
|
175
boards/arm/stm32l5/nucleo-l552ze/src/stm32_autoleds.c
Normal file
175
boards/arm/stm32l5/nucleo-l552ze/src/stm32_autoleds.c
Normal file
@ -0,0 +1,175 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l5/nucleo-l552ze/src/stm32_autoleds.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "arm_arch.h"
|
||||
#include "arm_internal.h"
|
||||
#include "stm32l5_gpio.h"
|
||||
#include "nucleo-l552ze.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Indexed by BOARD_LED_<color> */
|
||||
|
||||
static const uint32_t g_ledmap[BOARD_NLEDS] =
|
||||
{
|
||||
GPIO_LD1,
|
||||
GPIO_LD2,
|
||||
GPIO_LD3,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static void phy_set_led(int led, bool state)
|
||||
{
|
||||
/* Active High */
|
||||
|
||||
stm32l5_gpiowrite(g_ledmap[led], state);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure the LD1, LD2 and LD3 GPIOs for output. Initial state is OFF */
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(g_ledmap); i++)
|
||||
{
|
||||
stm32l5_configgpio(g_ledmap[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
switch (led)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
|
||||
case LED_HEAPALLOCATE:
|
||||
phy_set_led(BOARD_LED_BLUE, true);
|
||||
break;
|
||||
|
||||
case LED_IRQSENABLED:
|
||||
phy_set_led(BOARD_LED_BLUE, false);
|
||||
phy_set_led(BOARD_LED_GREEN, true);
|
||||
break;
|
||||
|
||||
case LED_STACKCREATED:
|
||||
phy_set_led(BOARD_LED_GREEN, true);
|
||||
phy_set_led(BOARD_LED_BLUE, true);
|
||||
break;
|
||||
|
||||
case LED_INIRQ:
|
||||
phy_set_led(BOARD_LED_BLUE, true);
|
||||
break;
|
||||
|
||||
case LED_SIGNAL:
|
||||
phy_set_led(BOARD_LED_GREEN, true);
|
||||
break;
|
||||
|
||||
case LED_ASSERTION:
|
||||
phy_set_led(BOARD_LED_RED, true);
|
||||
phy_set_led(BOARD_LED_BLUE, true);
|
||||
break;
|
||||
|
||||
case LED_PANIC:
|
||||
phy_set_led(BOARD_LED_RED, true);
|
||||
break;
|
||||
|
||||
case LED_IDLE:
|
||||
phy_set_led(BOARD_LED_RED, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
switch (led)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
|
||||
case LED_SIGNAL:
|
||||
phy_set_led(BOARD_LED_GREEN, false);
|
||||
break;
|
||||
|
||||
case LED_INIRQ:
|
||||
phy_set_led(BOARD_LED_BLUE, false);
|
||||
break;
|
||||
|
||||
case LED_ASSERTION:
|
||||
phy_set_led(BOARD_LED_RED, false);
|
||||
phy_set_led(BOARD_LED_BLUE, false);
|
||||
break;
|
||||
|
||||
case LED_PANIC:
|
||||
phy_set_led(BOARD_LED_RED, false);
|
||||
break;
|
||||
|
||||
case LED_IDLE:
|
||||
phy_set_led(BOARD_LED_RED, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
81
boards/arm/stm32l5/nucleo-l552ze/src/stm32_boot.c
Normal file
81
boards/arm/stm32l5/nucleo-l552ze/src/stm32_boot.c
Normal file
@ -0,0 +1,81 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l5/nucleo-l552ze/src/stm32_boot.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "arm_arch.h"
|
||||
#include "nucleo-l552ze.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32l5_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following entry point. This
|
||||
* entry point is called early in the intitialization -- after all memory
|
||||
* has been configured and mapped but before any devices have been
|
||||
* initialized.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void stm32l5_board_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
board_autoled_initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_late_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
|
||||
* initialization call will be performed in the boot-up sequence to a
|
||||
* function called board_late_initialize(). board_late_initialize() will
|
||||
* be called immediately after up_initialize() is called and just before
|
||||
* the initial application is started. This additional initialization
|
||||
* phase may be used, for example, to initialize board-specific device
|
||||
* drivers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
void board_late_initialize(void)
|
||||
{
|
||||
/* Perform board-specific initialization here if so configured */
|
||||
|
||||
(void)stm32_bringup();
|
||||
}
|
||||
#endif
|
105
boards/arm/stm32l5/nucleo-l552ze/src/stm32_bringup.c
Normal file
105
boards/arm/stm32l5/nucleo-l552ze/src/stm32_bringup.c
Normal file
@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l5/nucleo-l552ze/src/stm32_bringup.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/input/buttons.h>
|
||||
#include <nuttx/leds/userled.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "nucleo-l552ze.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER)
|
||||
/* Register the LED driver */
|
||||
|
||||
ret = userled_lower_initialize("/dev/userleds");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
#ifdef CONFIG_BUTTONS_LOWER
|
||||
iinfo("Initializing button driver\n");
|
||||
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
ierr("ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#else
|
||||
/* Enable BUTTON support for some other purpose */
|
||||
|
||||
board_button_initialize();
|
||||
#endif
|
||||
#endif /* CONFIG_BUTTONS */
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
113
boards/arm/stm32l5/nucleo-l552ze/src/stm32_buttons.c
Normal file
113
boards/arm/stm32l5/nucleo-l552ze/src/stm32_buttons.c
Normal file
@ -0,0 +1,113 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l5/nucleo-l552ze/src/stm32_buttons.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "stm32l5_gpio.h"
|
||||
#include "nucleo-l552ze.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_button_initialize(void)
|
||||
{
|
||||
/* Configure the single button as an input. NOTE that EXTI interrupts are
|
||||
* also configured for the pin.
|
||||
*/
|
||||
|
||||
stm32l5_configgpio(GPIO_BTN_USER);
|
||||
return NUM_BUTTONS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
/* Check the state of the USER button. */
|
||||
|
||||
return stm32l5_gpioread(GPIO_BTN_USER) ? BUTTON_USER_BIT : 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns a
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released. The ID value is
|
||||
* a button enumeration value that uniquely identifies a button resource.
|
||||
* See the BUTTON_* definitions in board.h for the meaning of enumeration
|
||||
* value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
ret = stm32l5_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler,
|
||||
arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
128
boards/arm/stm32l5/nucleo-l552ze/src/stm32_userleds.c
Normal file
128
boards/arm/stm32l5/nucleo-l552ze/src/stm32_userleds.c
Normal file
@ -0,0 +1,128 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32l5/nucleo-l552ze/src/stm32_userleds.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32l5_gpio.h"
|
||||
#include "nucleo-l552ze.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This array maps an LED number to GPIO pin configuration and is indexed by
|
||||
* BOARD_LED_<color>
|
||||
*/
|
||||
|
||||
static const uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||
{
|
||||
GPIO_LD1,
|
||||
GPIO_LD2,
|
||||
GPIO_LD3,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
|
||||
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the
|
||||
* board_userled_initialize() is available to initialize the LED from user
|
||||
* application logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_userled_initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure LED1-3 GPIOs for output */
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(g_ledcfg); i++)
|
||||
{
|
||||
stm32l5_configgpio(g_ledcfg[i]);
|
||||
}
|
||||
|
||||
return BOARD_NLEDS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
|
||||
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled() is
|
||||
* available to control the LEDs from user application logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if ((unsigned)led < ARRAYSIZE(g_ledcfg))
|
||||
{
|
||||
stm32l5_gpiowrite(g_ledcfg[led], ledon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
|
||||
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled_all()
|
||||
* is available to control the LED from user application logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint32_t ledset)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure LED1-3 GPIOs for output */
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(g_ledcfg); i++)
|
||||
{
|
||||
stm32l5_gpiowrite(g_ledcfg[i], (ledset & (1 << i)) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
Loading…
Reference in New Issue
Block a user