Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cpu/stm32/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,19 @@ ifeq (,$(filter STM32MP157Cxx STM32F030x4,$(CPU_LINE)))
# package so they are hardcoded in RIOTs codebase.
# For other lines, the IRQs are automatically generated once from the whole
# list of CMSIS headers available in a given family
STM32IRQS_INCLUDE_FILE = $(RIOTCPU)/stm32/include/irqs/$(CPU_FAM)/irqs.h
STM32IRQS_INCLUDE_FILE = $(RIOTCPU)/stm32/include/irqs/$(CPU_FAM)/stm32_irqs.h
BUILDDEPS += $(STM32IRQS_INCLUDE_FILE)
INCLUDES += -I$(RIOTCPU)/stm32/include/irqs/$(CPU_FAM)
endif

# The IRQ header for a given family requires the family headers to be fetched
# before since it's generated from all CMSIS content of that family
$(STM32IRQS_INCLUDE_FILE): $(STM32FAM_INCLUDE_FILE)
$(Q)$(RIOTBASE)/cpu/stm32/dist/irqs/gen_irqs.py $(STM32CMSIS_INCLUDE_DIR) $(CPU_FAM)
@# TODO: remove the following after the 2026.01 release branch has been
@# created.
@# Cleaning up any previously generated irqs.h; this file now is stm32_irqs.h
-@rm -f $(RIOTCPU)/stm32/include/irqs/$(CPU_FAM)/irqs.h

# Include clock configuration directory
INCLUDES += -I$(RIOTCPU)/stm32/include/clk
Expand Down
5 changes: 4 additions & 1 deletion cpu/stm32/dist/irqs/gen_irqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"RIOTBASE", os.path.abspath(os.path.join(CURRENT_DIR, "../../../..")))
STM32_INCLUDE_DIR = os.path.join(RIOTBASE, "cpu/stm32/include")
STM32_IRQS_DIR = os.path.join(
RIOTBASE, STM32_INCLUDE_DIR, "irqs/{}/irqs.h")
RIOTBASE, STM32_INCLUDE_DIR, "irqs/{}/stm32_irqs.h")

IRQS_FORMAT = """
/*
Expand All @@ -31,6 +31,8 @@
#ifndef IRQS_{cpu_fam}_H
#define IRQS_{cpu_fam}_H

#include "{cpu_fam_include}"

#ifdef __cplusplus
extern "C" {{
#endif
Expand Down Expand Up @@ -122,6 +124,7 @@ def generate_irqs(context):
irqs_content = IRQS_FORMAT.format(
cpu_fam=context["cpu_fam"].upper(),
irq_lines="\n".join(irq_lines),
cpu_fam_include="stm32{}xx.h".format(context["cpu_fam"])
)
dest_file = os.path.join(STM32_IRQS_DIR.format(context["cpu_fam"]))

Expand Down
53 changes: 2 additions & 51 deletions cpu/stm32/include/cpu_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,57 +24,8 @@
#include "vendor/stm32f030x4.h"
#elif defined(CPU_LINE_STM32MP157Cxx)
#include "vendor/stm32mp157cxx_cm4.h"
#elif CPU_FAM_STM32F0
#include "stm32f0xx.h"
#include "irqs/f0/irqs.h"
#elif CPU_FAM_STM32F1
#include "stm32f1xx.h"
#include "irqs/f1/irqs.h"
#elif CPU_FAM_STM32F2
#include "stm32f2xx.h"
#include "irqs/f2/irqs.h"
#elif CPU_FAM_STM32F3
#include "stm32f3xx.h"
#include "irqs/f3/irqs.h"
#elif CPU_FAM_STM32F4
#include "stm32f4xx.h"
#include "irqs/f4/irqs.h"
#elif CPU_FAM_STM32F7
#include "stm32f7xx.h"
#include "irqs/f7/irqs.h"
#elif CPU_FAM_STM32G0
#include "stm32g0xx.h"
#include "irqs/g0/irqs.h"
#elif CPU_FAM_STM32C0
#include "stm32c0xx.h"
#include "irqs/c0/irqs.h"
#elif CPU_FAM_STM32G4
#include "stm32g4xx.h"
#include "irqs/g4/irqs.h"
#elif CPU_FAM_STM32L0
#include "stm32l0xx.h"
#include "irqs/l0/irqs.h"
#elif CPU_FAM_STM32L1
#include "stm32l1xx.h"
#include "irqs/l1/irqs.h"
#elif CPU_FAM_STM32L4
#include "stm32l4xx.h"
#include "irqs/l4/irqs.h"
#elif CPU_FAM_STM32L5
#include "stm32l5xx.h"
#include "irqs/l5/irqs.h"
#elif CPU_FAM_STM32U5
#include "stm32u5xx.h"
#include "irqs/u5/irqs.h"
#define NUM_HEAPS 3
#elif CPU_FAM_STM32WB
#include "stm32wbxx.h"
#include "irqs/wb/irqs.h"
#elif CPU_FAM_STM32WL
#include "stm32wlxx.h"
#include "irqs/wl/irqs.h"
#else
#error Not supported CPU family
#include "stm32_irqs.h"
#endif

/* add unused backup RAM as extra heap */
Expand All @@ -101,7 +52,7 @@ extern "C" {
* @{
*/
#define CPU_DEFAULT_IRQ_PRIO (1U)
/* STM32MP1 family has no flah */
/* STM32MP1 family has no flash */
#if !defined(CPU_FAM_STM32MP1)
#define CPU_FLASH_BASE FLASH_BASE
#endif
Expand Down