From 09e4bb45e4bf1f7cde40323d950059f4b7af7d22 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Sat, 30 May 2026 18:15:27 +0200 Subject: [PATCH] !arch/stm32: unify and commonize stm32_uid for all STM32 families. Replace the per-family stm32_get_uniqueid() implementations and the two IP-versioned common variants with a single generic byte-array reader, arch/arm/src/common/stm32/stm32_uid.c. BREAKING CHANGE for STM32 M0 families: stm32_get_uniqueid() now always takes a uint8_t[12] buffer. Out-of-tree Cortex-M0 code that used the previous prototype "void stm32_get_uniqueid(uint32_t *uid)" must change its buffer to "uint8_t uniqueid[12]". Signed-off-by: raiden00pl --- arch/arm/src/common/stm32/CMakeLists.txt | 9 +-- arch/arm/src/common/stm32/Kconfig.have | 8 --- arch/arm/src/common/stm32/Make.defs | 7 +- .../src/{stm32f7 => common/stm32}/stm32_uid.c | 7 +- arch/arm/src/common/stm32/stm32_uid.h | 8 +-- arch/arm/src/common/stm32/stm32_uid_m0_v1.c | 47 ------------- .../src/common/stm32/stm32_uid_m3m4_v1v2.c | 62 ----------------- arch/arm/src/stm32c0/Kconfig | 1 - arch/arm/src/stm32f0/Kconfig | 1 - arch/arm/src/stm32f1/Kconfig | 1 - arch/arm/src/stm32f2/Kconfig | 1 - arch/arm/src/stm32f3/Kconfig | 3 - arch/arm/src/stm32f4/Kconfig | 1 - arch/arm/src/stm32f7/CMakeLists.txt | 3 +- arch/arm/src/stm32f7/Make.defs | 2 +- arch/arm/src/stm32f7/stm32_uid.h | 52 --------------- arch/arm/src/stm32g0/Kconfig | 1 - arch/arm/src/stm32g4/Kconfig | 1 - arch/arm/src/stm32h5/CMakeLists.txt | 5 +- arch/arm/src/stm32h5/Make.defs | 2 +- arch/arm/src/stm32h5/stm32_uid.c | 66 ------------------- arch/arm/src/stm32h5/stm32_uid.h | 53 --------------- arch/arm/src/stm32h7/CMakeLists.txt | 5 +- arch/arm/src/stm32h7/Make.defs | 2 +- arch/arm/src/stm32h7/stm32_uid.c | 64 ------------------ arch/arm/src/stm32h7/stm32_uid.h | 53 --------------- arch/arm/src/stm32l0/Kconfig | 1 - arch/arm/src/stm32l1/Kconfig | 1 - arch/arm/src/stm32l4/CMakeLists.txt | 1 - arch/arm/src/stm32l4/Make.defs | 2 +- arch/arm/src/stm32l4/stm32l4_uid.c | 63 ------------------ arch/arm/src/stm32l4/stm32l4_uid.h | 53 --------------- arch/arm/src/stm32l5/CMakeLists.txt | 1 - arch/arm/src/stm32l5/Make.defs | 2 +- arch/arm/src/stm32l5/stm32l5_uid.h | 38 ----------- arch/arm/src/stm32u5/CMakeLists.txt | 1 - arch/arm/src/stm32u5/Make.defs | 2 +- arch/arm/src/stm32u5/stm32_uid.c | 48 -------------- arch/arm/src/stm32u5/stm32_uid.h | 38 ----------- arch/arm/src/stm32wb/CMakeLists.txt | 3 +- arch/arm/src/stm32wb/Make.defs | 2 +- arch/arm/src/stm32wb/stm32wb_uid.h | 38 ----------- arch/arm/src/stm32wl5/CMakeLists.txt | 1 - arch/arm/src/stm32wl5/Make.defs | 2 +- arch/arm/src/stm32wl5/stm32wl5_uid.h | 53 --------------- .../arm/stm32l4/nucleo-l432kc/src/stm32_uid.c | 2 +- .../arm/stm32l4/nucleo-l476rg/src/stm32_uid.c | 2 +- .../arm/stm32l4/nucleo-l496zg/src/stm32_uid.c | 2 +- .../stm32l4/stm32l476-mdk/src/stm32_boot.c | 2 +- .../stm32l476vg-disco/src/stm32_bringup.c | 2 +- .../stm32l4/stm32l476vg-disco/src/stm32_uid.c | 2 +- .../stm32l4r9ai-disco/src/stm32_bringup.c | 2 +- .../stm32l4/stm32l4r9ai-disco/src/stm32_uid.c | 2 +- 53 files changed, 33 insertions(+), 798 deletions(-) rename arch/arm/src/{stm32f7 => common/stm32}/stm32_uid.c (95%) delete mode 100644 arch/arm/src/common/stm32/stm32_uid_m0_v1.c delete mode 100644 arch/arm/src/common/stm32/stm32_uid_m3m4_v1v2.c delete mode 100644 arch/arm/src/stm32f7/stm32_uid.h delete mode 100644 arch/arm/src/stm32h5/stm32_uid.c delete mode 100644 arch/arm/src/stm32h5/stm32_uid.h delete mode 100644 arch/arm/src/stm32h7/stm32_uid.c delete mode 100644 arch/arm/src/stm32h7/stm32_uid.h delete mode 100644 arch/arm/src/stm32l4/stm32l4_uid.c delete mode 100644 arch/arm/src/stm32l4/stm32l4_uid.h delete mode 100644 arch/arm/src/stm32l5/stm32l5_uid.h delete mode 100644 arch/arm/src/stm32u5/stm32_uid.c delete mode 100644 arch/arm/src/stm32u5/stm32_uid.h delete mode 100644 arch/arm/src/stm32wb/stm32wb_uid.h delete mode 100644 arch/arm/src/stm32wl5/stm32wl5_uid.h diff --git a/arch/arm/src/common/stm32/CMakeLists.txt b/arch/arm/src/common/stm32/CMakeLists.txt index a46ebc57005..5499cbcf4b9 100644 --- a/arch/arm/src/common/stm32/CMakeLists.txt +++ b/arch/arm/src/common/stm32/CMakeLists.txt @@ -32,6 +32,7 @@ set(SRCS) # Architecture-neutral sources used by every STM32 family list(APPEND SRCS stm32_waste.c) +list(APPEND SRCS stm32_uid.c) if(CONFIG_STM32_COMMON_LEGACY) list( @@ -75,10 +76,6 @@ if(CONFIG_STM32_COMMON_LEGACY) list(APPEND SRCS stm32_ccm_m3m4_v1.c) endif() - if(CONFIG_STM32_HAVE_IP_UID_M3M4_V1) - list(APPEND SRCS stm32_uid_m3m4_v1v2.c) - endif() - if(CONFIG_STM32_HAVE_IP_DFUMODE_M3M4_V1) list(APPEND SRCS stm32_dfumode_m3m4_v1.c) endif() @@ -369,10 +366,6 @@ if(CONFIG_ARCH_CORTEXM0) list(APPEND SRCS stm32_exti_gpio_m0_v1.c) endif() - if(CONFIG_STM32_HAVE_IP_UID_M0_V1) - list(APPEND SRCS stm32_uid_m0_v1.c) - endif() - if(CONFIG_STM32_HAVE_IP_USART_V3) list(APPEND SRCS stm32_lowputc_usart_m0_v3.c stm32_serial_m0_v3.c) elseif(CONFIG_STM32_HAVE_IP_USART_V4) diff --git a/arch/arm/src/common/stm32/Kconfig.have b/arch/arm/src/common/stm32/Kconfig.have index 2772bd7cd82..d6cd3b31e07 100644 --- a/arch/arm/src/common/stm32/Kconfig.have +++ b/arch/arm/src/common/stm32/Kconfig.have @@ -1114,14 +1114,6 @@ config STM32_HAVE_UART12 config STM32_HAVE_USART1 bool -# UID capabilities - -config STM32_HAVE_IP_UID_M0_V1 - bool - -config STM32_HAVE_IP_UID_M3M4_V1 - bool - # USB capabilities config STM32_HAVE_USBFS_MODE diff --git a/arch/arm/src/common/stm32/Make.defs b/arch/arm/src/common/stm32/Make.defs index 2939660ae8a..ffb46e0a089 100644 --- a/arch/arm/src/common/stm32/Make.defs +++ b/arch/arm/src/common/stm32/Make.defs @@ -40,6 +40,7 @@ ARCHXXINCLUDES += ${INCDIR_PREFIX}$(STM32_COMMON_SRCDIR) # Architecture-neutral sources used by every STM32 family CHIP_CSRCS += stm32_waste.c +CHIP_CSRCS += stm32_uid.c ifeq ($(CONFIG_STM32_COMMON_LEGACY),y) @@ -88,9 +89,6 @@ endif ifeq ($(CONFIG_STM32_HAVE_IP_CCM_M3M4_V1),y) CHIP_CSRCS += stm32_ccm_m3m4_v1.c endif -ifeq ($(CONFIG_STM32_HAVE_IP_UID_M3M4_V1),y) -CHIP_CSRCS += stm32_uid_m3m4_v1v2.c -endif CHIP_CSRCS += stm32_capture_m3m4_v1.c ifeq ($(CONFIG_STM32_HAVE_IP_DFUMODE_M3M4_V1),y) CHIP_CSRCS += stm32_dfumode_m3m4_v1.c @@ -422,9 +420,6 @@ CHIP_CSRCS += stm32_serial_m0_v3.c else ifeq ($(CONFIG_STM32_HAVE_IP_USART_V4),y) CHIP_CSRCS += stm32_serial_m0_v4.c endif -ifeq ($(CONFIG_STM32_HAVE_IP_UID_M0_V1),y) -CHIP_CSRCS += stm32_uid_m0_v1.c -endif ifneq ($(CONFIG_STM32_RTC_LSECLOCK)$(CONFIG_LCD_LSECLOCK),) CHIP_CSRCS += stm32_lse_m0_v1.c diff --git a/arch/arm/src/stm32f7/stm32_uid.c b/arch/arm/src/common/stm32/stm32_uid.c similarity index 95% rename from arch/arm/src/stm32f7/stm32_uid.c rename to arch/arm/src/common/stm32/stm32_uid.c index e1f64404cd8..190f38b975f 100644 --- a/arch/arm/src/stm32f7/stm32_uid.c +++ b/arch/arm/src/common/stm32/stm32_uid.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32f7/stm32_uid.c + * arch/arm/src/common/stm32/stm32_uid.c * * SPDX-License-Identifier: BSD-3-Clause * SPDX-FileCopyrightText: 2015 Marawan Ragab. All rights reserved. @@ -40,11 +40,10 @@ #include -#include "hardware/stm32_memorymap.h" - +#include "chip.h" #include "stm32_uid.h" -#ifdef STM32_SYSMEM_UID +#ifdef STM32_SYSMEM_UID /* Not defined for some STM32 parts */ /**************************************************************************** * Public Functions diff --git a/arch/arm/src/common/stm32/stm32_uid.h b/arch/arm/src/common/stm32/stm32_uid.h index e925374353e..7bf3119bbcb 100644 --- a/arch/arm/src/common/stm32/stm32_uid.h +++ b/arch/arm/src/common/stm32/stm32_uid.h @@ -35,10 +35,10 @@ * Public Function Prototypes ****************************************************************************/ -#if defined(CONFIG_STM32_HAVE_IP_UID_M0_V1) -void stm32_get_uniqueid(uint32_t *uid); -#elif defined(CONFIG_STM32_HAVE_IP_UID_M3M4_V1) +/* Read the 96-bit STM32 unique device ID into a 12-byte buffer. This + * interface is common to all STM32 families. + */ + void stm32_get_uniqueid(uint8_t uniqueid[12]); -#endif #endif /* __ARCH_ARM_SRC_COMMON_COMPAT_STM32_UID_H */ diff --git a/arch/arm/src/common/stm32/stm32_uid_m0_v1.c b/arch/arm/src/common/stm32/stm32_uid_m0_v1.c deleted file mode 100644 index 9f9be6610a7..00000000000 --- a/arch/arm/src/common/stm32/stm32_uid_m0_v1.c +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - * arch/arm/src/common/stm32/stm32_uid_m0_v1.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 - -#include "hardware/stm32_memorymap.h" - -#include "stm32_uid.h" - -#ifdef STM32_SYSMEM_UID - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void stm32_get_uniqueid(uint32_t *uid) -{ - int i; - - for (i = 0; i < 3; i++) - { - *(uid + i) = *((uint32_t *)(STM32_SYSMEM_UID) + i); - } -} - -#endif /* STM32_SYSMEM_UID */ diff --git a/arch/arm/src/common/stm32/stm32_uid_m3m4_v1v2.c b/arch/arm/src/common/stm32/stm32_uid_m3m4_v1v2.c deleted file mode 100644 index 9986db93d7c..00000000000 --- a/arch/arm/src/common/stm32/stm32_uid_m3m4_v1v2.c +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** - * arch/arm/src/common/stm32/stm32_uid_m3m4_v1v2.c - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2015 Marawan Ragab. All rights reserved. - * SPDX-FileContributor: Marawan Ragab - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include "hardware/stm32_memorymap.h" -#include "stm32_uid.h" - -#ifdef STM32_SYSMEM_UID /* Not defined for the STM32L */ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]) -{ - int i; - - for (i = 0; i < 12; i++) - { - uniqueid[i] = *((uint8_t *)(STM32_SYSMEM_UID) + i); - } -} - -#endif /* STM32_SYSMEM_UID */ diff --git a/arch/arm/src/stm32c0/Kconfig b/arch/arm/src/stm32c0/Kconfig index a2c0962ad1c..6d3363b20d0 100644 --- a/arch/arm/src/stm32c0/Kconfig +++ b/arch/arm/src/stm32c0/Kconfig @@ -252,7 +252,6 @@ config STM32_STM32C0 select STM32_HAVE_IP_TIMERS_M0_V1 select STM32_HAVE_IP_USART_V4 select STM32_HAVE_IP_WDG_M0_V1 - select STM32_HAVE_IP_UID_M0_V1 select STM32_HAVE_IP_USBDEV_M0_V1 if STM32_HAVE_USBDEV select STM32_HAVE_TIM1 select STM32_HAVE_TIM2 diff --git a/arch/arm/src/stm32f0/Kconfig b/arch/arm/src/stm32f0/Kconfig index f25a1017f3f..f795312fc02 100644 --- a/arch/arm/src/stm32f0/Kconfig +++ b/arch/arm/src/stm32f0/Kconfig @@ -495,7 +495,6 @@ config STM32_STM32F0 select STM32_HAVE_IP_TIMERS_M0_V1 select STM32_HAVE_IP_USART_V3 select STM32_HAVE_IP_WDG_M0_V1 - select STM32_HAVE_IP_UID_M0_V1 select STM32_HAVE_IP_USBDEV_M0_V1 if STM32_HAVE_USBDEV select STM32_HAVE_IP_HSI48_M0_V1 if STM32_HAVE_HSI48 diff --git a/arch/arm/src/stm32f1/Kconfig b/arch/arm/src/stm32f1/Kconfig index a14872ed7c7..8841965cdf3 100644 --- a/arch/arm/src/stm32f1/Kconfig +++ b/arch/arm/src/stm32f1/Kconfig @@ -338,7 +338,6 @@ config STM32_STM32F10XX select STM32_HAVE_IP_SPI_V1 select STM32_HAVE_IP_SYSCFG_M3M4_V1 select STM32_HAVE_IP_TIMERS_M3M4_V1 - select STM32_HAVE_IP_UID_M3M4_V1 select STM32_HAVE_IP_USART_V1 select STM32_HAVE_IP_USBDEV_M3M4_V1 if STM32_HAVE_USBDEV select STM32_HAVE_IP_USBFS_M3M4_V1 if STM32_HAVE_USBFS diff --git a/arch/arm/src/stm32f2/Kconfig b/arch/arm/src/stm32f2/Kconfig index a93ae1f0118..4acec531bd6 100644 --- a/arch/arm/src/stm32f2/Kconfig +++ b/arch/arm/src/stm32f2/Kconfig @@ -167,7 +167,6 @@ config STM32_STM32F20XX select STM32_HAVE_IP_SPI_V2 select STM32_HAVE_IP_SYSCFG_M3M4_V1 select STM32_HAVE_IP_TIMERS_M3M4_V1 - select STM32_HAVE_IP_UID_M3M4_V1 select STM32_HAVE_IP_USART_V2 select STM32_HAVE_IP_USBDEV_M3M4_V1 if STM32_HAVE_USBDEV select STM32_HAVE_IP_USBFS_M3M4_V1 if STM32_HAVE_USBFS diff --git a/arch/arm/src/stm32f3/Kconfig b/arch/arm/src/stm32f3/Kconfig index 428efe6c9c5..f58b8ea18ff 100644 --- a/arch/arm/src/stm32f3/Kconfig +++ b/arch/arm/src/stm32f3/Kconfig @@ -449,7 +449,6 @@ config STM32_STM32F30XX select STM32_HAVE_IP_SPI_V3 select STM32_HAVE_IP_SYSCFG_M3M4_V1 select STM32_HAVE_IP_TIMERS_M3M4_V2 - select STM32_HAVE_IP_UID_M3M4_V1 select STM32_HAVE_IP_USART_V3 select STM32_HAVE_IP_USBDEV_M3M4_V1 if STM32_HAVE_USBDEV select STM32_HAVE_IP_USBFS_M3M4_V1 if STM32_HAVE_USBFS @@ -543,7 +542,6 @@ config STM32_STM32F33XX select STM32_HAVE_IP_SPI_V3 select STM32_HAVE_IP_SYSCFG_M3M4_V1 select STM32_HAVE_IP_TIMERS_M3M4_V2 - select STM32_HAVE_IP_UID_M3M4_V1 select STM32_HAVE_IP_USART_V3 select STM32_HAVE_IP_USBDEV_M3M4_V1 if STM32_HAVE_USBDEV select STM32_HAVE_IP_USBFS_M3M4_V1 if STM32_HAVE_USBFS @@ -618,7 +616,6 @@ config STM32_STM32F37XX select STM32_HAVE_IP_SDIO_M3M4_V1 select STM32_HAVE_IP_SPI_V3 select STM32_HAVE_IP_SYSCFG_M3M4_V1 - select STM32_HAVE_IP_UID_M3M4_V1 select STM32_HAVE_IP_USART_V3 select STM32_HAVE_IP_USBDEV_M3M4_V1 if STM32_HAVE_USBDEV select STM32_HAVE_IP_USBFS_M3M4_V1 if STM32_HAVE_USBFS diff --git a/arch/arm/src/stm32f4/Kconfig b/arch/arm/src/stm32f4/Kconfig index ec97a0a6139..6d98f0577ac 100644 --- a/arch/arm/src/stm32f4/Kconfig +++ b/arch/arm/src/stm32f4/Kconfig @@ -282,7 +282,6 @@ config STM32_STM32F4XXX select STM32_HAVE_IP_SPI_V2 select STM32_HAVE_IP_SYSCFG_M3M4_V1 select STM32_HAVE_IP_TIMERS_M3M4_V1 - select STM32_HAVE_IP_UID_M3M4_V1 select STM32_HAVE_IP_USART_V2 select STM32_HAVE_IP_USBDEV_M3M4_V1 if STM32_HAVE_USBDEV select STM32_HAVE_IP_USBFS_M3M4_V1 if STM32_HAVE_USBFS diff --git a/arch/arm/src/stm32f7/CMakeLists.txt b/arch/arm/src/stm32f7/CMakeLists.txt index 65bec6f53ff..92f1356a9cf 100644 --- a/arch/arm/src/stm32f7/CMakeLists.txt +++ b/arch/arm/src/stm32f7/CMakeLists.txt @@ -33,8 +33,7 @@ list( stm32_rcc.c stm32_serial.c stm32_start.c - stm32_capture.c - stm32_uid.c) + stm32_capture.c) if(CONFIG_STM32_TICKLESS_TIMER) list(APPEND SRCS stm32_tickless.c) diff --git a/arch/arm/src/stm32f7/Make.defs b/arch/arm/src/stm32f7/Make.defs index 816b0e859e4..32026d5e54a 100644 --- a/arch/arm/src/stm32f7/Make.defs +++ b/arch/arm/src/stm32f7/Make.defs @@ -32,7 +32,7 @@ include common/stm32/Make.defs CHIP_CSRCS += stm32_allocateheap.c stm32_exti_gpio.c stm32_gpio.c CHIP_CSRCS += stm32_irq.c stm32_lowputc.c stm32_rcc.c stm32_serial.c -CHIP_CSRCS += stm32_start.c stm32_capture.c stm32_uid.c +CHIP_CSRCS += stm32_start.c stm32_capture.c ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += stm32_timerisr.c diff --git a/arch/arm/src/stm32f7/stm32_uid.h b/arch/arm/src/stm32f7/stm32_uid.h deleted file mode 100644 index 8e92f0219a7..00000000000 --- a/arch/arm/src/stm32f7/stm32_uid.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32f7/stm32_uid.h - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2015 Marawan Ragab. All rights reserved. - * SPDX-FileContributor: Marawan Ragab - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __ARCH_ARM_SRC_STM32F7_STM32_UID_H -#define __ARCH_ARM_SRC_STM32F7_STM32_UID_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]); - -#endif /* __ARCH_ARM_SRC_STM32F7_STM32_UID_H */ diff --git a/arch/arm/src/stm32g0/Kconfig b/arch/arm/src/stm32g0/Kconfig index de97aaf4f30..56f67d39f80 100644 --- a/arch/arm/src/stm32g0/Kconfig +++ b/arch/arm/src/stm32g0/Kconfig @@ -240,7 +240,6 @@ config STM32_STM32G0 select STM32_HAVE_IP_TIMERS_M0_V1 select STM32_HAVE_IP_USART_V4 select STM32_HAVE_IP_WDG_M0_V1 - select STM32_HAVE_IP_UID_M0_V1 select STM32_HAVE_IP_USBDEV_M0_V1 if STM32_HAVE_USBDEV select STM32_HAVE_TIM1 select STM32_HAVE_TIM3 diff --git a/arch/arm/src/stm32g4/Kconfig b/arch/arm/src/stm32g4/Kconfig index a151b4a4877..4638529bf1e 100644 --- a/arch/arm/src/stm32g4/Kconfig +++ b/arch/arm/src/stm32g4/Kconfig @@ -131,7 +131,6 @@ config STM32_STM32G4XXX select STM32_HAVE_IP_SPI_V3 select STM32_HAVE_IP_SYSCFG_M3M4_V1 select STM32_HAVE_IP_TIMERS_M3M4_V3 - select STM32_HAVE_IP_UID_M3M4_V1 select STM32_HAVE_IP_USART_V4 select STM32_HAVE_IP_USBDEV_M3M4_V1 if STM32_HAVE_USBDEV select STM32_HAVE_IP_USBFS_M3M4_V1 if STM32_HAVE_USBFS diff --git a/arch/arm/src/stm32h5/CMakeLists.txt b/arch/arm/src/stm32h5/CMakeLists.txt index 854b2189968..f413964d7b8 100644 --- a/arch/arm/src/stm32h5/CMakeLists.txt +++ b/arch/arm/src/stm32h5/CMakeLists.txt @@ -41,8 +41,7 @@ list( stm32_pwr.c stm32_timerisr.c stm32_lse.c - stm32_lsi.c - stm32_uid.c) + stm32_lsi.c) if(CONFIG_STM32_USART) list(APPEND SRCS stm32_serial.c) @@ -127,3 +126,5 @@ if(CONFIG_STM32_STM32H5XXXX) endif() target_sources(arch PRIVATE ${SRCS}) + +add_subdirectory(${NUTTX_DIR}/arch/arm/src/common/stm32 stm32_common) diff --git a/arch/arm/src/stm32h5/Make.defs b/arch/arm/src/stm32h5/Make.defs index 2b6cb685043..ec8db4beccf 100644 --- a/arch/arm/src/stm32h5/Make.defs +++ b/arch/arm/src/stm32h5/Make.defs @@ -28,6 +28,7 @@ HEAD_ASRC = # Common ARM and Cortex-M33 files include armv8-m/Make.defs +include common/stm32/Make.defs ifeq ($(CONFIG_STM32_PROGMEM),y) CHIP_CSRCS += stm32_flash.c @@ -38,7 +39,6 @@ endif CHIP_CSRCS += stm32_gpio.c stm32_irq.c stm32_lowputc.c stm32_rcc.c CHIP_CSRCS += stm32_start.c stm32_pwr.c stm32_timerisr.c CHIP_CSRCS += stm32_lse.c stm32_lsi.c -CHIP_CSRCS += stm32_uid.c ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y) CHIP_CSRCS += stm32_idle.c diff --git a/arch/arm/src/stm32h5/stm32_uid.c b/arch/arm/src/stm32h5/stm32_uid.c deleted file mode 100644 index bda001d2760..00000000000 --- a/arch/arm/src/stm32h5/stm32_uid.c +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32h5/stm32_uid.c - * - * Copyright (C) 2015 Marawan Ragab. All rights reserved. - * Authors: Marawan Ragab - * David Sidrane - * Modified for STM32H5 by Tyler Bennett - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include "hardware/stm32_memorymap.h" - -#include "stm32_uid.h" - -#ifdef STM32_SYSMEM_UID - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]) -{ - int i; - uint32_t *uid = (uint32_t *) uniqueid; - - for (i = 0; i < 3; i++) - { - *uid = *((uint32_t *)(STM32_SYSMEM_UID) + i); - uid++; - } -} - -#endif /* STM32_SYSMEM_UID */ diff --git a/arch/arm/src/stm32h5/stm32_uid.h b/arch/arm/src/stm32h5/stm32_uid.h deleted file mode 100644 index d63e07e6c90..00000000000 --- a/arch/arm/src/stm32h5/stm32_uid.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32h5/stm32_uid.h - * - * Copyright (C) 2015 Marawan Ragab. All rights reserved. - * Authors: Marawan Ragab - * David Sidrane - * Modified for STM32H5 by Tyler Bennett - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __ARCH_ARM_SRC_STM32H5_STM32_UID_H -#define __ARCH_ARM_SRC_STM32H5_STM32_UID_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]); - -#endif /* __ARCH_ARM_SRC_STM32H5_STM32_UID_H */ \ No newline at end of file diff --git a/arch/arm/src/stm32h7/CMakeLists.txt b/arch/arm/src/stm32h7/CMakeLists.txt index b226502c093..5f6e1f9800f 100644 --- a/arch/arm/src/stm32h7/CMakeLists.txt +++ b/arch/arm/src/stm32h7/CMakeLists.txt @@ -32,8 +32,7 @@ list( stm32_start.c stm32_rcc.c stm32_lowputc.c - stm32_serial.c - stm32_uid.c) + stm32_serial.c) if(CONFIG_STM32_PROGMEM) list(APPEND SRCS stm32_flash.c) @@ -225,3 +224,5 @@ if(CONFIG_CRYPTO_CRYPTODEV_HARDWARE AND CONFIG_STM32_HAVE_IP_CRYPTO_H7) endif() target_sources(arch PRIVATE ${SRCS}) + +add_subdirectory(${NUTTX_DIR}/arch/arm/src/common/stm32 stm32_common) diff --git a/arch/arm/src/stm32h7/Make.defs b/arch/arm/src/stm32h7/Make.defs index e8fb7d38e3a..298f6da5b5c 100644 --- a/arch/arm/src/stm32h7/Make.defs +++ b/arch/arm/src/stm32h7/Make.defs @@ -26,6 +26,7 @@ # Common ARM and Cortex-M7 files include armv7-m/Make.defs +include common/stm32/Make.defs ifeq ($(CONFIG_STM32_PROGMEM),y) CHIP_CSRCS += stm32_flash.c @@ -47,7 +48,6 @@ endif CHIP_CSRCS += stm32_allocateheap.c stm32_exti_gpio.c stm32_gpio.c stm32_irq.c CHIP_CSRCS += stm32_start.c stm32_rcc.c stm32_lowputc.c stm32_serial.c -CHIP_CSRCS += stm32_uid.c ifeq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += stm32_tickless.c diff --git a/arch/arm/src/stm32h7/stm32_uid.c b/arch/arm/src/stm32h7/stm32_uid.c deleted file mode 100644 index a69edbe3898..00000000000 --- a/arch/arm/src/stm32h7/stm32_uid.c +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32h7/stm32_uid.c - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2015 Marawan Ragab. All rights reserved. - * SPDX-FileContributor: Marawan Ragab - * SPDX-FileContributor: David Sidrane - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include "hardware/stm32_memorymap.h" - -#include "stm32_uid.h" - -#ifdef STM32_SYSMEM_UID - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]) -{ - int i; - - for (i = 0; i < 12; i++) - { - uniqueid[i] = *((uint8_t *)(STM32_SYSMEM_UID) + i); - } -} - -#endif /* STM32_SYSMEM_UID */ diff --git a/arch/arm/src/stm32h7/stm32_uid.h b/arch/arm/src/stm32h7/stm32_uid.h deleted file mode 100644 index 4946a910bed..00000000000 --- a/arch/arm/src/stm32h7/stm32_uid.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32h7/stm32_uid.h - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2015 Marawan Ragab. All rights reserved. - * SPDX-FileContributor: Marawan Ragab - * SPDX-FileContributor: David Sidrane - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __ARCH_ARM_SRC_STM32H7_STM32_UID_H -#define __ARCH_ARM_SRC_STM32H7_STM32_UID_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]); - -#endif /* __ARCH_ARM_SRC_STM32H7_STM32_UID_H */ diff --git a/arch/arm/src/stm32l0/Kconfig b/arch/arm/src/stm32l0/Kconfig index 6d71aebe758..61cc82f7670 100644 --- a/arch/arm/src/stm32l0/Kconfig +++ b/arch/arm/src/stm32l0/Kconfig @@ -229,7 +229,6 @@ config STM32_STM32L0 select STM32_HAVE_IP_TIMERS_M0_V1 select STM32_HAVE_IP_USART_V3 select STM32_HAVE_IP_WDG_M0_V1 - select STM32_HAVE_IP_UID_M0_V1 select STM32_HAVE_IP_RNG_M0_V1 if STM32_HAVE_RNG select STM32_HAVE_IP_RTCC_M0_V1 select STM32_HAVE_IP_USBDEV_M0_V1 if STM32_HAVE_USBDEV diff --git a/arch/arm/src/stm32l1/Kconfig b/arch/arm/src/stm32l1/Kconfig index 129f60d8271..ca2b98efd04 100644 --- a/arch/arm/src/stm32l1/Kconfig +++ b/arch/arm/src/stm32l1/Kconfig @@ -296,7 +296,6 @@ config STM32_STM32L15XX select STM32_HAVE_IP_SPI_V1 select STM32_HAVE_IP_SYSCFG_M3M4_V1 select STM32_HAVE_IP_TIMERS_M3M4_V1 - select STM32_HAVE_IP_UID_M3M4_V1 select STM32_HAVE_IP_USART_V2 select STM32_HAVE_IP_USBDEV_M3M4_V1 if STM32_HAVE_USBDEV select STM32_HAVE_IP_USBFS_M3M4_V1 if STM32_HAVE_USBFS diff --git a/arch/arm/src/stm32l4/CMakeLists.txt b/arch/arm/src/stm32l4/CMakeLists.txt index 672fa1cf49b..9ea2ec8809a 100644 --- a/arch/arm/src/stm32l4/CMakeLists.txt +++ b/arch/arm/src/stm32l4/CMakeLists.txt @@ -33,7 +33,6 @@ list( stm32l4_rcc.c stm32l4_serial.c stm32l4_start.c - stm32l4_uid.c stm32l4_spi.c stm32l4_i2c.c stm32l4_lse.c diff --git a/arch/arm/src/stm32l4/Make.defs b/arch/arm/src/stm32l4/Make.defs index 05a5f419064..8149af37b75 100644 --- a/arch/arm/src/stm32l4/Make.defs +++ b/arch/arm/src/stm32l4/Make.defs @@ -32,7 +32,7 @@ include common/stm32/Make.defs CHIP_CSRCS += stm32l4_allocateheap.c stm32l4_exti_gpio.c stm32l4_gpio.c CHIP_CSRCS += stm32l4_irq.c stm32l4_lowputc.c stm32l4_rcc.c -CHIP_CSRCS += stm32l4_serial.c stm32l4_start.c stm32l4_uid.c +CHIP_CSRCS += stm32l4_serial.c stm32l4_start.c CHIP_CSRCS += stm32l4_spi.c stm32l4_i2c.c stm32l4_lse.c stm32l4_lsi.c CHIP_CSRCS += stm32l4_pwr.c stm32l4_tim.c stm32l4_flash.c CHIP_CSRCS += stm32l4_dfumode.c diff --git a/arch/arm/src/stm32l4/stm32l4_uid.c b/arch/arm/src/stm32l4/stm32l4_uid.c deleted file mode 100644 index df2b64233e4..00000000000 --- a/arch/arm/src/stm32l4/stm32l4_uid.c +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32l4/stm32l4_uid.c - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2015 Marawan Ragab. All rights reserved. - * SPDX-FileContributor: Marawan Ragab - * SPDX-FileContributor: dev@ziggurat9.com - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include "hardware/stm32l4_memorymap.h" -#include "stm32l4_uid.h" - -#ifdef STM32_SYSMEM_UID - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]) -{ - int i; - - for (i = 0; i < 12; i++) - { - uniqueid[i] = *((uint8_t *)(STM32_SYSMEM_UID)+i); - } -} - -#endif /* STM32_SYSMEM_UID */ diff --git a/arch/arm/src/stm32l4/stm32l4_uid.h b/arch/arm/src/stm32l4/stm32l4_uid.h deleted file mode 100644 index 239c83ed96f..00000000000 --- a/arch/arm/src/stm32l4/stm32l4_uid.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32l4/stm32l4_uid.h - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2015 Marawan Ragab. All rights reserved. - * SPDX-FileContributor: Marawan Ragab - * SPDX-FileContributor: dev@ziggurat9.com - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __ARCH_ARM_SRC_STM32L4_STM32L4_UID_H -#define __ARCH_ARM_SRC_STM32L4_STM32L4_UID_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]); - -#endif /* __ARCH_ARM_SRC_STM32L4_STM32L4_UID_H */ diff --git a/arch/arm/src/stm32l5/CMakeLists.txt b/arch/arm/src/stm32l5/CMakeLists.txt index 0e2a8694a92..cfd801d08ab 100644 --- a/arch/arm/src/stm32l5/CMakeLists.txt +++ b/arch/arm/src/stm32l5/CMakeLists.txt @@ -33,7 +33,6 @@ list( stm32l5_rcc.c stm32l5_serial.c stm32l5_start.c - stm32l5_uid.c stm32l5_spi.c stm32l5_lse.c stm32l5_lsi.c diff --git a/arch/arm/src/stm32l5/Make.defs b/arch/arm/src/stm32l5/Make.defs index 80d2655d84d..b01e736c4c8 100644 --- a/arch/arm/src/stm32l5/Make.defs +++ b/arch/arm/src/stm32l5/Make.defs @@ -35,7 +35,7 @@ include common/stm32/Make.defs CHIP_ASRCS = CHIP_CSRCS += stm32l5_allocateheap.c stm32l5_exti_gpio.c stm32l5_gpio.c CHIP_CSRCS += stm32l5_irq.c stm32l5_lowputc.c stm32l5_rcc.c -CHIP_CSRCS += stm32l5_serial.c stm32l5_start.c stm32l5_uid.c +CHIP_CSRCS += stm32l5_serial.c stm32l5_start.c CHIP_CSRCS += stm32l5_spi.c stm32l5_lse.c stm32l5_lsi.c CHIP_CSRCS += stm32l5_pwr.c stm32l5_tim.c stm32l5_flash.c stm32l5_timerisr.c diff --git a/arch/arm/src/stm32l5/stm32l5_uid.h b/arch/arm/src/stm32l5/stm32l5_uid.h deleted file mode 100644 index c71e4c43fd9..00000000000 --- a/arch/arm/src/stm32l5/stm32l5_uid.h +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32l5/stm32l5_uid.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 __ARCH_ARM_SRC_STM32L5_STM32L5_UID_H -#define __ARCH_ARM_SRC_STM32L5_STM32L5_UID_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]); - -#endif /* __ARCH_ARM_SRC_STM32L5_STM32L5_UID_H */ diff --git a/arch/arm/src/stm32u5/CMakeLists.txt b/arch/arm/src/stm32u5/CMakeLists.txt index 1fd0658ffbe..70f5a875c13 100644 --- a/arch/arm/src/stm32u5/CMakeLists.txt +++ b/arch/arm/src/stm32u5/CMakeLists.txt @@ -30,7 +30,6 @@ set(SRCS stm32_i2c.c stm32_serial.c stm32_start.c - stm32_uid.c stm32_spi.c stm32_lse.c stm32_lsi.c diff --git a/arch/arm/src/stm32u5/Make.defs b/arch/arm/src/stm32u5/Make.defs index de127a90476..a884bf0cbf3 100644 --- a/arch/arm/src/stm32u5/Make.defs +++ b/arch/arm/src/stm32u5/Make.defs @@ -35,7 +35,7 @@ include common/stm32/Make.defs CHIP_ASRCS = CHIP_CSRCS += stm32_allocateheap.c stm32_exti_gpio.c stm32_gpio.c CHIP_CSRCS += stm32_irq.c stm32_lowputc.c stm32_rcc.c stm32_i2c.c -CHIP_CSRCS += stm32_serial.c stm32_start.c stm32_uid.c +CHIP_CSRCS += stm32_serial.c stm32_start.c CHIP_CSRCS += stm32_spi.c stm32_lse.c stm32_lsi.c stm32u5xx_rcc.c CHIP_CSRCS += stm32_pwr.c stm32_tim.c stm32_flash.c stm32_timerisr.c diff --git a/arch/arm/src/stm32u5/stm32_uid.c b/arch/arm/src/stm32u5/stm32_uid.c deleted file mode 100644 index 479826dafd2..00000000000 --- a/arch/arm/src/stm32u5/stm32_uid.c +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32u5/stm32_uid.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 - -#include "hardware/stm32_memorymap.h" -#include "stm32_uid.h" - -#ifdef STM32_SYSMEM_UID - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]) -{ - int i; - - for (i = 0; i < 12; i++) - { - uniqueid[i] = *((uint8_t *)(STM32_SYSMEM_UID) + i); - } -} - -#endif /* STM32_SYSMEM_UID */ diff --git a/arch/arm/src/stm32u5/stm32_uid.h b/arch/arm/src/stm32u5/stm32_uid.h deleted file mode 100644 index f306f2759a9..00000000000 --- a/arch/arm/src/stm32u5/stm32_uid.h +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32u5/stm32_uid.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 __ARCH_ARM_SRC_STM32U5_STM32_UID_H -#define __ARCH_ARM_SRC_STM32U5_STM32_UID_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]); - -#endif /* __ARCH_ARM_SRC_STM32U5_STM32_UID_H */ diff --git a/arch/arm/src/stm32wb/CMakeLists.txt b/arch/arm/src/stm32wb/CMakeLists.txt index a4942012d1c..03f9157eed5 100644 --- a/arch/arm/src/stm32wb/CMakeLists.txt +++ b/arch/arm/src/stm32wb/CMakeLists.txt @@ -37,8 +37,7 @@ set(SRCS stm32wb_rcc_lsi.c stm32wb_pwr.c stm32wb_tim.c - stm32wb_flash.c - stm32wb_uid.c) + stm32wb_flash.c) if(NOT CONFIG_ARCH_IDLE_CUSTOM) list(APPEND SRCS stm32wb_idle.c) diff --git a/arch/arm/src/stm32wb/Make.defs b/arch/arm/src/stm32wb/Make.defs index 304e8bd6b36..5a4bdcdb88e 100644 --- a/arch/arm/src/stm32wb/Make.defs +++ b/arch/arm/src/stm32wb/Make.defs @@ -35,7 +35,7 @@ CHIP_CSRCS += stm32wb_irq.c stm32wb_lowputc.c stm32wb_rcc.c stm32wb_spi.c CHIP_CSRCS += stm32wb_serial.c stm32wb_i2c.c stm32wb_start.c CHIP_CSRCS += stm32wb_rcc_lse.c stm32wb_rcc_lsi.c CHIP_CSRCS += stm32wb_pwr.c stm32wb_tim.c -CHIP_CSRCS += stm32wb_flash.c stm32wb_uid.c +CHIP_CSRCS += stm32wb_flash.c ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y) CHIP_CSRCS += stm32wb_idle.c diff --git a/arch/arm/src/stm32wb/stm32wb_uid.h b/arch/arm/src/stm32wb/stm32wb_uid.h deleted file mode 100644 index 8b95f7d1f68..00000000000 --- a/arch/arm/src/stm32wb/stm32wb_uid.h +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32wb/stm32wb_uid.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 __ARCH_ARM_SRC_STM32WB_STM32WB_UID_H -#define __ARCH_ARM_SRC_STM32WB_STM32WB_UID_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]); - -#endif /* __ARCH_ARM_SRC_STM32WB_STM32WB_UID_H */ diff --git a/arch/arm/src/stm32wl5/CMakeLists.txt b/arch/arm/src/stm32wl5/CMakeLists.txt index a0fbfdb8ca0..b13a427ce34 100644 --- a/arch/arm/src/stm32wl5/CMakeLists.txt +++ b/arch/arm/src/stm32wl5/CMakeLists.txt @@ -31,7 +31,6 @@ set(SRCS stm32wl5_rcc.c stm32wl5_serial.c stm32wl5_start.c - stm32wl5_uid.c stm32wl5_lse.c stm32wl5_lsi.c stm32wl5_idle.c diff --git a/arch/arm/src/stm32wl5/Make.defs b/arch/arm/src/stm32wl5/Make.defs index 05dfb1790b6..d61921e8c12 100644 --- a/arch/arm/src/stm32wl5/Make.defs +++ b/arch/arm/src/stm32wl5/Make.defs @@ -32,7 +32,7 @@ include common/stm32/Make.defs CHIP_CSRCS += stm32wl5_allocateheap.c stm32wl5_exti_gpio.c stm32wl5_gpio.c CHIP_CSRCS += stm32wl5_irq.c stm32wl5_lowputc.c stm32wl5_rcc.c -CHIP_CSRCS += stm32wl5_serial.c stm32wl5_start.c stm32wl5_uid.c +CHIP_CSRCS += stm32wl5_serial.c stm32wl5_start.c CHIP_CSRCS += stm32wl5_lse.c stm32wl5_lsi.c stm32wl5_idle.c CHIP_CSRCS += stm32wl5_pwr.c stm32wl5_tim.c stm32wl5_flash.c stm32wl5_timerisr.c CHIP_CSRCS += stm32wl5_spi.c diff --git a/arch/arm/src/stm32wl5/stm32wl5_uid.h b/arch/arm/src/stm32wl5/stm32wl5_uid.h deleted file mode 100644 index 3735cf07bd1..00000000000 --- a/arch/arm/src/stm32wl5/stm32wl5_uid.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** - * arch/arm/src/stm32wl5/stm32wl5_uid.h - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2015 Marawan Ragab. All rights reserved. - * SPDX-FileContributor: Marawan Ragab - * SPDX-FileContributor: dev@ziggurat9.com - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __ARCH_ARM_SRC_STM32WL5_STM32WL5_UID_H -#define __ARCH_ARM_SRC_STM32WL5_STM32WL5_UID_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void stm32_get_uniqueid(uint8_t uniqueid[12]); - -#endif /* __ARCH_ARM_SRC_STM32WL5_STM32WL5_UID_H */ diff --git a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_uid.c b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_uid.c index 848add8c3b7..6e55610c9f0 100644 --- a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_uid.c +++ b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_uid.c @@ -38,7 +38,7 @@ #include -#include "stm32l4_uid.h" +#include "stm32_uid.h" #include "nucleo-l432kc.h" /**************************************************************************** diff --git a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_uid.c b/boards/arm/stm32l4/nucleo-l476rg/src/stm32_uid.c index 15536f8784b..ee1dedd0510 100644 --- a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_uid.c +++ b/boards/arm/stm32l4/nucleo-l476rg/src/stm32_uid.c @@ -38,7 +38,7 @@ #include -#include "stm32l4_uid.h" +#include "stm32_uid.h" #include "nucleo-l476rg.h" /**************************************************************************** diff --git a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_uid.c b/boards/arm/stm32l4/nucleo-l496zg/src/stm32_uid.c index 13d47f603d6..399675787a6 100644 --- a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_uid.c +++ b/boards/arm/stm32l4/nucleo-l496zg/src/stm32_uid.c @@ -38,7 +38,7 @@ #include -#include "stm32l4_uid.h" +#include "stm32_uid.h" #include "nucleo-144.h" /**************************************************************************** diff --git a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_boot.c b/boards/arm/stm32l4/stm32l476-mdk/src/stm32_boot.c index 9600a50507a..98d872dd6dd 100644 --- a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_boot.c +++ b/boards/arm/stm32l4/stm32l476-mdk/src/stm32_boot.c @@ -44,7 +44,7 @@ #include "arm_internal.h" #include "stm32.h" -#include "stm32l4_uid.h" +#include "stm32_uid.h" #include "stm32l476-mdk.h" /* Conditional logic in stm32l476-mdk.h will determine if certain features diff --git a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_bringup.c b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_bringup.c index f3137ceb232..d2dc6b3d08a 100644 --- a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_bringup.c +++ b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_bringup.c @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include diff --git a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_uid.c b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_uid.c index 60809d9a07f..6f48da0eaa3 100644 --- a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_uid.c +++ b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_uid.c @@ -38,7 +38,7 @@ #include -#include "stm32l4_uid.h" +#include "stm32_uid.h" #include "stm32l476vg-disco.h" /**************************************************************************** diff --git a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_bringup.c b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_bringup.c index ecbd830badd..bc90f989877 100644 --- a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_bringup.c +++ b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_bringup.c @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include diff --git a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_uid.c b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_uid.c index 94a5221d7ef..d0ee15fcd0e 100644 --- a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_uid.c +++ b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_uid.c @@ -38,7 +38,7 @@ #include -#include "stm32l4_uid.h" +#include "stm32_uid.h" #include "stm32l4r9ai-disco.h" /****************************************************************************