mirror of
https://github.com/apache/nuttx.git
synced 2026-09-01 06:33:00 +00:00
boards/arm/stm32c5: Add nucleo-C562re support
Add initial support for nucleo-C562re Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
This commit is contained in:
parent
84d50ebea2
commit
f1d516fa44
18 changed files with 985 additions and 1 deletions
|
|
@ -0,0 +1,32 @@
|
|||
=================
|
||||
ST NUCLEO-C562RE
|
||||
=================
|
||||
|
||||
.. tags:: chip:stm32, chip:stm32c5, chip:stm32c562
|
||||
|
||||
The `NUCLEO-C562RE <https://www.st.com/en/evaluation-tools/nucleo-c562re.html>`_
|
||||
is an STM32 Nucleo-64 board featuring an STM32C562RE microcontroller with
|
||||
512 KiB of Flash and 128 KiB of SRAM. The board includes an ST-LINK-V3EC
|
||||
debugger and programmer with a virtual COM port.
|
||||
|
||||
Clocking
|
||||
========
|
||||
|
||||
NuttX uses the board's 24 MHz HSE oscillator as the PSI reference and runs the
|
||||
CPU, AHB, and APB buses at 144 MHz. The board also has a 32.768 kHz LSE
|
||||
oscillator.
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
nsh
|
||||
---
|
||||
|
||||
Configures a small internal-flash NuttShell image with USART2 as the serial
|
||||
console and the green status LED enabled.
|
||||
|
||||
jumbo
|
||||
-----
|
||||
|
||||
Enables a broader set of NuttX features for additional build and runtime
|
||||
coverage.
|
||||
|
|
@ -3328,6 +3328,17 @@ config ARCH_BOARD_NUCLEO_U3C5ZI_Q
|
|||
a Cortex-M33 MCU running at up to 96 MHz with 2 MiB Flash and
|
||||
640 KiB SRAM.
|
||||
|
||||
config ARCH_BOARD_NUCLEO_C562RE
|
||||
bool "STMicro NUCLEO-C562RE board"
|
||||
depends on ARCH_CHIP_STM32C562RE
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
STMicro NUCLEO-C562RE development board featuring the STM32C562RE,
|
||||
a Cortex-M33 MCU running at up to 144 MHz with 512 KiB Flash and
|
||||
128 KiB SRAM.
|
||||
|
||||
config ARCH_BOARD_STM32L476VG_DISCO
|
||||
bool "STMicro STM32L476VG -Discovery board"
|
||||
depends on ARCH_CHIP_STM32L476RG
|
||||
|
|
@ -4195,6 +4206,7 @@ config ARCH_BOARD
|
|||
default "nucleo-n657x0-q" if ARCH_BOARD_NUCLEO_N657X0_Q
|
||||
default "nucleo-u5a5zj-q" if ARCH_BOARD_NUCLEO_U5A5ZJ_Q
|
||||
default "nucleo-u3c5zi-q" if ARCH_BOARD_NUCLEO_U3C5ZI_Q
|
||||
default "nucleo-c562re" if ARCH_BOARD_NUCLEO_C562RE
|
||||
default "stm32l476vg-disco" if ARCH_BOARD_STM32L476VG_DISCO
|
||||
default "stm32l476-mdk" if ARCH_BOARD_STM32L476_MDK
|
||||
default "stm32l4r9ai-disco" if ARCH_BOARD_STM32L4R9AI_DISCO
|
||||
|
|
@ -5485,7 +5497,7 @@ endif
|
|||
if ARCH_CHIP_SAMV7
|
||||
source "boards/arm/samv7/common/Kconfig"
|
||||
endif
|
||||
if ARCH_CHIP_STM32C0 || ARCH_CHIP_STM32F0 || ARCH_CHIP_STM32F1 || ARCH_CHIP_STM32F2 || ARCH_CHIP_STM32F3 || ARCH_CHIP_STM32F4 || ARCH_CHIP_STM32F7 || ARCH_CHIP_STM32G0 || ARCH_CHIP_STM32G4 || ARCH_CHIP_STM32L0 || ARCH_CHIP_STM32L1 || ARCH_CHIP_STM32H7 || ARCH_CHIP_STM32H5 || ARCH_CHIP_STM32L5 || ARCH_CHIP_STM32U0 || ARCH_CHIP_STM32U3 || ARCH_CHIP_STM32U5 || ARCH_CHIP_STM32WB || ARCH_CHIP_STM32WL5 || ARCH_CHIP_STM32N6
|
||||
if ARCH_CHIP_STM32C0 || ARCH_CHIP_STM32C5 || ARCH_CHIP_STM32F0 || ARCH_CHIP_STM32F1 || ARCH_CHIP_STM32F2 || ARCH_CHIP_STM32F3 || ARCH_CHIP_STM32F4 || ARCH_CHIP_STM32F7 || ARCH_CHIP_STM32G0 || ARCH_CHIP_STM32G4 || ARCH_CHIP_STM32L0 || ARCH_CHIP_STM32L1 || ARCH_CHIP_STM32H7 || ARCH_CHIP_STM32H5 || ARCH_CHIP_STM32L5 || ARCH_CHIP_STM32U0 || ARCH_CHIP_STM32U3 || ARCH_CHIP_STM32U5 || ARCH_CHIP_STM32WB || ARCH_CHIP_STM32WL5 || ARCH_CHIP_STM32N6
|
||||
source "boards/arm/common/stm32/Kconfig"
|
||||
endif
|
||||
if ARCH_CHIP_RP2040
|
||||
|
|
|
|||
25
boards/arm/stm32c5/common/CMakeLists.txt
Normal file
25
boards/arm/stm32c5/common/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# ##############################################################################
|
||||
# boards/arm/stm32c5/common/CMakeLists.txt
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
if(CONFIG_ARCH_BOARD_COMMON)
|
||||
add_subdirectory(${NUTTX_DIR}/boards/arm/common/stm32 stm32_common)
|
||||
endif()
|
||||
38
boards/arm/stm32c5/common/Makefile
Normal file
38
boards/arm/stm32c5/common/Makefile
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#############################################################################
|
||||
# boards/arm/stm32c5/common/Makefile
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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
|
||||
|
||||
STM32_BOARD_COMMON_DIR := $(TOPDIR)$(DELIM)boards$(DELIM)arm$(DELIM)common$(DELIM)stm32
|
||||
STM32_COMMON_SRCDIR := $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)common$(DELIM)stm32
|
||||
|
||||
include board/Make.defs
|
||||
include $(STM32_BOARD_COMMON_DIR)$(DELIM)src$(DELIM)Make.defs
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
|
||||
ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
|
||||
BOARDDIR = $(ARCHSRCDIR)$(DELIM)board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(BOARDDIR)$(DELIM)include
|
||||
CFLAGS += ${INCDIR_PREFIX}$(STM32_COMMON_SRCDIR)
|
||||
23
boards/arm/stm32c5/nucleo-c562re/CMakeLists.txt
Normal file
23
boards/arm/stm32c5/nucleo-c562re/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# ##############################################################################
|
||||
# boards/arm/stm32c5/nucleo-c562re/CMakeLists.txt
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
add_subdirectory(src)
|
||||
72
boards/arm/stm32c5/nucleo-c562re/configs/jumbo/defconfig
Normal file
72
boards/arm/stm32c5/nucleo-c562re/configs/jumbo/defconfig
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#
|
||||
# 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_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="nucleo-c562re"
|
||||
CONFIG_ARCH_BOARD_NUCLEO_C562RE=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32c5"
|
||||
CONFIG_ARCH_CHIP_STM32=y
|
||||
CONFIG_ARCH_CHIP_STM32C562RE=y
|
||||
CONFIG_ARCH_CHIP_STM32C5=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_IRQBUTTONS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=7200
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_EXAMPLES_BUTTONS=y
|
||||
CONFIG_EXAMPLES_BUTTONS_NAME0="B1"
|
||||
CONFIG_EXAMPLES_BUTTONS_NAMES=y
|
||||
CONFIG_EXAMPLES_BUTTONS_QTD=1
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_FS_TMPFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INPUT=y
|
||||
CONFIG_INPUT_BUTTONS=y
|
||||
CONFIG_INPUT_BUTTONS_LOWER=y
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBM=y
|
||||
CONFIG_LINE_MAX=64
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_MAXARGUMENTS=12
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_RAMLOG=y
|
||||
CONFIG_RAMLOG_BUFSIZE=8192
|
||||
CONFIG_RAMLOG_SYSLOG=y
|
||||
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_CPULOAD_SYSCLK=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_IRQMONITOR=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_SYSLOG_INTBUFFER=y
|
||||
CONFIG_SYSLOG_PRIORITY=y
|
||||
CONFIG_SYSLOG_PROCESS_NAME=y
|
||||
CONFIG_SYSLOG_TIMESTAMP=y
|
||||
CONFIG_SYSTEM_CLE=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=32
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TIMER=y
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
CONFIG_USEC_PER_TICK=1000
|
||||
36
boards/arm/stm32c5/nucleo-c562re/configs/nsh/defconfig
Normal file
36
boards/arm/stm32c5/nucleo-c562re/configs/nsh/defconfig
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#
|
||||
# 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_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="nucleo-c562re"
|
||||
CONFIG_ARCH_BOARD_NUCLEO_C562RE=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32c5"
|
||||
CONFIG_ARCH_CHIP_STM32=y
|
||||
CONFIG_ARCH_CHIP_STM32C562RE=y
|
||||
CONFIG_ARCH_CHIP_STM32C5=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_BOARD_LOOPSPERMSEC=7200
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LINE_MAX=64
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=131072
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||
139
boards/arm/stm32c5/nucleo-c562re/include/board.h
Normal file
139
boards/arm/stm32c5/nucleo-c562re/include/board.h
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32c5/nucleo-c562re/include/board.h
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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_STM32C5_NUCLEO_C562RE_INCLUDE_BOARD_H
|
||||
#define __BOARDS_ARM_STM32C5_NUCLEO_C562RE_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
/* The NUCLEO-C562RE has a 24 MHz HSE crystal.
|
||||
*
|
||||
* System clock source : PSI (HSE)
|
||||
* SYSCLK : 144 MHz
|
||||
* HCLK : 144 MHz (SYSCLK / 1)
|
||||
* PCLK1 : 144 MHz (HCLK / 1)
|
||||
* PCLK2 : 144 MHz (HCLK / 1)
|
||||
* PCLK3 : 144 MHz (HCLK / 1)
|
||||
* FLASH latency : 4 wait states
|
||||
* FLASH write delay : 2
|
||||
*/
|
||||
|
||||
#define STM32_BOARD_XTAL 24000000ul
|
||||
#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL
|
||||
#define STM32_LSE_FREQUENCY 32768ul
|
||||
#define STM32_LSI_FREQUENCY 32000ul
|
||||
|
||||
#define STM32_BOARD_USEHSE 1
|
||||
#define STM32_BOARD_USEPSI 1
|
||||
|
||||
#define STM32_RCC_CR2_PSIREFSRC RCC_CR2_PSIREFSRC_HSE
|
||||
#define STM32_RCC_CR2_PSIREF RCC_CR2_PSIREF_24MHZ
|
||||
#define STM32_RCC_CR2_PSIFREQ RCC_CR2_PSIFREQ_144MHZ
|
||||
|
||||
#define STM32_PSI_FREQUENCY 144000000ul
|
||||
#define STM32_SYSCLK_FREQUENCY STM32_PSI_FREQUENCY
|
||||
|
||||
#define STM32_RCC_CFGR2_HPRE RCC_CFGR2_HPRE_SYSCLK
|
||||
#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
|
||||
|
||||
#define STM32_RCC_CFGR2_PPRE1 RCC_CFGR2_PPRE1_HCLK
|
||||
#define STM32_PCLK1_FREQUENCY STM32_HCLK_FREQUENCY
|
||||
|
||||
#define STM32_RCC_CFGR2_PPRE2 RCC_CFGR2_PPRE2_HCLK
|
||||
#define STM32_PCLK2_FREQUENCY STM32_HCLK_FREQUENCY
|
||||
|
||||
#define STM32_RCC_CFGR2_PPRE3 RCC_CFGR2_PPRE3_HCLK
|
||||
#define STM32_PCLK3_FREQUENCY STM32_HCLK_FREQUENCY
|
||||
|
||||
#define STM32_FLASH_ACR_LATENCY FLASH_ACR_LATENCY_4
|
||||
#define STM32_FLASH_ACR_WRHIGHFREQ FLASH_ACR_WRHIGHFREQ_2
|
||||
|
||||
#define STM32_TIM1_CLKIN STM32_PCLK2_FREQUENCY
|
||||
#define STM32_TIM2_CLKIN STM32_PCLK1_FREQUENCY
|
||||
#define STM32_TIM5_CLKIN STM32_PCLK1_FREQUENCY
|
||||
#define STM32_TIM6_CLKIN STM32_PCLK1_FREQUENCY
|
||||
#define STM32_TIM7_CLKIN STM32_PCLK1_FREQUENCY
|
||||
#define STM32_TIM8_CLKIN STM32_PCLK2_FREQUENCY
|
||||
#define STM32_TIM12_CLKIN STM32_PCLK1_FREQUENCY
|
||||
#define STM32_TIM15_CLKIN STM32_PCLK2_FREQUENCY
|
||||
#define STM32_TIM16_CLKIN STM32_PCLK2_FREQUENCY
|
||||
#define STM32_TIM17_CLKIN STM32_PCLK2_FREQUENCY
|
||||
|
||||
/* USART2 is connected to the ST-LINK virtual COM port. */
|
||||
|
||||
#define GPIO_USART2_RX GPIO_USART2_RX_1
|
||||
#define GPIO_USART2_TX GPIO_USART2_TX_1
|
||||
|
||||
/* User LEDs */
|
||||
|
||||
#define BOARD_LED_GREEN 0
|
||||
#define BOARD_NLEDS 1
|
||||
|
||||
#define BOARD_LED_GREEN_BIT (1 << BOARD_LED_GREEN)
|
||||
|
||||
/* NuttX LED state mapping. LD1 is active high. */
|
||||
|
||||
#define LED_STARTED 0
|
||||
#define LED_HEAPALLOCATE 0
|
||||
#define LED_IRQSENABLED 0
|
||||
#define LED_STACKCREATED 1
|
||||
#define LED_INIRQ 2
|
||||
#define LED_SIGNAL 2
|
||||
#define LED_ASSERTION 2
|
||||
#define LED_PANIC 1
|
||||
#define LED_IDLE 0
|
||||
|
||||
/* User button B1 is active high. */
|
||||
|
||||
#define BUTTON_USER 0
|
||||
#define NUM_BUTTONS 1
|
||||
#define BUTTON_USER_BIT (1 << BUTTON_USER)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void stm32_board_initialize(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_STM32C5_NUCLEO_C562RE_INCLUDE_BOARD_H */
|
||||
36
boards/arm/stm32c5/nucleo-c562re/scripts/Make.defs
Normal file
36
boards/arm/stm32c5/nucleo-c562re/scripts/Make.defs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
############################################################################
|
||||
# boards/arm/stm32c5/nucleo-c562re/scripts/Make.defs
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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
|
||||
|
||||
ARCHSCRIPT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.ld
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
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
|
||||
107
boards/arm/stm32c5/nucleo-c562re/scripts/flash.ld
Normal file
107
boards/arm/stm32c5/nucleo-c562re/scripts/flash.ld
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32c5/nucleo-c562re/scripts/flash.ld
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
}
|
||||
|
||||
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(.);
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)
|
||||
SORT_BY_INIT_PRIORITY(.ctors.*)))
|
||||
KEEP(*(.init_array
|
||||
EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o)
|
||||
.ctors))
|
||||
_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(8);
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
.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) }
|
||||
}
|
||||
37
boards/arm/stm32c5/nucleo-c562re/src/CMakeLists.txt
Normal file
37
boards/arm/stm32c5/nucleo-c562re/src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# ##############################################################################
|
||||
# boards/arm/stm32c5/nucleo-c562re/src/CMakeLists.txt
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
set(SRCS stm32_boot.c stm32_bringup.c)
|
||||
|
||||
if(CONFIG_ARCH_LEDS)
|
||||
list(APPEND SRCS stm32_autoleds.c)
|
||||
else()
|
||||
list(APPEND SRCS stm32_userleds.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_BUTTONS)
|
||||
list(APPEND SRCS stm32_buttons.c)
|
||||
endif()
|
||||
|
||||
target_sources(board PRIVATE ${SRCS})
|
||||
|
||||
set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld")
|
||||
40
boards/arm/stm32c5/nucleo-c562re/src/Make.defs
Normal file
40
boards/arm/stm32c5/nucleo-c562re/src/Make.defs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
############################################################################
|
||||
# boards/arm/stm32c5/nucleo-c562re/src/Make.defs
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
||||
62
boards/arm/stm32c5/nucleo-c562re/src/nucleo-c562re.h
Normal file
62
boards/arm/stm32c5/nucleo-c562re/src/nucleo-c562re.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32c5/nucleo-c562re/src/nucleo-c562re.h
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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_STM32C5_NUCLEO_C562RE_SRC_NUCLEO_C562RE_H
|
||||
#define __BOARDS_ARM_STM32C5_NUCLEO_C562RE_SRC_NUCLEO_C562RE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* NUCLEO-C562RE GPIOs ******************************************************/
|
||||
|
||||
/* LD1 is connected to PA5 and is active high. */
|
||||
|
||||
#define GPIO_LD1 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHZ | \
|
||||
GPIO_OUTPUT_CLEAR | GPIO_PORTA | GPIO_PIN5)
|
||||
|
||||
/* B1 USER is connected to PC13 and is active high. */
|
||||
|
||||
#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 Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void);
|
||||
|
||||
#endif /* __BOARDS_ARM_STM32C5_NUCLEO_C562RE_SRC_NUCLEO_C562RE_H */
|
||||
61
boards/arm/stm32c5/nucleo-c562re/src/stm32_autoleds.c
Normal file
61
boards/arm/stm32c5/nucleo-c562re/src/stm32_autoleds.c
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32c5/nucleo-c562re/src/stm32_autoleds.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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 <nuttx/board.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
#include "nucleo-c562re.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
stm32_configgpio(GPIO_LD1);
|
||||
}
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
if (led == LED_STACKCREATED || led == LED_PANIC)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LD1, true);
|
||||
}
|
||||
}
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
if (led == LED_PANIC)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LD1, false);
|
||||
}
|
||||
}
|
||||
47
boards/arm/stm32c5/nucleo-c562re/src/stm32_boot.c
Normal file
47
boards/arm/stm32c5/nucleo-c562re/src/stm32_boot.c
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32c5/nucleo-c562re/src/stm32_boot.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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 <nuttx/board.h>
|
||||
|
||||
#include "nucleo-c562re.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void stm32_board_initialize(void)
|
||||
{
|
||||
board_autoled_initialize();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
void board_late_initialize(void)
|
||||
{
|
||||
stm32_bringup();
|
||||
}
|
||||
#endif
|
||||
63
boards/arm/stm32c5/nucleo-c562re/src/stm32_bringup.c
Normal file
63
boards/arm/stm32c5/nucleo-c562re/src/stm32_bringup.c
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32c5/nucleo-c562re/src/stm32_bringup.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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 <nuttx/debug.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/input/buttons.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INPUT_BUTTONS
|
||||
/* Register the BUTTON lower-half driver. */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
78
boards/arm/stm32c5/nucleo-c562re/src/stm32_buttons.c
Normal file
78
boards/arm/stm32c5/nucleo-c562re/src/stm32_buttons.c
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32c5/nucleo-c562re/src/stm32_buttons.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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/board.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
#include "nucleo-c562re.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_button_initialize(void)
|
||||
{
|
||||
stm32_configgpio(GPIO_BTN_USER);
|
||||
return NUM_BUTTONS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return stm32_gpioread(GPIO_BTN_USER) ? BUTTON_USER_BIT : 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_irq
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
int board_button_irq(int id, xcpt_t irqhandler, void *arg)
|
||||
{
|
||||
if (id != BUTTON_USER)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
#endif
|
||||
76
boards/arm/stm32c5/nucleo-c562re/src/stm32_userleds.c
Normal file
76
boards/arm/stm32c5/nucleo-c562re/src/stm32_userleds.c
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32c5/nucleo-c562re/src/stm32_userleds.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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 <nuttx/board.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
#include "nucleo-c562re.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the user LED GPIO when automatic architecture LED support is
|
||||
* disabled.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_userled_initialize(void)
|
||||
{
|
||||
stm32_configgpio(GPIO_LD1);
|
||||
return BOARD_NLEDS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if (led == BOARD_LED_GREEN)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LD1, ledon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint32_t ledset)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LD1, (ledset & BOARD_LED_GREEN_BIT) != 0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue