[bsp][stm32] Add stm32n657-st-nucleo BSP (#11799)

* [bsp][stm32] Add stm32n657-st-nucleo BSP

* style: format STM32 HAL drivers and STM32N657 BSP with clang-format
This commit is contained in:
yans6666 authored and GitHub committed 2026-09-16 09:05:27 +08:00
1 parent f165a0f804
commit 1d2152ceee
83 files changed
+17884 -381

No files matched your search

+1
View File
@@ -221,6 +221,7 @@
"stm32/stm32h7r7-artpi2",
"stm32/stm32mp157a-st-discovery",
"stm32/stm32mp157a-st-ev1",
"stm32/stm32n657-st-nucleo",
"stm32/stm32u575-st-nucleo",
"stm32/stm32u585-iot02a",
"stm32/stm32wb55-st-nucleo"
+1
View File
@@ -157,6 +157,7 @@ This document is based on the RT-Thread mainline repository and categorizes the
| [stm32l552-st-nucleo](stm32/stm32l552-st-nucleo) | ✅ | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| [stm32mp157a-st-discovery](stm32/stm32mp157a-st-discovery) | ✅ | ✅ | ✅ | - | ✅ | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - | - | ✅ | - | - | - | - | - | - | - | - | ✅ | - | - | - |
| [stm32mp157a-st-ev1](stm32/stm32mp157a-st-ev1) | ✅ | ✅ | ✅ | ✅ | ✅ | - | ✅ | ✅ | ✅ | ✅ | - | ✅ | - | - | ✅ | - | ✅ | - | - | - | ✅ | - | ✅ | ✅ | - | - | - |
| [stm32n657-st-nucleo](stm32/stm32n657-st-nucleo) | ✅ | ✅ | - | - | - | - | - | ✅ | - | ✅ | - | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| [stm32u575-st-nucleo](stm32/stm32u575-st-nucleo) | ✅ | ✅ | ✅ | - | - | - | - | - | ✅ | ✅ | - | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| [stm32u585-iot02a](stm32/stm32u585-iot02a) | ✅ | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| [stm32wb55-st-nucleo](stm32/stm32wb55-st-nucleo) | ✅ | ✅ | ✅ | - | - | - | - | ✅ | ✅ | - | ✅ | ✅ | - | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - |
+2
View File
@@ -99,6 +99,8 @@ STM32 系列 BSP 目前支持情况如下表所示:
| **MP1 系列** | |
| [stm32mp157a-st-discovery](stm32mp157a-st-discovery) | ST 官方 STM32MP157A-DK1 开发板 |
| [stm32mp157a-st-ev1](stm32mp157a-st-ev1) | ST 官方 STM32MP157A-EV1 开发板 |
| **N6 系列** | |
| [stm32n657-st-nucleo](stm32n657-st-nucleo) | ST 官方 STM32N657-Nucleo 开发板 |
| **WB 系列** | |
| [stm32wb55-st-nucleo](stm32wb55-st-nucleo) | ST 官方 STM32WB55-Nucleo 开发板 |
| [stm32wl55-st-nucleo](stm32wl55-st-nucleo) | ST 官方 STM32WL55-Nucleo 开发板 |
@@ -0,0 +1,93 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-12-06 zylx first version
*/
#ifndef __ADC_CONFIG_H__
#define __ADC_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BSP_USING_ADC1
#ifndef ADC1_CONFIG
#define ADC1_CONFIG \
{ \
.Instance = ADC1, \
.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4, \
.Init.Resolution = ADC_RESOLUTION_16B, \
.Init.ScanConvMode = ADC_SCAN_DISABLE, \
.Init.EOCSelection = ADC_EOC_SINGLE_CONV, \
.Init.LowPowerAutoWait = DISABLE, \
.Init.ContinuousConvMode = DISABLE, \
.Init.NbrOfConversion = 1, \
.Init.DiscontinuousConvMode = DISABLE, \
.Init.NbrOfDiscConversion = 1, \
.Init.ExternalTrigConv = ADC_SOFTWARE_START, \
.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \
.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR, \
.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN, \
.Init.OversamplingMode = DISABLE, \
}
#endif /* ADC1_CONFIG */
#endif /* BSP_USING_ADC1 */
#ifdef BSP_USING_ADC2
#ifndef ADC2_CONFIG
#define ADC2_CONFIG \
{ \
.Instance = ADC2, \
.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4, \
.Init.Resolution = ADC_RESOLUTION_16B, \
.Init.ScanConvMode = ADC_SCAN_DISABLE, \
.Init.EOCSelection = ADC_EOC_SINGLE_CONV, \
.Init.LowPowerAutoWait = DISABLE, \
.Init.ContinuousConvMode = DISABLE, \
.Init.NbrOfConversion = 1, \
.Init.DiscontinuousConvMode = DISABLE, \
.Init.NbrOfDiscConversion = 1, \
.Init.ExternalTrigConv = ADC_SOFTWARE_START, \
.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \
.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR, \
.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN, \
.Init.OversamplingMode = DISABLE, \
}
#endif /* ADC2_CONFIG */
#endif /* BSP_USING_ADC2 */
#ifdef BSP_USING_ADC3
#ifndef ADC3_CONFIG
#define ADC3_CONFIG \
{ \
.Instance = ADC3, \
.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4, \
.Init.Resolution = ADC_RESOLUTION_16B, \
.Init.ScanConvMode = ADC_SCAN_DISABLE, \
.Init.EOCSelection = ADC_EOC_SINGLE_CONV, \
.Init.LowPowerAutoWait = DISABLE, \
.Init.ContinuousConvMode = DISABLE, \
.Init.NbrOfConversion = 1, \
.Init.DiscontinuousConvMode = DISABLE, \
.Init.NbrOfDiscConversion = 1, \
.Init.ExternalTrigConv = ADC_SOFTWARE_START, \
.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \
.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR, \
.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN, \
.Init.OversamplingMode = DISABLE, \
}
#endif /* ADC3_CONFIG */
#endif /* BSP_USING_ADC3 */
#ifdef __cplusplus
}
#endif
#endif /* __ADC_CONFIG_H__ */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2006-2024 RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-07-11 wdfk-prog first version
*/
#ifndef __LPTIM_CONFIG_H__
#define __LPTIM_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef LPTIM_DEV_INFO_CONFIG
#define LPTIM_DEV_INFO_CONFIG \
{ \
.maxfreq = 1000000, \
.minfreq = 3000, \
.maxcnt = 0xFFFF, \
.cntmode = CLOCK_TIMER_CNTMODE_UP, \
}
#endif /* TIM_DEV_INFO_CONFIG */
#ifdef BSP_USING_LPTIM1
#ifndef LPTIM1_CONFIG
#define LPTIM1_CONFIG \
{ \
.tim_handle.Instance = LPTIM1, \
.tim_irqn = LPTIM1_IRQn, \
.name = "lptim1", \
}
#endif /* LPTIM1_CONFIG */
#endif /* BSP_USING_LPTIM1 */
#ifdef BSP_USING_LPTIM2
#ifndef LPTIM2_CONFIG
#define LPTIM2_CONFIG \
{ \
.tim_handle.Instance = LPTIM2, \
.tim_irqn = LPTIM2_IRQn, \
.name = "lptim2", \
}
#endif /* LPTIM1_CONFIG */
#endif /* BSP_USING_LPTIM1 */
#ifdef BSP_USING_LPTIM3
#ifndef LPTIM3_CONFIG
#define LPTIM3_CONFIG \
{ \
.tim_handle.Instance = LPTIM3, \
.tim_irqn = LPTIM3_IRQn, \
.name = "lptim3", \
}
#endif /* LPTIM3_CONFIG */
#endif /* BSP_USING_LPTIM3 */
#ifdef __cplusplus
}
#endif
#endif /* __LPTIM_CONFIG_H__ */
@@ -0,0 +1,197 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-12-13 zylx first version
* 2022-04-14 Miaowulue add PWM1
* 2023-04-08 Wangyuqiang complete PWM defination
*/
#ifndef __PWM_CONFIG_H__
#define __PWM_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BSP_USING_PWM1
#define PWM1_CONFIG \
{ \
.tim_handle.Instance = TIM1, \
.name = "pwm1", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM1 */
#ifdef BSP_USING_PWM2
#define PWM2_CONFIG \
{ \
.tim_handle.Instance = TIM2, \
.name = "pwm2", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM2 */
#ifdef BSP_USING_PWM3
#define PWM3_CONFIG \
{ \
.tim_handle.Instance = TIM3, \
.name = "pwm3", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM3 */
#ifdef BSP_USING_PWM4
#define PWM4_CONFIG \
{ \
.tim_handle.Instance = TIM4, \
.name = "pwm4", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM4 */
#ifdef BSP_USING_PWM5
#define PWM5_CONFIG \
{ \
.tim_handle.Instance = TIM5, \
.name = "pwm5", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM5 */
#ifdef BSP_USING_PWM6
#define PWM6_CONFIG \
{ \
.tim_handle.Instance = TIM6, \
.name = "pwm6", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM6 */
#ifdef BSP_USING_PWM7
#define PWM7_CONFIG \
{ \
.tim_handle.Instance = TIM7, \
.name = "pwm7", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM7 */
#ifdef BSP_USING_PWM8
#define PWM8_CONFIG \
{ \
.tim_handle.Instance = TIM8, \
.name = "pwm8", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM8 */
#ifdef BSP_USING_PWM9
#define PWM9_CONFIG \
{ \
.tim_handle.Instance = TIM9, \
.name = "pwm9", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM9 */
#ifdef BSP_USING_PWM10
#define PWM10_CONFIG \
{ \
.tim_handle.Instance = TIM10, \
.name = "pwm10", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM10 */
#ifdef BSP_USING_PWM11
#define PWM11_CONFIG \
{ \
.tim_handle.Instance = TIM11, \
.name = "pwm11", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM11 */
#ifdef BSP_USING_PWM12
#define PWM12_CONFIG \
{ \
.tim_handle.Instance = TIM12, \
.name = "pwm12", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM12 */
#ifdef BSP_USING_PWM13
#define PWM13_CONFIG \
{ \
.tim_handle.Instance = TIM13, \
.name = "pwm13", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM13 */
#ifdef BSP_USING_PWM14
#define PWM14_CONFIG \
{ \
.tim_handle.Instance = TIM14, \
.name = "pwm14", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM14 */
#ifdef BSP_USING_PWM15
#define PWM15_CONFIG \
{ \
.tim_handle.Instance = TIM15, \
.name = "pwm15", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM15 */
#ifdef BSP_USING_PWM16
#define PWM16_CONFIG \
{ \
.tim_handle.Instance = TIM16, \
.name = "pwm16", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM16 */
#ifdef BSP_USING_PWM17
#define PWM17_CONFIG \
{ \
.tim_handle.Instance = TIM17, \
.name = "pwm17", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM17 */
#ifdef BSP_USING_PWM18
#define PWM18_CONFIG \
{ \
.tim_handle.Instance = TIM18, \
.name = "pwm18", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM18 */
#ifdef BSP_USING_PWM19
#define PWM19_CONFIG \
{ \
.tim_handle.Instance = TIM19, \
.name = "pwm19", \
.channel = RT_NULL \
}
#endif /* BSP_USING_PWM19 */
#ifdef __cplusplus
}
#endif
#endif /* __PWM_CONFIG_H__ */
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-12-22 zylx first version
*/
#ifndef __QSPI_CONFIG_H__
#define __QSPI_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BSP_USING_QSPI
#ifndef QSPI_BUS_CONFIG
#define QSPI_BUS_CONFIG \
{ \
.Instance = QUADSPI, \
.Init.FifoThreshold = 4, \
.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE, \
.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_4_CYCLE, \
}
#endif /* QSPI_BUS_CONFIG */
#endif /* BSP_USING_QSPI */
#ifdef BSP_QSPI_USING_DMA
#ifndef QSPI_DMA_CONFIG
#define QSPI_DMA_CONFIG \
{ \
.Instance = QSPI_DMA_INSTANCE, \
.Init.Channel = QSPI_DMA_CHANNEL, \
.Init.Direction = DMA_PERIPH_TO_MEMORY, \
.Init.PeriphInc = DMA_PINC_DISABLE, \
.Init.MemInc = DMA_MINC_ENABLE, \
.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE, \
.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE, \
.Init.Mode = DMA_NORMAL, \
.Init.Priority = DMA_PRIORITY_LOW \
}
#endif /* QSPI_DMA_CONFIG */
#endif /* BSP_QSPI_USING_DMA */
#define QSPI_IRQn QUADSPI_IRQn
#define QSPI_IRQHandler QUADSPI_IRQHandler
#ifdef __cplusplus
}
#endif
#endif /* __QSPI_CONFIG_H__ */
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-12-13 BalanceTWK first version
*/
#ifndef __SDIO_CONFIG_H__
#define __SDIO_CONFIG_H__
#include <rtthread.h>
#include "stm32h7xx_hal.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BSP_USING_SDIO
#define SDIO_BUS_CONFIG \
{ \
.Instance = SDMMC1, \
.dma_rx.dma_rcc = RCC_AHB1ENR_DMA2EN, \
.dma_tx.dma_rcc = RCC_AHB1ENR_DMA2EN, \
.dma_rx.Instance = DMA2_Stream3, \
.dma_rx.channel = DMA_CHANNEL_4, \
.dma_rx.dma_irq = DMA2_Stream3_IRQn, \
.dma_tx.Instance = DMA2_Stream6, \
.dma_tx.channel = DMA_CHANNEL_4, \
.dma_tx.dma_irq = DMA2_Stream6_IRQn, \
}
#endif
#ifdef __cplusplus
}
#endif
#endif /*__SDIO_CONFIG_H__ */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-12-11 zylx first version
*/
#ifndef __TIM_CONFIG_H__
#define __TIM_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef TIM_DEV_INFO_CONFIG
#define TIM_DEV_INFO_CONFIG \
{ \
.maxfreq = 1000000, \
.minfreq = 3000, \
.maxcnt = 0xFFFF, \
.cntmode = CLOCK_TIMER_CNTMODE_UP, \
}
#endif /* TIM_DEV_INFO_CONFIG */
#ifdef BSP_USING_TIM2
#ifndef TIM2_CONFIG
#define TIM2_CONFIG \
{ \
.tim_handle.Instance = TIM2, \
.tim_irqn = TIM2_IRQn, \
.name = "timer2", \
}
#endif /* TIM2_CONFIG */
#endif /* BSP_USING_TIM2 */
#ifdef __cplusplus
}
#endif
#endif /* __TIM_CONFIG_H__ */
@@ -0,0 +1,163 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-10-30 SummerGift first version
* 2019-01-05 zylx modify dma support
* 2020-05-02 whj4674672 support stm32h7 uart dma
*/
#ifndef __UART_CONFIG_H__
#define __UART_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(BSP_USING_UART1)
#ifndef UART1_CONFIG
#define UART1_CONFIG \
{ \
.name = "uart1", \
.Instance = USART1, \
.irq_type = USART1_IRQn, \
}
#endif /* UART1_CONFIG */
#endif /* BSP_USING_UART1 */
#if defined(BSP_UART1_RX_USING_DMA)
#ifndef UART1_DMA_RX_CONFIG
#define UART1_DMA_RX_CONFIG \
{ \
.Instance = UART1_RX_DMA_INSTANCE, \
.request = UART1_RX_DMA_REQUEST, \
.dma_rcc = UART1_RX_DMA_RCC, \
.dma_irq = UART1_RX_DMA_IRQ, \
}
#endif /* UART1_DMA_RX_CONFIG */
#endif /* BSP_UART1_RX_USING_DMA */
#if defined(BSP_USING_UART2)
#ifndef UART2_CONFIG
#define UART2_CONFIG \
{ \
.name = "uart2", \
.Instance = USART2, \
.irq_type = USART2_IRQn, \
}
#endif /* UART2_CONFIG */
#endif /* BSP_USING_UART2 */
#if defined(BSP_UART2_RX_USING_DMA)
#ifndef UART2_DMA_RX_CONFIG
#define UART2_DMA_RX_CONFIG \
{ \
.Instance = UART2_RX_DMA_INSTANCE, \
.request = UART2_RX_DMA_REQUEST, \
.dma_rcc = UART2_RX_DMA_RCC, \
.dma_irq = UART2_RX_DMA_IRQ, \
}
#endif /* UART2_DMA_RX_CONFIG */
#endif /* BSP_UART2_RX_USING_DMA */
#if defined(BSP_UART2_TX_USING_DMA)
#ifndef UART2_DMA_TX_CONFIG
#define UART2_DMA_TX_CONFIG \
{ \
.Instance = UART2_TX_DMA_INSTANCE, \
.request = UART2_TX_DMA_REQUEST, \
.dma_rcc = UART2_TX_DMA_RCC, \
.dma_irq = UART2_TX_DMA_IRQ, \
}
#endif /* UART2_DMA_TX_CONFIG */
#endif /* BSP_UART2_TX_USING_DMA */
#if defined(BSP_USING_UART3)
#ifndef UART3_CONFIG
#define UART3_CONFIG \
{ \
.name = "uart3", \
.Instance = USART3, \
.irq_type = USART3_IRQn, \
}
#endif /* UART3_CONFIG */
#endif /* BSP_USING_UART3 */
#if defined(BSP_UART3_RX_USING_DMA)
#ifndef UART3_DMA_RX_CONFIG
#define UART3_DMA_RX_CONFIG \
{ \
.Instance = UART3_RX_DMA_INSTANCE, \
.request = UART3_RX_DMA_REQUEST, \
.dma_rcc = UART3_RX_DMA_RCC, \
.dma_irq = UART3_RX_DMA_IRQ, \
}
#endif /* UART3_DMA_RX_CONFIG */
#endif /* BSP_UART3_RX_USING_DMA */
#if defined(BSP_USING_UART4)
#ifndef UART4_CONFIG
#define UART4_CONFIG \
{ \
.name = "uart4", \
.Instance = UART4, \
.irq_type = UART4_IRQn, \
}
#endif /* UART4_CONFIG */
#endif /* BSP_USING_UART4 */
#if defined(BSP_UART4_RX_USING_DMA)
#ifndef UART4_DMA_RX_CONFIG
#define UART4_DMA_RX_CONFIG \
{ \
.Instance = UART4_RX_DMA_INSTANCE, \
.request = UART4_RX_DMA_REQUEST, \
.dma_rcc = UART4_RX_DMA_RCC, \
.dma_irq = UART4_RX_DMA_IRQ, \
}
#endif /* UART4_DMA_RX_CONFIG */
#endif /* BSP_UART4_RX_USING_DMA */
#if defined(BSP_USING_UART5)
#ifndef UART5_CONFIG
#define UART5_CONFIG \
{ \
.name = "uart5", \
.Instance = UART5, \
.irq_type = UART5_IRQn, \
}
#endif /* UART5_CONFIG */
#endif /* BSP_USING_UART5 */
#if defined(BSP_UART5_RX_USING_DMA)
#ifndef UART5_DMA_RX_CONFIG
#define UART5_DMA_RX_CONFIG \
{ \
.Instance = UART5_RX_DMA_INSTANCE, \
.request = UART5_RX_DMA_REQUEST, \
.dma_rcc = UART5_RX_DMA_RCC, \
.dma_irq = UART5_RX_DMA_IRQ, \
}
#endif /* UART5_DMA_RX_CONFIG */
#endif /* BSP_UART5_RX_USING_DMA */
#if defined(BSP_USING_LPUART1)
#ifndef LPUART1_CONFIG
#define LPUART1_CONFIG \
{ \
.name = "hlpuart1", \
.Instance = LPUART1, \
.irq_type = LPUART1_IRQn, \
}
#endif /* LPUART1_CONFIG */
#endif /* BSP_USING_LPUART1 */
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-04-10 ZYH first version
* 2019-10-27 flybreak Compatible with the HS
*/
#ifndef __USBD_CONFIG_H__
#define __USBD_CONFIG_H__
#include <rtconfig.h>
#ifdef BSP_USBD_TYPE_HS
#define USBD_IRQ_TYPE OTG_HS_IRQn
#define USBD_IRQ_HANDLER OTG_HS_IRQHandler
#define USBD_INSTANCE USB_OTG_HS
#else
#define USBD_IRQ_TYPE OTG_FS_IRQn
#define USBD_IRQ_HANDLER OTG_FS_IRQHandler
#define USBD_INSTANCE USB_OTG_FS
#endif
#ifdef BSP_USBD_SPEED_HS
#define USBD_PCD_SPEED PCD_SPEED_HIGH
#elif BSP_USBD_SPEED_HSINFS
#define USBD_PCD_SPEED PCD_SPEED_HIGH_IN_FULL
#else
#define USBD_PCD_SPEED PCD_SPEED_FULL
#endif
#ifdef BSP_USBD_PHY_ULPI
#define USBD_PCD_PHY_MODULE PCD_PHY_ULPI
#elif BSP_USBD_PHY_UTMI
#define USBD_PCD_PHY_MODULE PCD_PHY_UTMI
#else
#define USBD_PCD_PHY_MODULE PCD_PHY_EMBEDDED
#endif
#endif
@@ -116,7 +116,7 @@ extern "C" {
#include "g0/tim_config.h"
#include "g0/pwm_config.h"
#include "g0/usbd_config.h"
#elif defined(SOC_SERIES_STM32G4)
#elif defined(SOC_SERIES_STM32G4)
#include "g4/dma_config.h"
#include "g4/uart_config.h"
#include "g4/spi_config.h"
@@ -179,6 +179,14 @@ extern "C" {
#include "mp1/dac_config.h"
#include "mp1/tim_config.h"
#include "mp1/pwm_config.h"
#elif defined(SOC_SERIES_STM32N6)
#include "n6/dma_config.h"
#include "n6/uart_config.h"
#include "n6/spi_config.h"
#include "n6/adc_config.h"
#include "n6/tim_config.h"
#include "n6/pwm_config.h"
#include "n6/usbd_config.h"
#elif defined(SOC_SERIES_STM32WL)
#include "wl/dma_config.h"
#include "wl/uart_config.h"
@@ -201,4 +209,4 @@ extern "C" {
}
#endif /* __cplusplus */
#endif /* __DRV_CONFIG_H__ */
#endif /* __DRV_CONFIG_H__ */
@@ -47,22 +47,23 @@ extern "C" {
/**
* @brief DMA capability classification for STM32 series supported by this BSP.
*/
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32F3) || defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) || defined(SOC_SERIES_STM32L1)
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32F3) || defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) || defined(SOC_SERIES_STM32L1) || defined(SOC_SERIES_STM32N6)
#define DMA_INSTANCE_TYPE DMA_Channel_TypeDef
#elif defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32MP1)
#define DMA_INSTANCE_TYPE DMA_Stream_TypeDef
#endif /* defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32L5)
|| defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32G0)
|| defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32F3)
|| defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) || defined(SOC_SERIES_STM32L1)*/
|| defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) || defined(SOC_SERIES_STM32L1)
|| defined(SOC_SERIES_STM32N6) */
#if defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
#define STM32_DMA_USES_CHANNEL
#endif /* defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) */
#if defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS)
#if defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) || defined(SOC_SERIES_STM32N6)
#define STM32_DMA_USES_GPDMA
#endif /* defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) */
#endif /* defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) || defined(SOC_SERIES_STM32N6) */
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32MP1) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS)
#define STM32_DMA_USES_REQUEST
@@ -82,7 +83,7 @@ extern "C" {
#define STM32_DMA_USES_RCC_MP_AHB2ENSETR
#endif /* defined(SOC_SERIES_STM32MP1) */
#if defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS)
#if defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) || defined(SOC_SERIES_STM32N6)
#define STM32_DMA_USES_RCC_AHB1ENR
#endif /* defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
|| defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32G4)
File diff suppressed because it is too large. Load diff
@@ -18,12 +18,12 @@
#include <drivers/dev_pwm.h>
//#define DRV_DEBUG
#define LOG_TAG "drv.pwm"
#define LOG_TAG "drv.pwm"
#include <drv_log.h>
#define MAX_PERIOD 65535
#define MIN_PERIOD 1
#define MIN_PULSE 1
#define MIN_PULSE 1
enum
{
@@ -83,13 +83,12 @@ enum
struct stm32_pwm
{
struct rt_device_pwm pwm_device;
TIM_HandleTypeDef tim_handle;
TIM_HandleTypeDef tim_handle;
rt_uint8_t channel;
char *name;
};
static struct stm32_pwm stm32_pwm_obj[] =
{
static struct stm32_pwm stm32_pwm_obj[] = {
#ifdef BSP_USING_PWM1
PWM1_CONFIG,
#endif
@@ -180,12 +179,15 @@ static rt_uint64_t tim_clock_get(TIM_HandleTypeDef *htim)
}
#endif
#if defined(SOC_SERIES_STM32N6)
tim_clock = HAL_RCCEx_GetTIMGFreq();
#endif
return tim_clock;
}
static rt_err_t drv_pwm_control(struct rt_device_pwm *device, int cmd, void *arg);
static struct rt_pwm_ops drv_ops =
{
static struct rt_pwm_ops drv_ops = {
drv_pwm_control
};
@@ -254,7 +256,7 @@ static rt_err_t drv_pwm_set(TIM_HandleTypeDef *htim, struct rt_pwm_configuration
tim_clock = tim_clock_get(htim);
/* Convert nanosecond to frequency and duty cycle. 1s = 1 * 1000 * 1000 * 1000 ns */
tim_clock /= 1000000UL;
period = (rt_uint64_t)configuration->period * tim_clock / 1000ULL ;
period = (rt_uint64_t)configuration->period * tim_clock / 1000ULL;
psc = period / MAX_PERIOD + 1;
period = period / psc;
__HAL_TIM_SET_PRESCALER(htim, psc - 1);
@@ -294,7 +296,7 @@ static rt_err_t drv_pwm_set_period(TIM_HandleTypeDef *htim, struct rt_pwm_config
tim_clock = tim_clock_get(htim);
/* Convert nanosecond to frequency and duty cycle. 1s = 1 * 1000 * 1000 * 1000 ns */
tim_clock /= 1000000UL;
period = (rt_uint64_t)configuration->period * tim_clock / 1000ULL ;
period = (rt_uint64_t)configuration->period * tim_clock / 1000ULL;
psc = period / MAX_PERIOD + 1;
period = period / psc;
__HAL_TIM_SET_PRESCALER(htim, psc - 1);
@@ -363,9 +365,9 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
{
rt_err_t result = RT_EOK;
TIM_HandleTypeDef *tim = RT_NULL;
TIM_OC_InitTypeDef oc_config = {0};
TIM_MasterConfigTypeDef master_config = {0};
TIM_ClockConfigTypeDef clock_config = {0};
TIM_OC_InitTypeDef oc_config = { 0 };
TIM_MasterConfigTypeDef master_config = { 0 };
TIM_ClockConfigTypeDef clock_config = { 0 };
RT_ASSERT(device != RT_NULL);
@@ -376,7 +378,8 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
tim->Init.CounterMode = TIM_COUNTERMODE_UP;
tim->Init.Period = 1;
tim->Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4)
tim->Init.RepetitionCounter = 0;
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32N6)
tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
#endif
if (HAL_TIM_Base_Init(tim) != HAL_OK)
@@ -403,7 +406,7 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
goto __exit;
}
if(IS_TIM_MASTER_INSTANCE(tim->Instance))
if (IS_TIM_MASTER_INSTANCE(tim->Instance))
{
master_config.MasterOutputTrigger = TIM_TRGO_RESET;
master_config.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
@@ -420,7 +423,7 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
oc_config.OCPolarity = TIM_OCPOLARITY_HIGH;
oc_config.OCFastMode = TIM_OCFAST_DISABLE;
oc_config.OCNIdleState = TIM_OCNIDLESTATE_RESET;
oc_config.OCIdleState = TIM_OCIDLESTATE_RESET;
oc_config.OCIdleState = TIM_OCIDLESTATE_RESET;
/* config pwm channel */
if (device->channel & 0x01)
@@ -464,7 +467,7 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
}
/* pwm pin configuration */
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
void HAL_TIM_MspPostInit(TIM_HandleTypeDef * htim);
HAL_TIM_MspPostInit(tim);
/* enable update request source */
@@ -254,6 +254,37 @@ static rt_err_t stm32_spi_init(struct stm32_spi *spi_drv, struct rt_spi_configur
#endif /* SOC_SERIES_STM32H7) */
#endif /* APBPERIPH_BASE */
#if defined(SOC_SERIES_STM32N6)
if (spi_drv->config->Instance == SPI1)
{
spi_clock = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SPI1);
}
else if (spi_drv->config->Instance == SPI2)
{
spi_clock = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SPI2);
}
else if (spi_drv->config->Instance == SPI3)
{
spi_clock = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SPI3);
}
else if (spi_drv->config->Instance == SPI4)
{
spi_clock = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SPI4);
}
else if (spi_drv->config->Instance == SPI5)
{
spi_clock = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SPI5);
}
else if (spi_drv->config->Instance == SPI6)
{
spi_clock = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SPI6);
}
else
{
spi_clock = HSI_VALUE;
}
#endif /* SOC_SERIES_STM32N6) */
if (cfg->max_hz >= spi_clock / 2)
{
spi_handle->Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
@@ -288,11 +319,11 @@ static rt_err_t stm32_spi_init(struct stm32_spi *spi_drv, struct rt_spi_configur
spi_handle->Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_256;
}
#if defined(SOC_SERIES_STM32H7)
#if defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32N6)
cfg->usage_freq = spi_clock / (rt_size_t)(1 << ((spi_handle->Init.BaudRatePrescaler >> SPI_CFG1_MBR_Pos) + 1));
#else
cfg->usage_freq = spi_clock / (rt_size_t)(1 << ((spi_handle->Init.BaudRatePrescaler >> SPI_CR1_BR_Pos) + 1));
#endif /* SOC_SERIES_STM32H7 */
#endif /* SOC_SERIES_STM32H7 || SOC_SERIES_STM32N6 */
LOG_D("sys freq: %d, pclk freq: %d, SPI limiting freq: %d, SPI usage freq: %d",
#if defined(SOC_SERIES_STM32MP1)
@@ -318,7 +349,7 @@ static rt_err_t stm32_spi_init(struct stm32_spi *spi_drv, struct rt_spi_configur
spi_handle->State = HAL_SPI_STATE_RESET;
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32WB)
spi_handle->Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
#elif defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32MP1)
#elif defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32MP1) || defined(SOC_SERIES_STM32N6)
spi_handle->Init.NSS = SPI_NSS_SOFT;
spi_handle->Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
spi_handle->Init.NSSPolarity = SPI_NSS_POLARITY_LOW;
@@ -331,6 +362,10 @@ static rt_err_t stm32_spi_init(struct stm32_spi *spi_drv, struct rt_spi_configur
spi_handle->Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_ENABLE;
spi_handle->Init.IOSwap = SPI_IO_SWAP_DISABLE;
spi_handle->Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA;
#if defined(SOC_SERIES_STM32N6)
spi_handle->Init.ReadyMasterManagement = SPI_RDY_MASTER_MANAGEMENT_INTERNALLY;
spi_handle->Init.ReadyPolarity = SPI_RDY_POLARITY_HIGH;
#endif /* SOC_SERIES_STM32N6 */
#endif
if (HAL_SPI_Init(spi_handle) != HAL_OK)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -21,21 +21,17 @@
int rt_hw_usart_init(void);
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32WL) \
|| defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) \
|| defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB)|| defined(SOC_SERIES_STM32F3) || defined(SOC_SERIES_STM32U5) \
|| defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_FLAG
#elif defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) \
|| defined(SOC_SERIES_STM32MP1)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_IT
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32F3) || defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_FLAG
#elif defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32MP1) || defined(SOC_SERIES_STM32N6)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_IT
#endif
#define UART_RX_DMA_IT_IDLE_FLAG 0x00
#define UART_RX_DMA_IT_HT_FLAG 0x01
#define UART_RX_DMA_IT_TC_FLAG 0x02
#define UART_RX_DMA_IT_IDLE_FLAG 0x00
#define UART_RX_DMA_IT_HT_FLAG 0x01
#define UART_RX_DMA_IT_TC_FLAG 0x02
#define UART_CTRL_SET_BLOCK_TIMEOUT 0x20
#define UART_CTRL_SET_BLOCK_TIMEOUT 0x20
/* stm32 config class */
struct stm32_uart_config
File diff suppressed because it is too large. Load diff
@@ -20,34 +20,27 @@
int rt_hw_usart_init(void);
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) \
|| defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32L5) \
|| defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32MP1) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32F3) \
|| defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS)
#define UART_SET_TDR(__HANDLE__, __DATA__) ((__HANDLE__)->Instance->TDR = (__DATA__))
#define UART_GET_RDR(__HANDLE__, MASK) ((__HANDLE__)->Instance->RDR & MASK)
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32MP1) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32F3) || defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) || defined(SOC_SERIES_STM32N6)
#define UART_SET_TDR(__HANDLE__, __DATA__) ((__HANDLE__)->Instance->TDR = (__DATA__))
#define UART_GET_RDR(__HANDLE__, MASK) ((__HANDLE__)->Instance->RDR & MASK)
#else
#define UART_SET_TDR(__HANDLE__, __DATA__) ((__HANDLE__)->Instance->DR = (__DATA__))
#define UART_GET_RDR(__HANDLE__, MASK) ((__HANDLE__)->Instance->DR & MASK)
#define UART_SET_TDR(__HANDLE__, __DATA__) ((__HANDLE__)->Instance->DR = (__DATA__))
#define UART_GET_RDR(__HANDLE__, MASK) ((__HANDLE__)->Instance->DR & MASK)
#endif
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32WL) \
|| defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) \
|| defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB)|| defined(SOC_SERIES_STM32F3) || defined(SOC_SERIES_STM32U5) \
|| defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_FLAG
#elif defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) \
|| defined(SOC_SERIES_STM32MP1)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_IT
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32L5) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32F3) || defined(SOC_SERIES_STM32U5) || defined(SOC_SERIES_STM32H5) || defined(SOC_SERIES_STM32H7RS) || defined(SOC_SERIES_STM32N6)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_FLAG
#elif defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32MP1)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_IT
#endif
#define UART_RX_DMA_IT_IDLE_FLAG 0x00
#define UART_RX_DMA_IT_HT_FLAG 0x01
#define UART_RX_DMA_IT_TC_FLAG 0x02
#define UART_RX_DMA_IT_IDLE_FLAG 0x00
#define UART_RX_DMA_IT_HT_FLAG 0x01
#define UART_RX_DMA_IT_TC_FLAG 0x02
#define UART_CTRL_SET_ERROR_CALLBACK 0x100
#define UART_CTRL_SET_ERROR_CALLBACK 0x100
/* stm32 config class */
struct stm32_uart_config
+11 -3
View File
@@ -58,7 +58,9 @@ void rt_hw_systick_init(void)
_systick_ms = 1000u / RT_TICK_PER_SECOND;
if (_systick_ms == 0)
{
_systick_ms = 1;
}
}
/**
@@ -71,7 +73,9 @@ void SysTick_Handler(void)
rt_interrupt_enter();
if (SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk)
{
HAL_IncTick();
}
rt_tick_increase();
@@ -82,7 +86,9 @@ void SysTick_Handler(void)
uint32_t HAL_GetTick(void)
{
if (SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk)
{
HAL_IncTick();
}
return uwTick;
}
@@ -118,9 +124,9 @@ void HAL_Delay(__IO uint32_t Delay)
/* re-implement tick interface for STM32 HAL */
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
{
#ifndef SOC_SERIES_STM32MP1
rt_hw_systick_init();
#endif
#ifndef SOC_SERIES_STM32MP1
rt_hw_systick_init();
#endif
/* Return function status */
return HAL_OK;
@@ -177,6 +183,8 @@ void rt_hw_us_delay(rt_uint32_t us)
}
}
void MPU_Config(void);
/**
* This function will initial STM32 board.
*/
+6
View File
@@ -115,6 +115,12 @@ config SOC_SERIES_STM32WB
select SOC_FAMILY_STM32
select PKG_USING_STM32WB_HAL_DRIVER
config SOC_SERIES_STM32N6
bool
select ARCH_ARM_CORTEX_M85
select SOC_FAMILY_STM32
select PKG_USING_STM32N6_HAL_DRIVER
config BOARD_SERIES_STM32_NUCLEO_32
bool
File diff suppressed because it is too large. Load diff
+44
View File
@@ -0,0 +1,44 @@
*.pyc
*.map
*.dblite
*.elf
*.bin
*.hex
*.axf
*.exe
*.pdb
*.idb
*.ilk
*.old
build
Debug
documentation/html
packages/
*~
*.o
*.obj
*.out
*.bak
*.dep
*.lib
*.i
*.d
.DS_Stor*
.config 3
.config 4
.config 5
Midea-X1
*.uimg
GPATH
GRTAGS
GTAGS
.vscode
JLinkLog.txt
JLinkSettings.ini
DebugConfig/
RTE/
settings/
*.uvguix*
cconfig.h
__pycache__
Objects
+28
View File
@@ -0,0 +1,28 @@
mainmenu "RT-Thread Configuration"
BSP_DIR := .
RTT_DIR := ../../..
PKGS_DIR := packages
config SOC_STM32N657
bool
select SOC_SERIES_STM32N6
select RT_USING_COMPONENTS_INIT
select RT_USING_USER_MAIN
select PKG_USING_STM32N657xx_FSBL
default y
config BOARD_STM32N657X0_NUCLEO
bool
select BOARD_SERIES_STM32_NUCLEO_144
default y
source "$(RTT_DIR)/Kconfig"
osource "$PKGS_DIR/Kconfig"
rsource "../libraries/Kconfig"
if !RT_USING_NANO
rsource "board/Kconfig"
endif
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectWorkspace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_mpw.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<WorkspaceName>stm32n657-st-nucleo</WorkspaceName>
<project>
<PathAndName>.\packages\stm32n657xx_fsbl-latest\MDK-ARM\FSBL\stm32n657xx_fsbl.uvprojx</PathAndName>
<NodeIsExpanded>1</NodeIsExpanded>
</project>
<project>
<PathAndName>.\project.uvprojx</PathAndName>
<NodeIsActive>1</NodeIsActive>
<NodeIsExpanded>1</NodeIsExpanded>
</project>
</ProjectWorkspace>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+19
View File
@@ -0,0 +1,19 @@
# for module compiling
import os
Import('env')
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
# STM32N657xx
# You can select chips from the list above
env.Append(CPPDEFINES = ['STM32N657xx', 'USE_HAL_DRIVER'])
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
+75
View File
@@ -0,0 +1,75 @@
import os
import sys
import rtconfig
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
try:
from building import *
except:
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
print(RTT_ROOT)
exit(-1)
def bsp_pkg_check():
import subprocess
check_paths = [
os.path.join("packages", "CMSIS-Core-latest"),
os.path.join("packages", "stm32n6_cmsis_driver-latest"),
os.path.join("packages", "stm32n6_hal_driver-latest"),
os.path.join("packages", "stm32n657xx_fsbl-latest")
]
need_update = not all(os.path.exists(p) for p in check_paths)
if need_update:
print("\n===============================================================================")
print("Dependency packages missing, please running 'pkgs --update'...")
print("If no packages are fetched, run 'pkgs --upgrade' first, then 'pkgs --update'...")
print("===============================================================================")
exit(1)
RegisterPreBuildingAction(bsp_pkg_check)
TARGET = 'rt-thread.' + rtconfig.TARGET_EXT
DefaultEnvironment(tools=[])
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
if rtconfig.PLATFORM in ['iccarm']:
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
env.Replace(ARFLAGS = [''])
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rt-thread.map')
Export('env')
Export('RTT_ROOT')
Export('rtconfig')
SDK_ROOT = os.path.abspath('./')
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
rtconfig.BSP_LIBRARY_TYPE = None
# include drivers
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'),variant_dir='build/libraries/HAL_Drivers', duplicate=0))
# make a building
DoBuilding(TARGET, objs)
@@ -0,0 +1,114 @@
@echo off
chcp 65001 >nul 2>&1
setlocal enabledelayedexpansion
:: ===================== 用户可配置参数 ======================
set "ORIGIN_BIN=rtthread.bin"
set "SIGNED_BIN=rtthread-trusted.bin"
set "SIGN_TOOL=STM32_SigningTool_CLI.exe"
set "FLASH_TOOL=STM32_Programmer_CLI"
set "FLASH_ADDR=0x70100000"
echo.
echo ==========================================================
echo STM32N6 固件签名下载工具
echo ==========================================================
echo ⚠ 请确认:Boot0 = 0,Boot1 = 1,设备处于 Develop 模式
echo 正在检查工具与文件...
:: ===================== 依赖检查 =====================
if not exist "%ORIGIN_BIN%" (
echo [错误] 未找到固件文件:%ORIGIN_BIN%
echo 请先完成编译生成固件。
pause
exit /b 1
)
where %SIGN_TOOL% >nul 2>&1 || (
echo [错误] 签名工具未找到:%SIGN_TOOL%
echo 请确保该工具已加入系统 PATH。
pause
exit /b 1
)
where %FLASH_TOOL% >nul 2>&1 || (
echo [错误] 下载工具未找到:%FLASH_TOOL%
echo 请确保 STM32CubeProgrammer 已加入 PATH。
pause
exit /b 1
)
if not defined N6570_ExternalLoader (
echo [错误] 外部加载器环境变量未配置:N6570_ExternalLoader
echo 请正确设置 External Loader 路径。
pause
exit /b 1
)
echo [OK] 所有依赖检查通过!
:: ===================== 删除旧签名文件 =====================
echo.
echo ----------------------------------------------------------
echo 1/3 清理旧签名固件...
echo ----------------------------------------------------------
if exist "%SIGNED_BIN%" (
echo [提示] 检测到旧文件:%SIGNED_BIN%
echo [处理] 正在删除旧文件...
del /f /q /a "%SIGNED_BIN%" >nul 2>&1
if exist "%SIGNED_BIN%" (
echo [错误] 无法删除旧签名文件(可能被占用)
echo 请关闭相关程序后重试。
pause
exit /b 1
)
echo [OK] 旧签名文件已删除
) else (
echo [OK] 无需清理
)
:: ===================== 固件签名 =====================
echo.
echo ----------------------------------------------------------
echo 2/3 正在为固件生成安全签名...
echo ----------------------------------------------------------
echo [执行] %SIGN_TOOL% -bin "%ORIGIN_BIN%" -nk -of 0x80000000 -t fsbl -o "%SIGNED_BIN%" -hv 2.3 -dump "%SIGNED_BIN%" --align
%SIGN_TOOL% -bin "%ORIGIN_BIN%" -nk -of 0x80000000 -t fsbl -o "%SIGNED_BIN%" -hv 2.3 -dump "%SIGNED_BIN%" --align
if not exist "%SIGNED_BIN%" (
echo [错误] 签名失败!未生成:%SIGNED_BIN%
pause
exit /b 1
)
echo [OK] 签名完成!输出文件:%SIGNED_BIN%
:: ===================== 下载固件 =====================
echo.
echo ----------------------------------------------------------
echo 3/3 正在下载固件到 Flash 地址:%FLASH_ADDR%
echo ----------------------------------------------------------
echo [执行] %FLASH_TOOL% -c port=SWD mode=HOTPLUG ap=1 -el "%N6570_ExternalLoader%" -hardRst -w "%SIGNED_BIN%" %FLASH_ADDR%
%FLASH_TOOL% -c port=SWD mode=HOTPLUG ap=1 -el "%N6570_ExternalLoader%" -hardRst -w "%SIGNED_BIN%" %FLASH_ADDR%
if %errorlevel% equ 0 (
echo.
echo ==========================================================
echo ✔ 固件已成功烧录!
echo ⚠ 请切换启动方式为:Boot0 = 0,Boot1 = 0(Flash 启动)
echo ==========================================================
) else (
echo.
echo [错误] 烧录失败,请检查:
echo 1. SWD 连接是否正常
echo 2. External Loader 路径是否正确
echo 3. 芯片是否上电、BOOT 模式是否正确
)
echo.
pause
endlocal
@@ -0,0 +1,15 @@
from building import *
import os
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-11-24 WangShun first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
/* defined the LED3 pin: PG0 */
#define LED3_PIN GET_PIN(G, 0)
int main(void)
{
/* set LED0 pin mode to output */
rt_pin_mode(LED3_PIN, PIN_MODE_OUTPUT);
while (1)
{
rt_pin_write(LED3_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED3_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
}
@@ -0,0 +1,65 @@
[FSBL:PreviousGenFiles]
HeaderPath=..\FSBL\Inc
HeaderFiles=stm32n6xx_it.h;stm32n6xx_hal_conf.h;main.h;
SourcePath=..\FSBL\Src
SourceFiles=stm32n6xx_it.c;stm32n6xx_hal_msp.c;main.c;
[FSBL:PreviousLibFiles]
LibFiles=Drivers\CMSIS\Device\ST\STM32N6xx\Include\stm32n657xx.h;Drivers\CMSIS\Device\ST\STM32N6xx\Include\stm32n6xx.h;Drivers\CMSIS\Device\ST\STM32N6xx\Include\system_stm32n6xx.h;Drivers\CMSIS\Device\ST\STM32N6xx\Source\Templates\system_stm32n6xx.c;Drivers\CMSIS\Include\cachel1_armv7.h;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_armclang_ltm.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv81mml.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm35p.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm55.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_cm85.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\core_starmc1.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\pac_armv81.h;Drivers\CMSIS\Include\pmu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
[FSBL:PreviousUsedKeilFiles]
SourceFiles=..\Drivers\CMSIS\Device\ST\STM32N6xx\Source\Templates\system_stm32n6xx.c;;;
HeaderPath=..\Drivers\CMSIS\Device\ST\STM32N6xx\Include;..\Drivers\CMSIS\Include;..\Drivers\CMSIS\Device\ST\STM32N6xx\Include;..\Drivers\CMSIS\Include;
CDefines=USE_HAL_DRIVER;STM32N657xx;USE_HAL_DRIVER;USE_HAL_DRIVER;USE_HAL_DRIVER;
[Appli:PreviousLibFiles]
LibFiles=Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_cortex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_cortex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rif.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rcc.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rcc_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_bus.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_rcc.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_system.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_utils.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_gpio.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_gpio_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_gpio.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_dma.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_dma_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_dma.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_pwr.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_pwr_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_pwr.h;Drivers\CMSIS\Device\ST\STM32N6xx\Include\partition_stm32n6xx.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_def.h;Drivers\STM32N6xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_exti.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_exti.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_spi.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_spi_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_tim.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_tim.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_tim_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_uart.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_usart.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_lpuart.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_uart_ex.h;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_cortex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rif.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_gpio.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_exti.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart_ex.c;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_cortex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_cortex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rif.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rcc.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rcc_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_bus.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_rcc.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_system.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_utils.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_gpio.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_gpio_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_gpio.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_dma.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_dma_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_dma.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_pwr.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_pwr_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_pwr.h;Drivers\CMSIS\Device\ST\STM32N6xx\Include\partition_stm32n6xx.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_def.h;Drivers\STM32N6xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_exti.h;Drivers\STM32N6xx_HAL_DLine truncated
[Appli:PreviousUsedKeilFiles]
SourceFiles=..\Appli\Src\main.c;..\Appli\Src\stm32n6xx_it.c;..\Appli\Src\stm32n6xx_hal_msp.c;..\Appli\Src\secure_nsc.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_cortex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rif.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_gpio.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_exti.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart_ex.c;..\Drivers\CMSIS\Device\ST\STM32N6xx\Source\Templates\system_stm32n6xx.c;;;
HeaderPath=..\Drivers\STM32N6xx_HAL_Driver\Inc;..\Drivers\CMSIS\Device\ST\STM32N6xx\Include;..\Drivers\STM32N6xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Include;..\Appli\Inc;..\Secure_nsclib;..\Drivers\STM32N6xx_HAL_Driver\Inc;..\Drivers\CMSIS\Device\ST\STM32N6xx\Include;..\Drivers\STM32N6xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Include;
CDefines=USE_HAL_DRIVER;STM32N657xx;USE_HAL_DRIVER;USE_HAL_DRIVER;USE_HAL_DRIVER;
[ExtMemLoader:PreviousLibFiles]
LibFiles=Drivers\CMSIS\Device\ST\STM32N6xx\Include\stm32n657xx.h;Drivers\CMSIS\Device\ST\STM32N6xx\Include\stm32n6xx.h;Drivers\CMSIS\Device\ST\STM32N6xx\Include\system_stm32n6xx.h;Drivers\CMSIS\Device\ST\STM32N6xx\Source\Templates\system_stm32n6xx.c;Drivers\CMSIS\Include\cachel1_armv7.h;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_armclang_ltm.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv81mml.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm35p.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm55.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_cm85.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\core_starmc1.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\pac_armv81.h;Drivers\CMSIS\Include\pmu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
[ExtMemLoader:PreviousUsedKeilFiles]
SourceFiles=..\Drivers\CMSIS\Device\ST\STM32N6xx\Source\Templates\system_stm32n6xx.c;;;
HeaderPath=..\Drivers\CMSIS\Device\ST\STM32N6xx\Include;..\Drivers\CMSIS\Include;..\Drivers\CMSIS\Device\ST\STM32N6xx\Include;..\Drivers\CMSIS\Include;
CDefines=STM32N657xx;
[PreviousLibFiles]
LibFiles=Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_cortex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_cortex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rif.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rcc.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rcc_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_bus.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_rcc.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_system.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_utils.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_gpio.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_gpio_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_gpio.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_dma.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_dma_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_dma.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_pwr.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_pwr_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_pwr.h;Drivers\CMSIS\Device\ST\STM32N6xx\Include\partition_stm32n6xx.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_def.h;Drivers\STM32N6xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_exti.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_exti.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_spi.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_spi_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_tim.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_tim.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_tim_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_uart.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_usart.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_lpuart.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_uart_ex.h;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_cortex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rif.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_gpio.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_exti.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim_ex.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart.c;Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart_ex.c;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_cortex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_cortex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rif.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rcc.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_rcc_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_bus.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_rcc.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_system.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_utils.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_gpio.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_gpio_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_gpio.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_dma.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_dma_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_dma.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_pwr.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_pwr_ex.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_ll_pwr.h;Drivers\CMSIS\Device\ST\STM32N6xx\Include\partition_stm32n6xx.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_def.h;Drivers\STM32N6xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32N6xx_HAL_Driver\Inc\stm32n6xx_hal_exti.h;Drivers\STM32N6xx_HAL_DLine truncated
[PreviousUsedKeilFiles]
SourceFiles=..\Appli\Src\main.c;..\Appli\Src\stm32n6xx_it.c;..\Appli\Src\stm32n6xx_hal_msp.c;..\Appli\Src\secure_nsc.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_cortex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rif.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_gpio.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_exti.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart_ex.c;..\Drivers\CMSIS\Device\ST\STM32N6xx\Source\Templates\system_stm32n6xx_s.c;..\Src\system_stm32n6xx_s.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_cortex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rif.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_rcc_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_gpio.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_dma_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_pwr_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_exti.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_spi_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_tim_ex.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart.c;..\Drivers\STM32N6xx_HAL_Driver\Src\stm32n6xx_hal_uart_ex.c;..\Drivers\CMSIS\Device\ST\STM32N6xx\Source\Templates\system_stm32n6xx_s.c;..\Src\system_stm32n6xx_s.c;..\Drivers\CMSIS\Device\ST\STM32N6xx\Source\Templates\system_stm32n6xx.c;..\FSBL\\Src\;..\Appli\\Src\system_stm32n6xx_s.c;..\ExtMemLoader\\Src\;;;
HeaderPath=..\Drivers\STM32N6xx_HAL_Driver\Inc;..\Drivers\CMSIS\Device\ST\STM32N6xx\Include;..\Drivers\STM32N6xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Include;..\Appli\Inc;..\Secure_nsclib;
CDefines=USE_HAL_DRIVER;STM32N657xx;USE_HAL_DRIVER;USE_HAL_DRIVER;USE_HAL_DRIVER;USE_HAL_DRIVER;STM32N657xx;USE_HAL_DRIVER;USE_HAL_DRIVER;USE_HAL_DRIVER;STM32N657xx;USE_HAL_DRIVER;
[FSBL:]
SourceFiles=;;
CDefines=USE_HAL_DRIVER;STM32N657xx;USE_HAL_DRIVER;
[Appli:]
SourceFiles=;;
CDefines=USE_HAL_DRIVER;STM32N657xx;USE_HAL_DRIVER;
[ExtMemLoader:]
SourceFiles=;;
CDefines=STM32N657xx;
[]
SourceFiles=;;
[Appli:PreviousGenFiles]
HeaderPath=..\Appli\Inc
HeaderFiles=stm32n6xx_it.h;stm32n6xx_hal_conf.h;main.h;partition_stm32n657xx.h;secure_nsc.h;
SourcePath=..\Appli\Src
SourceFiles=stm32n6xx_it.c;stm32n6xx_hal_msp.c;main.c;secure_nsc.c;
[PreviousGenFiles]
HeaderPath=..\Appli\Inc
HeaderFiles=stm32n6xx_it.h;stm32n6xx_hal_conf.h;main.h;partition_stm32n657xx.h;secure_nsc.h;
SourcePath=..\Appli\Src
SourceFiles=stm32n6xx_it.c;stm32n6xx_hal_msp.c;main.c;secure_nsc.c;
@@ -0,0 +1,89 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined ( __ICCARM__ )
# define CMSE_NS_CALL __cmse_nonsecure_call
# define CMSE_NS_ENTRY __cmse_nonsecure_entry
#else
# define CMSE_NS_CALL __attribute((cmse_nonsecure_call))
# define CMSE_NS_ENTRY __attribute((cmse_nonsecure_entry))
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32n6xx_hal.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* Function pointer declaration in non-secure*/
#if defined ( __ICCARM__ )
typedef void (CMSE_NS_CALL *funcptr)(void);
#else
typedef void CMSE_NS_CALL (*funcptr)(void);
#endif
/* typedef for non-secure callback functions */
typedef funcptr funcptr_NS;
/* USER CODE BEGIN ET */
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
/* USER CODE END EM */
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
#ifdef __cplusplus
}
#endif
#endif /* __MAIN_H */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,69 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32n6xx_it.h
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32N6xx_IT_H
#define __STM32N6xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
/* USER CODE END EM */
/* Exported functions prototypes ---------------------------------------------*/
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SecureFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void TIM2_IRQHandler(void);
void SPI5_IRQHandler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
#ifdef __cplusplus
}
#endif
#endif /* __STM32N6xx_IT_H */
@@ -0,0 +1,78 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file Secure/Src/secure_nsc.c
* @author MCD Application Team
* @brief This file contains the non-secure callable APIs (secure world)
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* USER CODE BEGIN Non_Secure_CallLib */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "secure_nsc.h"
/** @addtogroup STM32N6xx_HAL_Examples
* @{
*/
/** @addtogroup Templates
* @{
*/
/* Global variables ----------------------------------------------------------*/
void *pSecureFaultCallback = NULL; /* Pointer to secure fault callback in Non-secure */
void *pSecureErrorCallback = NULL; /* Pointer to secure error callback in Non-secure */
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/**
* @brief Secure registration of non-secure callback.
* @param CallbackId callback identifier
* @param func pointer to non-secure function
* @retval None
*/
CMSE_NS_ENTRY void SECURE_RegisterCallback(SECURE_CallbackIDTypeDef CallbackId, void *func)
{
if(func != NULL)
{
switch(CallbackId)
{
case SECURE_FAULT_CB_ID: /* SecureFault Interrupt occurred */
pSecureFaultCallback = func;
break;
case GTZC_ERROR_CB_ID: /* GTZC Interrupt occurred */
pSecureErrorCallback = func;
break;
default:
/* unknown */
break;
}
}
}
/**
* @}
*/
/**
* @}
*/
/* USER CODE END Non_Secure_CallLib */
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,46 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file Secure_nsclib/secure_nsc.h
* @author MCD Application Team
* @brief Header for secure non-secure callable APIs list
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* USER CODE BEGIN Non_Secure_CallLib_h */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef SECURE_NSC_H
#define SECURE_NSC_H
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/* Exported types ------------------------------------------------------------*/
/**
* @brief non-secure callback ID enumeration definition
*/
typedef enum
{
SECURE_FAULT_CB_ID = 0x00U, /*!< System secure fault callback ID */
GTZC_ERROR_CB_ID = 0x01U /*!< GTZC secure error callback ID */
} SECURE_CallbackIDTypeDef;
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void SECURE_RegisterCallback(SECURE_CallbackIDTypeDef CallbackId, void *func);
#endif /* SECURE_NSC_H */
/* USER CODE END Non_Secure_CallLib_h */
+114
View File
@@ -0,0 +1,114 @@
menu "Hardware Drivers Config"
menu "Onboard Peripheral Drivers"
endmenu
menu "On-chip Peripheral Drivers"
config BSP_SCB_ENABLE_I_CACHE
bool "Enable ICACHE"
default y
config BSP_SCB_ENABLE_D_CACHE
bool "Enable DCACHE"
default y
config BSP_USING_GPIO
bool "Enable GPIO"
select RT_USING_PIN
default y
menuconfig BSP_USING_UART
bool "Enable UART"
default y
select RT_USING_SERIAL
if BSP_USING_UART
config BSP_STM32_UART_V1_TX_TIMEOUT
int "UART TX timeout"
default 6000
depends on RT_USING_SERIAL_V1
menuconfig BSP_USING_UART1
bool "Enable UART1"
default y
if BSP_USING_UART1
config BSP_UART1_RX_BUFSIZE
int "Set UART1 RX buffer size"
range 64 65535
depends on RT_USING_SERIAL_V2
default 256
config BSP_UART1_TX_BUFSIZE
int "Set UART1 TX buffer size"
range 0 65535
depends on RT_USING_SERIAL_V2
default 0
endif
endif
menuconfig BSP_USING_SPI
bool "Enable SPI BUS"
default n
select RT_USING_SPI
if BSP_USING_SPI
config BSP_USING_SPI5
bool "Enable SPI5 BUS"
default n
config BSP_SPI5_TX_USING_DMA
bool "Enable SPI5 TX DMA"
depends on BSP_USING_SPI5
default n
config BSP_SPI5_RX_USING_DMA
bool "Enable SPI5 RX DMA"
depends on BSP_USING_SPI5
select BSP_SPI5_TX_USING_DMA
default n
endif
menuconfig BSP_USING_PWM
bool "Enable PWM"
default n
select RT_USING_PWM
if BSP_USING_PWM
menuconfig BSP_USING_PWM1
bool "Enable timer1 output PWM"
default n
if BSP_USING_PWM1
config BSP_USING_PWM1_CH1
bool "Enable PWM1 channel1"
default n
config BSP_USING_PWM1_CH2
bool "Enable PWM1 channel2"
default n
config BSP_USING_PWM1_CH3
bool "Enable PWM1 channel3"
default n
config BSP_USING_PWM1_CH4
bool "Enable PWM1 channel4"
default n
endif
endif
menuconfig BSP_USING_TIM
bool "Enable timer"
default n
select RT_USING_CLOCK_TIME
if BSP_USING_TIM
config BSP_USING_TIM2
bool "Enable TIM2"
default n
endif
source "$(BSP_DIR)/../libraries/HAL_Drivers/drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
endmenu
endmenu
@@ -0,0 +1,28 @@
import os
from building import *
Import('rtconfig')
cwd = GetCurrentDir()
src = Split('''
board.c
CubeMX_Config/Appli/Src/secure_nsc.c
CubeMX_Config/Appli/Src/stm32n6xx_hal_msp.c
''')
path = [cwd]
path += [os.path.join(cwd, 'CubeMX_Config', 'Appli', 'Inc')]
path += [os.path.join(cwd, 'CubeMX_Config', 'Secure_nsclib')]
# STM32N657xx
# You can select chips from the list above
CPPDEFINES = ['STM32N657xx']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')
+109
View File
@@ -0,0 +1,109 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-11-24 WangShun first version
*/
#include "board.h"
/**
* @brief System Clock Configuration
* @retval None
*/
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = { 0 };
RCC_ClkInitTypeDef RCC_ClkInitStruct = { 0 };
/** Configure the System Power Supply
*/
if (HAL_PWREx_ConfigSupply(PWR_EXTERNAL_SOURCE_SUPPLY) != HAL_OK)
{
Error_Handler();
}
/** Configure the main internal regulator output voltage
*/
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
{
Error_Handler();
}
/* Enable HSI */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL1.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.PLL2.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.PLL3.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.PLL4.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Get current CPU/System buses clocks configuration and if necessary switch
to intermediate HSI clock to ensure target clock can be set
*/
HAL_RCC_GetClockConfig(&RCC_ClkInitStruct);
if ((RCC_ClkInitStruct.CPUCLKSource == RCC_CPUCLKSOURCE_IC1) ||
(RCC_ClkInitStruct.SYSCLKSource == RCC_SYSCLKSOURCE_IC2_IC6_IC11))
{
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_CPUCLK | RCC_CLOCKTYPE_SYSCLK);
RCC_ClkInitStruct.CPUCLKSource = RCC_CPUCLKSOURCE_HSI;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct) != HAL_OK)
{
/* Initialization Error */
Error_Handler();
}
}
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_NONE;
RCC_OscInitStruct.PLL1.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL1.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL1.PLLM = 4;
RCC_OscInitStruct.PLL1.PLLN = 75;
RCC_OscInitStruct.PLL1.PLLFractional = 0;
RCC_OscInitStruct.PLL1.PLLP1 = 1;
RCC_OscInitStruct.PLL1.PLLP2 = 1;
RCC_OscInitStruct.PLL2.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.PLL3.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.PLL4.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_CPUCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 | RCC_CLOCKTYPE_PCLK5 | RCC_CLOCKTYPE_PCLK4;
RCC_ClkInitStruct.CPUCLKSource = RCC_CPUCLKSOURCE_IC1;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_IC2_IC6_IC11;
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV1;
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV1;
RCC_ClkInitStruct.APB5CLKDivider = RCC_APB5_DIV1;
RCC_ClkInitStruct.IC1Selection.ClockSelection = RCC_ICCLKSOURCE_PLL1;
RCC_ClkInitStruct.IC1Selection.ClockDivider = 2;
RCC_ClkInitStruct.IC2Selection.ClockSelection = RCC_ICCLKSOURCE_PLL1;
RCC_ClkInitStruct.IC2Selection.ClockDivider = 3;
RCC_ClkInitStruct.IC6Selection.ClockSelection = RCC_ICCLKSOURCE_PLL1;
RCC_ClkInitStruct.IC6Selection.ClockDivider = 4;
RCC_ClkInitStruct.IC11Selection.ClockSelection = RCC_ICCLKSOURCE_PLL1;
RCC_ClkInitStruct.IC11Selection.ClockDivider = 3;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct) != HAL_OK)
{
Error_Handler();
}
}
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-11-5 SummerGift first version
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include <rtthread.h>
#include "stm32n6xx.h"
#include "drv_common.h"
#include "drv_gpio.h"
#ifdef __cplusplus
extern "C" {
#endif
#define STM32_FLASH_START_ADRESS ((uint32_t)0x08000000)
#define STM32_FLASH_SIZE (2048 * 1024)
#define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE))
#define STM32_SRAM_SIZE (2048)
#define STM32_SRAM_END (0x34000000 + STM32_SRAM_SIZE * 1024)
#if defined(__ARMCC_VERSION)
extern int Image$$RW_IRAM1$$ZI$$Limit;
#define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
#elif __ICCARM__
#pragma section = "CSTACK"
#define HEAP_BEGIN (__segment_end("CSTACK"))
#else
extern int _ebss;
#define HEAP_BEGIN (&_ebss)
#endif
#define HEAP_END STM32_SRAM_END
void SystemClock_Config(void);
#ifdef __cplusplus
}
#endif
#endif
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,107 @@
#! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m55 -xc
/*--------------------- ROM Configuration ----------------------------------
; <h> ROM Configuration
; <o0> ROM Base Address <0x0-0xFFFFFFFF:8>
; <o1> ROM Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
*----------------------------------------------------------------------------*/
#define __ROM_BASE 0x70100400
#define __ROM_SIZE 0x001DFC00
/*--------------------- Embedded RAM Configuration ---------------------------
; <h> RAM Configuration
; <o0> RAM Base Address <0x0-0xFFFFFFFF:8>
; <o1> RAM Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
*----------------------------------------------------------------------------*/
#define __RAM_BASE 0x34000000
#define __RAM_SIZE 0x00100000
/*--------------------- Stack / Heap Configuration ---------------------------
; <h> Stack / Heap Configuration
; <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
*----------------------------------------------------------------------------*/
#define __STACK_SIZE 0x00000400
#define __HEAP_SIZE 0x00000800
/*
// <h> NOINIT Data Configuration
// <i> specify the size of the section which holds the uninitialized data
// <o0> NOINIT Size (in Bytes) <0x0-0xFFFFFFFF:32>
// </h>
*/
#define __NOINIT_SIZE 0x00000000
/*
// <h> CMSE Veneer Configuration
// <o0> CMSE Veneer Size (in Bytes) <0x0-0xFFFFFFFF:32>
// </h>
*/
#define __CMSEVENEER_SIZE 0x00002000
/*
// <<< end of configuration section >>>
*/
#define __STACKSEAL_SIZE ( 8 )
/*----------------------------------------------------------------------------
User Stack & Heap boundary definition
*----------------------------------------------------------------------------*/
#define __STACK_TOP ( __RAM_BASE + __RAM_SIZE - __STACKSEAL_SIZE ) /* starts at end of RAM - 8 byte stack seal */
#define __HEAP_BASE (AlignExpr(+0, 8)) /* starts after RW_RAM section, 8 byte aligned */
/*----------------------------------------------------------------------------
Scatter File Definitions definition
*----------------------------------------------------------------------------*/
#define __RO_BASE __ROM_BASE
#define __RO_SIZE __ROM_SIZE
#define __CV_BASE ( __ROM_BASE + __ROM_SIZE - __CMSEVENEER_SIZE )
#define __CV_SIZE ( __CMSEVENEER_SIZE )
#define __LR_BASE ( __ROM_BASE )
#define __LR_SIZE ( __ROM_SIZE - __CV_SIZE )
#define __RW_BASE __RAM_BASE
#define __RW_SIZE ( __RAM_SIZE - __STACK_SIZE - __HEAP_SIZE - __NOINIT_SIZE - __STACKSEAL_SIZE )
#define __ER_BASE __RW_BASE + __RW_SIZE
#define __ER_SIZE 0x10000
LR_IROM1 0x70100400 0x001DFC00 { ; load region size_region
ER_IROM1 0x70100400 0x001DFC00 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_IRAM1 0x34000000 0x00100000 { ; RW data
.ANY (+RW +ZI)
}
RW_NONCACHEABLEBUFFER +0 ALIGN 0x4 { ; RW non-cacheable data
.ANY (.noncacheable_buffer)
}
#if __HEAP_SIZE > 0
ARM_LIB_HEAP __HEAP_BASE EMPTY __HEAP_SIZE { ; Reserve empty region for heap
}
#endif
ARM_LIB_STACK __STACK_TOP EMPTY -__STACK_SIZE { ; Reserve empty region for stack
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,107 @@
#! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m55 -xc
/*--------------------- ROM Configuration ----------------------------------
; <h> ROM Configuration
; <o0> ROM Base Address <0x0-0xFFFFFFFF:8>
; <o1> ROM Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
*----------------------------------------------------------------------------*/
#define __ROM_BASE 0x34180400
#define __ROM_SIZE 0x0003FC00
/*--------------------- Embedded RAM Configuration ---------------------------
; <h> RAM Configuration
; <o0> RAM Base Address <0x0-0xFFFFFFFF:8>
; <o1> RAM Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
*----------------------------------------------------------------------------*/
#define __RAM_BASE 0x341C0000
#define __RAM_SIZE 0x00040000
/*--------------------- Stack / Heap Configuration ---------------------------
; <h> Stack / Heap Configuration
; <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
*----------------------------------------------------------------------------*/
#define __STACK_SIZE 0x00000800
#define __HEAP_SIZE 0x00000200
/*
// <h> NOINIT Data Configuration
// <i> specify the size of the section which holds the uninitialized data
// <o0> NOINIT Size (in Bytes) <0x0-0xFFFFFFFF:32>
// </h>
*/
#define __NOINIT_SIZE 0x00000000
/*
// <h> CMSE Veneer Configuration
// <o0> CMSE Veneer Size (in Bytes) <0x0-0xFFFFFFFF:32>
// </h>
*/
#define __CMSEVENEER_SIZE 0x00002000
/*
// <<< end of configuration section >>>
*/
#define __STACKSEAL_SIZE ( 8 )
/*----------------------------------------------------------------------------
User Stack & Heap boundary definition
*----------------------------------------------------------------------------*/
#define __STACK_TOP ( __RAM_BASE + __RAM_SIZE - __STACKSEAL_SIZE ) /* starts at end of RAM - 8 byte stack seal */
#define __HEAP_BASE (AlignExpr(+0, 8)) /* starts after RW_RAM section, 8 byte aligned */
/*----------------------------------------------------------------------------
Scatter File Definitions definition
*----------------------------------------------------------------------------*/
#define __RO_BASE __ROM_BASE
#define __RO_SIZE __ROM_SIZE
#define __CV_BASE ( __ROM_BASE + __ROM_SIZE - __CMSEVENEER_SIZE )
#define __CV_SIZE ( __CMSEVENEER_SIZE )
#define __LR_BASE ( __ROM_BASE )
#define __LR_SIZE ( __ROM_SIZE - __CV_SIZE )
#define __RW_BASE __RAM_BASE
#define __RW_SIZE ( __RAM_SIZE - __STACK_SIZE - __HEAP_SIZE - __NOINIT_SIZE - __STACKSEAL_SIZE )
#define __ER_BASE __RW_BASE + __RW_SIZE
#define __ER_SIZE 0x10000
LR_IROM1 0x34180400 0x0003FC00 { ; load region size_region
ER_IROM1 0x34180400 0x0003FC00 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_IRAM1 0x341C0000 0x00040000 { ; RW data
.ANY (+RW +ZI)
}
RW_NONCACHEABLEBUFFER +0 ALIGN 0x4 { ; RW non-cacheable data
.ANY (.noncacheable)
}
#if __HEAP_SIZE > 0
ARM_LIB_HEAP __HEAP_BASE EMPTY __HEAP_SIZE { ; Reserve empty region for heap
}
#endif
ARM_LIB_STACK __STACK_TOP EMPTY -__STACK_SIZE { ; Reserve empty region for stack
}
}
+117
View File
@@ -0,0 +1,117 @@
@echo off
setlocal
REM ============================================================
REM APP Build Script
REM %1 = AXF file path (#L)
REM %2 = Project path ($P)
REM ============================================================
set "AXF=%~1"
set "PROJECT=%~2"
if not defined AXF (
echo ERROR: AXF path is empty.
exit /b 1
)
if not defined PROJECT (
echo ERROR: Project path is empty.
exit /b 1
)
if not exist "%AXF%" (
echo ERROR: AXF file not found:
echo %AXF%
exit /b 1
)
REM Get AXF directory and filename
for %%F in ("%AXF%") do (
set "AXF_DIR=%%~dpF"
set "AXF_NAME=%%~nxF"
set "BIN_NAME=%%~nF.bin"
)
set "BIN=%AXF_DIR%%BIN_NAME%"
echo.
echo ==========================================
echo APP Build / Sign
echo ==========================================
echo AXF : %AXF%
echo BIN : %BIN%
echo PROJECT : %PROJECT%
echo.
REM ------------------------------------------------------------
REM 1. Check BIN
REM ------------------------------------------------------------
if not exist "%BIN%" (
echo ERROR: BIN file not found:
echo %BIN%
exit /b 1
)
REM ------------------------------------------------------------
REM 2. Copy BIN to project directory
REM ------------------------------------------------------------
echo Copying BIN...
copy /Y "%BIN%" "%PROJECT%\"
if errorlevel 1 (
echo ERROR: Failed to copy BIN.
exit /b 1
)
REM ------------------------------------------------------------
REM 3. Sign APP
REM ------------------------------------------------------------
echo.
echo Signing APP...
where STM32_SigningTool_CLI.exe >nul 2>&1
if errorlevel 1 (
echo ERROR: STM32_SigningTool_CLI.exe not found.
exit /b 1
)
if exist "%PROJECT%\rtthread-trusted.bin" (
del /f /q "%PROJECT%\rtthread-trusted.bin" >nul 2>&1
if exist "%PROJECT%\rtthread-trusted.bin" (
echo ERROR: Cannot remove old signed APP image.
exit /b 1
)
)
STM32_SigningTool_CLI.exe ^
-bin "%PROJECT%\%BIN_NAME%" ^
-nk ^
-of 0x80000000 ^
-t fsbl ^
-o "%PROJECT%\rtthread-trusted.bin" ^
-hv 2.3 ^
-dump "%PROJECT%\rtthread-trusted.bin" ^
--align
if errorlevel 1 (
echo.
echo ERROR: Signing failed.
exit /b 1
)
if not exist "%PROJECT%\rtthread-trusted.bin" (
echo.
echo ERROR: Signed APP image was not generated.
exit /b 1
)
echo.
echo ==========================================
echo APP build and signing completed.
echo Output:
echo %PROJECT%\rtthread-trusted.bin
echo ==========================================
endlocal
exit /b 0
Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

@@ -0,0 +1,114 @@
@echo off
chcp 65001 >nul 2>&1
setlocal enabledelayedexpansion
:: ===================== 用户可配置参数 ======================
set "ORIGIN_BIN=stm32n657xx_fsbl.bin"
set "SIGNED_BIN=stm32n657xx_fsbl-trusted.bin"
set "SIGN_TOOL=STM32_SigningTool_CLI.exe"
set "FLASH_TOOL=STM32_Programmer_CLI"
set "FLASH_ADDR=0x70000000"
echo.
echo ==========================================================
echo STM32N6 固件签名下载工具
echo ==========================================================
echo ⚠ 请确认:Boot0 = 0,Boot1 = 1,设备处于 Develop 模式
echo 正在检查工具与文件...
:: ===================== 依赖检查 =====================
if not exist "%ORIGIN_BIN%" (
echo [错误] 未找到固件文件:%ORIGIN_BIN%
echo 请先完成编译生成固件。
pause
exit /b 1
)
where %SIGN_TOOL% >nul 2>&1 || (
echo [错误] 签名工具未找到:%SIGN_TOOL%
echo 请确保该工具已加入系统 PATH。
pause
exit /b 1
)
where %FLASH_TOOL% >nul 2>&1 || (
echo [错误] 下载工具未找到:%FLASH_TOOL%
echo 请确保 STM32CubeProgrammer 已加入 PATH。
pause
exit /b 1
)
if not defined N6570_ExternalLoader (
echo [错误] 外部加载器环境变量未配置:N6570_ExternalLoader
echo 请正确设置 External Loader 路径。
pause
exit /b 1
)
echo [OK] 所有依赖检查通过!
:: ===================== 删除旧签名文件 =====================
echo.
echo ----------------------------------------------------------
echo 1/3 清理旧签名固件...
echo ----------------------------------------------------------
if exist "%SIGNED_BIN%" (
echo [提示] 检测到旧文件:%SIGNED_BIN%
echo [处理] 正在删除旧文件...
del /f /q /a "%SIGNED_BIN%" >nul 2>&1
if exist "%SIGNED_BIN%" (
echo [错误] 无法删除旧签名文件(可能被占用)
echo 请关闭相关程序后重试。
pause
exit /b 1
)
echo [OK] 旧签名文件已删除
) else (
echo [OK] 无需清理
)
:: ===================== 固件签名 =====================
echo.
echo ----------------------------------------------------------
echo 2/3 正在为固件生成安全签名...
echo ----------------------------------------------------------
echo [执行] %SIGN_TOOL% -bin "%ORIGIN_BIN%" -nk -of 0x80000000 -t fsbl -o "%SIGNED_BIN%" -hv 2.3 -dump "%SIGNED_BIN%" --align
%SIGN_TOOL% -bin "%ORIGIN_BIN%" -nk -of 0x80000000 -t fsbl -o "%SIGNED_BIN%" -hv 2.3 -dump "%SIGNED_BIN%" --align
if not exist "%SIGNED_BIN%" (
echo [错误] 签名失败!未生成:%SIGNED_BIN%
pause
exit /b 1
)
echo [OK] 签名完成!输出文件:%SIGNED_BIN%
:: ===================== 下载固件 =====================
echo.
echo ----------------------------------------------------------
echo 3/3 正在下载固件到 Flash 地址:%FLASH_ADDR%
echo ----------------------------------------------------------
echo [执行] %FLASH_TOOL% -c port=SWD mode=HOTPLUG ap=1 -el "%N6570_ExternalLoader%" -hardRst -w "%SIGNED_BIN%" %FLASH_ADDR%
%FLASH_TOOL% -c port=SWD mode=HOTPLUG ap=1 -el "%N6570_ExternalLoader%" -hardRst -w "%SIGNED_BIN%" %FLASH_ADDR%
if %errorlevel% equ 0 (
echo.
echo ==========================================================
echo ✔ 固件已成功烧录!
echo ⚠ 请切换启动方式为:Boot0 = 0,Boot1 = 0(Flash 启动)
echo ==========================================================
) else (
echo.
echo [错误] 烧录失败,请检查:
echo 1. SWD 连接是否正常
echo 2. External Loader 路径是否正确
echo 3. 芯片是否上电、BOOT 模式是否正确
)
echo.
pause
endlocal
@@ -0,0 +1,77 @@
@echo off
setlocal
REM ============================================================
REM APP Programming Script
REM %1 = Project path ($P)
REM ============================================================
set "PROJECT=%~1"
if not defined PROJECT (
echo ERROR: Project path is empty.
exit /b 1
)
if not exist "%PROJECT%\" (
echo ERROR: Project directory not found:
echo %PROJECT%
exit /b 1
)
REM APP signed image directory
set "APP_BIN=%PROJECT%\rtthread-trusted.bin"
set "FLASH_ADDR=0x70100000"
echo.
echo ==========================================
echo APP Programming
echo ==========================================
echo APP BIN : %APP_BIN%
echo Address : %FLASH_ADDR%
echo.
REM ------------------------------------------------------------
REM 1. Check signed APP image
REM ------------------------------------------------------------
if not exist "%APP_BIN%" (
echo ERROR: Signed APP image not found:
echo %APP_BIN%
exit /b 1
)
where STM32_Programmer_CLI.exe >nul 2>&1
if errorlevel 1 (
echo ERROR: STM32_Programmer_CLI.exe not found.
exit /b 1
)
if not defined N6570_ExternalLoader (
echo ERROR: N6570_ExternalLoader is not defined.
exit /b 1
)
REM ------------------------------------------------------------
REM 2. Program APP to external flash
REM ------------------------------------------------------------
echo Programming APP...
STM32_Programmer_CLI.exe ^
-c port=SWD mode=HOTPLUG ap=1 ^
-el "%N6570_ExternalLoader%" ^
-hardRst ^
-w "%APP_BIN%" %FLASH_ADDR%
if errorlevel 1 (
echo.
echo ERROR: APP programming failed.
exit /b 1
)
echo.
echo ==========================================
echo APP programming completed successfully.
echo ==========================================
endlocal
exit /b 0
File diff suppressed because it is too large. Load diff
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\project.ewp</path>
</project>
<batchBuild/>
</workspace>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+185
View File
@@ -0,0 +1,185 @@
import os
# toolchains options
ARCH='arm'
CPU='cortex-m85'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = r'C:\Users\XXYYZZ'
elif CROSS_TOOL == 'keil':
PLATFORM = 'armclang'
EXEC_PATH = r'C:/Keil_v5'
elif CROSS_TOOL == 'iar':
PLATFORM = 'iccarm'
EXEC_PATH = r'C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.3'
if os.getenv('RTT_EXEC_PATH') and CROSS_TOOL == 'gcc':
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
BUILD = 'debug'
if PLATFORM == 'gcc':
# toolchains
PREFIX = 'arm-none-eabi-'
CC = PREFIX + 'gcc'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
CXX = PREFIX + 'g++'
LINK = PREFIX + 'gcc'
TARGET_EXT = 'elf'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -march=armv8.1-m.main -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -mcmse -ffunction-sections -fdata-sections'
CFLAGS = DEVICE + ' -Dgcc' + ' -DDEBUG -DUSE_HAL_DRIVER -DSTM32N657xx -DUSE_NUCLEO_64 -Wall -fstack-usage -mcmse -Wno-tautological-compare'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb -DDEBUG '
LFLAGS = DEVICE + ' -mcpu=cortex-m55 -Wl,--gc-sections,-Map=rtthread.map,-cref -T board/linker_scripts/link_app.ld' + ' -Wl,--gc-sections -static -Wl,--cmse-implib -Wl,--out-implib=./secure_nsclib.o -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -Wl,--end-group'
CPATH = ''
LPATH = ''
if BUILD == 'debug':
CFLAGS += ' -O0 -g3'
AFLAGS += ' -g3 '
else:
CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
CFLAGS += ' -std=c99'
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
# GCC
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
TARGET_EXT = 'axf'
DEVICE = ' --cpu Cortex-M55.fp.sp'
CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --gnu11 -Wno-pointer-bool-conversion -Wno-tautological-compare'
AFLAGS = DEVICE + ' --apcs=interwork '
LFLAGS = DEVICE + ' --scatter "board/linker_scripts/link_app.sct" --info sizes --info totals --info unused --info veneers --list rtthread.map --strict'
CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/include'
LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCC/lib'
CFLAGS += ' -D__MICROLIB '
AFLAGS += ' --pd "__MICROLIB SETA 1" '
LFLAGS += ' --library_type=microlib '
EXEC_PATH += '/ARM/ARMCC/bin/'
if BUILD == 'debug':
CFLAGS += ' -g -O0'
AFLAGS += ' -g'
else:
CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
CFLAGS += ' -std=c99'
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'armclang':
# toolchains
CC = 'armclang'
CXX = 'armclang'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
TARGET_EXT = 'axf'
DEVICE = ' --cpu Cortex-M55.fp.sp '
CFLAGS = ' --target=arm-arm-none-eabi -mcpu=cortex-M55 '
CFLAGS += ' -mcpu=cortex-M55 -mfpu=fpv4-sp-d16 '
CFLAGS += ' -mfloat-abi=hard -c -fno-rtti -funsigned-char -fshort-enums -fshort-wchar -Wno-pointer-bool-conversion -Wno-tautological-compare'
CFLAGS += ' -gdwarf-3 -ffunction-sections '
AFLAGS = DEVICE + ' --apcs=interwork '
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers '
LFLAGS += ' --list rt-thread.map '
LFLAGS += r' --strict --scatter "board/linker_scripts/link_app.sct" '
CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCLANG/include'
LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCLANG/lib'
EXEC_PATH += '/ARM/ARMCLANG/bin/'
if BUILD == 'debug':
CFLAGS += ' -g -O1' # armclang recommend
AFLAGS += ' -g'
else:
CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
CFLAGS += ' -std=gnu11'
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iccarm':
# toolchains
CC = 'iccarm'
CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
TARGET_EXT = 'out'
DEVICE = '-Dewarm'
CFLAGS = DEVICE
CFLAGS += ' --diag_suppress Pa050'
CFLAGS += ' --no_cse'
CFLAGS += ' --no_unroll'
CFLAGS += ' --no_inline'
CFLAGS += ' --no_code_motion'
CFLAGS += ' --no_tbaa'
CFLAGS += ' --no_clustering'
CFLAGS += ' --no_scheduling'
CFLAGS += ' --endian=little'
CFLAGS += ' --cpu=Cortex-M55'
CFLAGS += ' -e'
CFLAGS += ' --fpu=VFPv5_sp'
CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
CFLAGS += ' --silent'
AFLAGS = DEVICE
AFLAGS += ' -s+'
AFLAGS += ' -w+'
AFLAGS += ' -r'
AFLAGS += ' --cpu Cortex-M55'
AFLAGS += ' --fpu VFPv5_sp'
AFLAGS += ' -S'
if BUILD == 'debug':
CFLAGS += ' --debug'
CFLAGS += ' -On'
else:
CFLAGS += ' -Oh'
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
CXXFLAGS = CFLAGS
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
def dist_handle(BSP_ROOT, dist_dir):
import sys
cwd_path = os.getcwd()
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
from sdk_dist import dist_do_building
dist_do_building(BSP_ROOT, dist_dir)
@@ -0,0 +1,7 @@
LOAD .\fsbl\stm32n657xx_fsbl.axf INCREMENTAL
PC = _RDWORD(0x34180404); // Set Program Counter to Reset_Handler() address
G
LOAD .\Objects\rtthread.axf CLEAR INCREMENTAL NOCODE
PC = _RDWORD(0x70100404);
G,main
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\template.ewp</path>
</project>
<batchBuild/>
</workspace>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+8
View File
@@ -2390,6 +2390,14 @@ stm32/stm32mp157a-st-ev1:
mdk5: true
menuconfig: true
rtconfig.h: true
stm32/stm32n657-st-nucleo:
.config: true
README.md: true
gcc: arm-none-eabi-gcc
iar: true
mdk5: true
menuconfig: true
rtconfig.h: true
stm32/stm32u575-st-nucleo:
.config: true
README.md: true
+1
View File
@@ -301,6 +301,7 @@ arm-none-eabi-gcc:
- stm32/stm32l552-st-nucleo
- stm32/stm32mp157a-st-discovery
- stm32/stm32mp157a-st-ev1
- stm32/stm32n657-st-nucleo
- stm32/stm32u575-st-nucleo
- stm32/stm32u585-iot02a
- stm32/stm32wb55-st-nucleo