diff --git a/demos/AT32/RT-AT-START-F402/cfg/chconf.h b/demos/AT32/RT-AT-START-F402/cfg/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/demos/AT32/RT-AT-START-F402/cfg/chconf.h
+++ b/demos/AT32/RT-AT-START-F402/cfg/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/demos/AT32/RT-AT-START-F402/cfg/config.h b/demos/AT32/RT-AT-START-F402/cfg/config.h
index 1e7c044f47..74e0f4980d 100644
--- a/demos/AT32/RT-AT-START-F402/cfg/config.h
+++ b/demos/AT32/RT-AT-START-F402/cfg/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F402/cfg/halconf.h b/demos/AT32/RT-AT-START-F402/cfg/halconf.h
index 686340adc1..e14d333e84 100644
--- a/demos/AT32/RT-AT-START-F402/cfg/halconf.h
+++ b/demos/AT32/RT-AT-START-F402/cfg/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/demos/AT32/RT-AT-START-F402/cfg/halconf_community.h b/demos/AT32/RT-AT-START-F402/cfg/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/demos/AT32/RT-AT-START-F402/cfg/halconf_community.h
+++ b/demos/AT32/RT-AT-START-F402/cfg/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F402/cfg/mcuconf.h b/demos/AT32/RT-AT-START-F402/cfg/mcuconf.h
index ca518f729d..848414c49b 100644
--- a/demos/AT32/RT-AT-START-F402/cfg/mcuconf.h
+++ b/demos/AT32/RT-AT-START-F402/cfg/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +229,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/demos/AT32/RT-AT-START-F402/main.c b/demos/AT32/RT-AT-START-F402/main.c
index 1d8790d591..30a3246dea 100644
--- a/demos/AT32/RT-AT-START-F402/main.c
+++ b/demos/AT32/RT-AT-START-F402/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F405/cfg/chconf.h b/demos/AT32/RT-AT-START-F405/cfg/chconf.h
index 17c627b0e5..e87d2f17e6 100644
--- a/demos/AT32/RT-AT-START-F405/cfg/chconf.h
+++ b/demos/AT32/RT-AT-START-F405/cfg/chconf.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -52,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -64,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -73,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -142,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -622,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -645,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -657,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -694,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -710,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -730,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -740,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -751,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -775,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -785,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/demos/AT32/RT-AT-START-F405/cfg/config.h b/demos/AT32/RT-AT-START-F405/cfg/config.h
index d1e4494978..4eec5f91bc 100644
--- a/demos/AT32/RT-AT-START-F405/cfg/config.h
+++ b/demos/AT32/RT-AT-START-F405/cfg/config.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F405/cfg/halconf.h b/demos/AT32/RT-AT-START-F405/cfg/halconf.h
index cc78b430a7..30ccd649f7 100644
--- a/demos/AT32/RT-AT-START-F405/cfg/halconf.h
+++ b/demos/AT32/RT-AT-START-F405/cfg/halconf.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -71,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -308,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -531,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/demos/AT32/RT-AT-START-F405/cfg/halconf_community.h b/demos/AT32/RT-AT-START-F405/cfg/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/demos/AT32/RT-AT-START-F405/cfg/halconf_community.h
+++ b/demos/AT32/RT-AT-START-F405/cfg/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F405/cfg/mcuconf.h b/demos/AT32/RT-AT-START-F405/cfg/mcuconf.h
index 11d5d29972..1f7abf108b 100644
--- a/demos/AT32/RT-AT-START-F405/cfg/mcuconf.h
+++ b/demos/AT32/RT-AT-START-F405/cfg/mcuconf.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -230,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/demos/AT32/RT-AT-START-F405/main.c b/demos/AT32/RT-AT-START-F405/main.c
index 02d637cbd1..959a666856 100644
--- a/demos/AT32/RT-AT-START-F405/main.c
+++ b/demos/AT32/RT-AT-START-F405/main.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F415/cfg/chconf.h b/demos/AT32/RT-AT-START-F415/cfg/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/demos/AT32/RT-AT-START-F415/cfg/chconf.h
+++ b/demos/AT32/RT-AT-START-F415/cfg/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/demos/AT32/RT-AT-START-F415/cfg/config.h b/demos/AT32/RT-AT-START-F415/cfg/config.h
index 056a8f39ff..fe19c2eb77 100644
--- a/demos/AT32/RT-AT-START-F415/cfg/config.h
+++ b/demos/AT32/RT-AT-START-F415/cfg/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F415/cfg/halconf.h b/demos/AT32/RT-AT-START-F415/cfg/halconf.h
index 686340adc1..e14d333e84 100644
--- a/demos/AT32/RT-AT-START-F415/cfg/halconf.h
+++ b/demos/AT32/RT-AT-START-F415/cfg/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/demos/AT32/RT-AT-START-F415/cfg/halconf_community.h b/demos/AT32/RT-AT-START-F415/cfg/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/demos/AT32/RT-AT-START-F415/cfg/halconf_community.h
+++ b/demos/AT32/RT-AT-START-F415/cfg/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F415/cfg/mcuconf.h b/demos/AT32/RT-AT-START-F415/cfg/mcuconf.h
index 86ad2e5cf1..a35d193fd5 100644
--- a/demos/AT32/RT-AT-START-F415/cfg/mcuconf.h
+++ b/demos/AT32/RT-AT-START-F415/cfg/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/demos/AT32/RT-AT-START-F415/main.c b/demos/AT32/RT-AT-START-F415/main.c
index 1d8790d591..30a3246dea 100644
--- a/demos/AT32/RT-AT-START-F415/main.c
+++ b/demos/AT32/RT-AT-START-F415/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F435/cfg/chconf.h b/demos/AT32/RT-AT-START-F435/cfg/chconf.h
index 17c627b0e5..e87d2f17e6 100644
--- a/demos/AT32/RT-AT-START-F435/cfg/chconf.h
+++ b/demos/AT32/RT-AT-START-F435/cfg/chconf.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -52,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -64,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -73,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -142,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -622,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -645,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -657,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -694,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -710,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -730,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -740,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -751,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -775,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -785,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/demos/AT32/RT-AT-START-F435/cfg/config.h b/demos/AT32/RT-AT-START-F435/cfg/config.h
index d1e4494978..4eec5f91bc 100644
--- a/demos/AT32/RT-AT-START-F435/cfg/config.h
+++ b/demos/AT32/RT-AT-START-F435/cfg/config.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F435/cfg/halconf.h b/demos/AT32/RT-AT-START-F435/cfg/halconf.h
index cc78b430a7..30ccd649f7 100644
--- a/demos/AT32/RT-AT-START-F435/cfg/halconf.h
+++ b/demos/AT32/RT-AT-START-F435/cfg/halconf.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -71,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -308,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -531,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/demos/AT32/RT-AT-START-F435/cfg/halconf_community.h b/demos/AT32/RT-AT-START-F435/cfg/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/demos/AT32/RT-AT-START-F435/cfg/halconf_community.h
+++ b/demos/AT32/RT-AT-START-F435/cfg/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F435/cfg/mcuconf.h b/demos/AT32/RT-AT-START-F435/cfg/mcuconf.h
index 2a68be60d3..b8c0cb8b3f 100644
--- a/demos/AT32/RT-AT-START-F435/cfg/mcuconf.h
+++ b/demos/AT32/RT-AT-START-F435/cfg/mcuconf.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -256,6 +256,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/demos/AT32/RT-AT-START-F435/main.c b/demos/AT32/RT-AT-START-F435/main.c
index 02d637cbd1..959a666856 100644
--- a/demos/AT32/RT-AT-START-F435/main.c
+++ b/demos/AT32/RT-AT-START-F435/main.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F437/cfg/chconf.h b/demos/AT32/RT-AT-START-F437/cfg/chconf.h
index 17c627b0e5..e87d2f17e6 100644
--- a/demos/AT32/RT-AT-START-F437/cfg/chconf.h
+++ b/demos/AT32/RT-AT-START-F437/cfg/chconf.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -52,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -64,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -73,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -142,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -622,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -645,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -657,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -694,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -710,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -730,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -740,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -751,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -775,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -785,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/demos/AT32/RT-AT-START-F437/cfg/config.h b/demos/AT32/RT-AT-START-F437/cfg/config.h
index d1e4494978..4eec5f91bc 100644
--- a/demos/AT32/RT-AT-START-F437/cfg/config.h
+++ b/demos/AT32/RT-AT-START-F437/cfg/config.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F437/cfg/halconf.h b/demos/AT32/RT-AT-START-F437/cfg/halconf.h
index cc78b430a7..30ccd649f7 100644
--- a/demos/AT32/RT-AT-START-F437/cfg/halconf.h
+++ b/demos/AT32/RT-AT-START-F437/cfg/halconf.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -71,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -308,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -531,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/demos/AT32/RT-AT-START-F437/cfg/halconf_community.h b/demos/AT32/RT-AT-START-F437/cfg/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/demos/AT32/RT-AT-START-F437/cfg/halconf_community.h
+++ b/demos/AT32/RT-AT-START-F437/cfg/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/demos/AT32/RT-AT-START-F437/cfg/mcuconf.h b/demos/AT32/RT-AT-START-F437/cfg/mcuconf.h
index f7cd9c8d3f..8f59aa9003 100644
--- a/demos/AT32/RT-AT-START-F437/cfg/mcuconf.h
+++ b/demos/AT32/RT-AT-START-F437/cfg/mcuconf.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -256,6 +256,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/demos/AT32/RT-AT-START-F437/main.c b/demos/AT32/RT-AT-START-F437/main.c
index 02d637cbd1..959a666856 100644
--- a/demos/AT32/RT-AT-START-F437/main.c
+++ b/demos/AT32/RT-AT-START-F437/main.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/AT32F402_405/hal_lld.c b/os/hal/ports/AT32/AT32F402_405/hal_lld.c
index 3745b3d2fe..04cd3fa05f 100644
--- a/os/hal/ports/AT32/AT32F402_405/hal_lld.c
+++ b/os/hal/ports/AT32/AT32F402_405/hal_lld.c
@@ -334,7 +334,7 @@ void at32_reduce_power_consumption(void) {
CRM->PLLCFG |= CRM_PLLCFG_PLLU_EN;
while ((!(CRM->CTRL & CRM_CTRL_PLLSTBL)) || (!(CRM->CTRL & CRM_CTRL_PLLUSTBL)))
;
- CRM->OTGHS = 0x10;
+ CRM->OTGHS = CRM_OTGHS_USBHS_PHY12_SEL;
} else {
/* PLL or HEXT need to be enable.*/
return;
diff --git a/os/hal/ports/AT32/AT32F402_405/hal_lld.h b/os/hal/ports/AT32/AT32F402_405/hal_lld.h
index 0df244ec6c..26daa162a1 100644
--- a/os/hal/ports/AT32/AT32F402_405/hal_lld.h
+++ b/os/hal/ports/AT32/AT32F402_405/hal_lld.h
@@ -1129,6 +1129,17 @@
#error "invalid AT32_PLLU_USB48_SEL value specified"
#endif
+#if (HAL_USE_USB && defined(AT32_USB_USE_OTG2) && AT32_USB_USE_OTG2) || \
+ defined(__DOXYGEN__)
+#if !AT32_HEXT_ENABLED
+#error "HEXT not enabled, required by OTGHS PHY"
+#endif
+
+#if AT32_HEXTCLK != 12000000
+#error "OTGHS PHY requires AT32_HEXTCLK == 12000000"
+#endif
+#endif
+
/**
* @brief Timers 2, 3, 4, 6, 7, 13, 14 clock.
*/
diff --git a/os/hal/ports/AT32/LLD/ADCv1/hal_adc_lld.c b/os/hal/ports/AT32/LLD/ADCv1/hal_adc_lld.c
index a9878487ce..35213f5684 100644
--- a/os/hal/ports/AT32/LLD/ADCv1/hal_adc_lld.c
+++ b/os/hal/ports/AT32/LLD/ADCv1/hal_adc_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2026 HorrorTroll
- ChibiOS - Copyright (C) 2023..2026 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -57,26 +57,24 @@ ADCDriver ADCD1;
*/
static void adc_lld_serve_rx_interrupt(ADCDriver *adcp, uint32_t flags) {
+ /* An ADC error or a callback may already have stopped the conversion.*/
+ if ((adcp->grpp == NULL) || (adcp->state != ADC_ACTIVE)) {
+ return;
+ }
+
/* DMA errors handling.*/
if ((flags & AT32_DMA_STS_DTERRF) != 0) {
/* DMA, this could help only if the DMA tries to access an unmapped
address space or violates alignment rules.*/
_adc_isr_error_code(adcp, ADC_ERR_DMAFAILURE);
}
- else {
- /* It is possible that the conversion group has already be reset by the
- ADC error handler, in this case this interrupt is spurious.*/
- if (adcp->grpp != NULL) {
-
- if ((flags & AT32_DMA_STS_FDTF) != 0) {
- /* Transfer complete processing.*/
- _adc_isr_full_code(adcp);
- }
- else if ((flags & AT32_DMA_STS_HDTF) != 0) {
- /* Half transfer processing.*/
- _adc_isr_half_code(adcp);
- }
- }
+ else if ((flags & AT32_DMA_STS_FDTF) != 0) {
+ /* Transfer complete takes priority over a pending half transfer.*/
+ _adc_isr_full_code(adcp);
+ }
+ else if ((flags & AT32_DMA_STS_HDTF) != 0) {
+ /* Half transfer processing.*/
+ _adc_isr_half_code(adcp);
}
}
diff --git a/os/hal/ports/AT32/LLD/ADCv1/hal_adc_lld.h b/os/hal/ports/AT32/LLD/ADCv1/hal_adc_lld.h
index 3ffc0f4191..b1d11826cd 100644
--- a/os/hal/ports/AT32/LLD/ADCv1/hal_adc_lld.h
+++ b/os/hal/ports/AT32/LLD/ADCv1/hal_adc_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/ADCv2/hal_adc_lld.c b/os/hal/ports/AT32/LLD/ADCv2/hal_adc_lld.c
index c5e2d8652d..7bb340f61a 100644
--- a/os/hal/ports/AT32/LLD/ADCv2/hal_adc_lld.c
+++ b/os/hal/ports/AT32/LLD/ADCv2/hal_adc_lld.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2026 HorrorTroll
- ChibiOS - Copyright (C) 2023..2026 Zhaqian
- ChibiOS - Copyright (C) 2024..2026 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -58,26 +58,24 @@ ADCDriver ADCD1;
*/
static void adc_lld_serve_rx_interrupt(ADCDriver *adcp, uint32_t flags) {
+ /* An ADC error or a callback may already have stopped the conversion.*/
+ if ((adcp->grpp == NULL) || (adcp->state != ADC_ACTIVE)) {
+ return;
+ }
+
/* DMA errors handling.*/
if ((flags & AT32_DMA_STS_DTERRF) != 0) {
/* DMA, this could help only if the DMA tries to access an unmapped
address space or violates alignment rules.*/
_adc_isr_error_code(adcp, ADC_ERR_DMAFAILURE);
}
- else {
- /* It is possible that the conversion group has already be reset by the
- ADC error handler, in this case this interrupt is spurious.*/
- if (adcp->grpp != NULL) {
-
- if ((flags & AT32_DMA_STS_FDTF) != 0) {
- /* Transfer complete processing.*/
- _adc_isr_full_code(adcp);
- }
- else if ((flags & AT32_DMA_STS_HDTF) != 0) {
- /* Half transfer processing.*/
- _adc_isr_half_code(adcp);
- }
- }
+ else if ((flags & AT32_DMA_STS_FDTF) != 0) {
+ /* Transfer complete takes priority over a pending half transfer.*/
+ _adc_isr_full_code(adcp);
+ }
+ else if ((flags & AT32_DMA_STS_HDTF) != 0) {
+ /* Half transfer processing.*/
+ _adc_isr_half_code(adcp);
}
}
diff --git a/os/hal/ports/AT32/LLD/ADCv2/hal_adc_lld.h b/os/hal/ports/AT32/LLD/ADCv2/hal_adc_lld.h
index 317805ad73..650fd05817 100644
--- a/os/hal/ports/AT32/LLD/ADCv2/hal_adc_lld.h
+++ b/os/hal/ports/AT32/LLD/ADCv2/hal_adc_lld.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/CRCv1/hal_crc_lld.c b/os/hal/ports/AT32/LLD/CRCv1/hal_crc_lld.c
index 5bac9f273a..3a59e4ef4f 100644
--- a/os/hal/ports/AT32/LLD/CRCv1/hal_crc_lld.c
+++ b/os/hal/ports/AT32/LLD/CRCv1/hal_crc_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2015 Michael D. Spradling
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2015 Michael D. Spradling.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/CRCv1/hal_crc_lld.h b/os/hal/ports/AT32/LLD/CRCv1/hal_crc_lld.h
index 1211d61024..8fdb49e706 100644
--- a/os/hal/ports/AT32/LLD/CRCv1/hal_crc_lld.h
+++ b/os/hal/ports/AT32/LLD/CRCv1/hal_crc_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2015 Michael D. Spradling
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2015 Michael D. Spradling.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/DMAv1/at32_dma.c b/os/hal/ports/AT32/LLD/DMAv1/at32_dma.c
index dfd0d9a9f8..c025338872 100644
--- a/os/hal/ports/AT32/LLD/DMAv1/at32_dma.c
+++ b/os/hal/ports/AT32/LLD/DMAv1/at32_dma.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/DMAv1/at32_dma.h b/os/hal/ports/AT32/LLD/DMAv1/at32_dma.h
index a51d80920c..4bbbffc293 100644
--- a/os/hal/ports/AT32/LLD/DMAv1/at32_dma.h
+++ b/os/hal/ports/AT32/LLD/DMAv1/at32_dma.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/DMAv2/at32_dma.c b/os/hal/ports/AT32/LLD/DMAv2/at32_dma.c
index 12177729b0..b76296d7df 100644
--- a/os/hal/ports/AT32/LLD/DMAv2/at32_dma.c
+++ b/os/hal/ports/AT32/LLD/DMAv2/at32_dma.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/DMAv2/at32_dma.h b/os/hal/ports/AT32/LLD/DMAv2/at32_dma.h
index 50636b8d7b..4c5d0c0d68 100644
--- a/os/hal/ports/AT32/LLD/DMAv2/at32_dma.h
+++ b/os/hal/ports/AT32/LLD/DMAv2/at32_dma.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint.c b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint.c
index 581599704e..ae58b501f1 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint.c
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint.h b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint.h
index 5d1d63740b..c60ce8d1c1 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint.h
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint0.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint0.inc
index 8509e2bc4d..ad7241aa08 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint0.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint0.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint1.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint1.inc
index 55db776410..5444d31311 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint1.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint1.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint10_15.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint10_15.inc
index 187575e32e..6921065053 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint10_15.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint10_15.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint16.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint16.inc
index d70fc0930b..208696a347 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint16.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint16.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint17.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint17.inc
index 3db10d47d2..fec91b4ebe 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint17.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint17.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint18.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint18.inc
index 2958493188..2e180e7254 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint18.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint18.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint19.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint19.inc
index 410d23a19e..f77d514dee 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint19.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint19.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint2.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint2.inc
index 910b811a77..4ed85fe734 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint2.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint2.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint20.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint20.inc
index 9bb9836c74..5b90af0512 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint20.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint20.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint21.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint21.inc
index 1ebe7cc30c..ebac89108a 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint21.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint21.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint22.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint22.inc
index 50a0ab2667..9ea3a845b5 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint22.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint22.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint3.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint3.inc
index ff94c82ec5..c5cf000ebc 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint3.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint3.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint4.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint4.inc
index c85f6d11d4..d667a69b5f 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint4.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint4.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint5_9.inc b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint5_9.inc
index e3d41d79e3..3bae3a8119 100644
--- a/os/hal/ports/AT32/LLD/EXINTv1/at32_exint5_9.inc
+++ b/os/hal/ports/AT32/LLD/EXINTv1/at32_exint5_9.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/GPIOv1/hal_pal_lld.c b/os/hal/ports/AT32/LLD/GPIOv1/hal_pal_lld.c
index 0cc258742b..b4fb9587e5 100644
--- a/os/hal/ports/AT32/LLD/GPIOv1/hal_pal_lld.c
+++ b/os/hal/ports/AT32/LLD/GPIOv1/hal_pal_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/GPIOv1/hal_pal_lld.h b/os/hal/ports/AT32/LLD/GPIOv1/hal_pal_lld.h
index 125d3551d1..442e87613c 100644
--- a/os/hal/ports/AT32/LLD/GPIOv1/hal_pal_lld.h
+++ b/os/hal/ports/AT32/LLD/GPIOv1/hal_pal_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/GPIOv2/at32_gpio.h b/os/hal/ports/AT32/LLD/GPIOv2/at32_gpio.h
index fa4ddac1a6..0aee0aa957 100644
--- a/os/hal/ports/AT32/LLD/GPIOv2/at32_gpio.h
+++ b/os/hal/ports/AT32/LLD/GPIOv2/at32_gpio.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/GPIOv2/hal_pal_lld.c b/os/hal/ports/AT32/LLD/GPIOv2/hal_pal_lld.c
index 20d20535ea..6b25bcf376 100644
--- a/os/hal/ports/AT32/LLD/GPIOv2/hal_pal_lld.c
+++ b/os/hal/ports/AT32/LLD/GPIOv2/hal_pal_lld.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/GPIOv2/hal_pal_lld.h b/os/hal/ports/AT32/LLD/GPIOv2/hal_pal_lld.h
index b9727814e7..e7ed9fe226 100644
--- a/os/hal/ports/AT32/LLD/GPIOv2/hal_pal_lld.h
+++ b/os/hal/ports/AT32/LLD/GPIOv2/hal_pal_lld.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/I2Cv1/hal_i2c_lld.c b/os/hal/ports/AT32/LLD/I2Cv1/hal_i2c_lld.c
index 3f3f6b6b91..6575127fd7 100644
--- a/os/hal/ports/AT32/LLD/I2Cv1/hal_i2c_lld.c
+++ b/os/hal/ports/AT32/LLD/I2Cv1/hal_i2c_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -41,37 +41,75 @@
/* Driver constants. */
/*===========================================================================*/
-#define I2C_EV5_MASTER_MODE_SELECT \
- ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF) << 16) | I2C_STS1_STARTF))
+#define I2C_EV5_MASTER_MODE_SELECT \
+ ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF) << 16) | \
+ I2C_STS1_STARTF))
-#define I2C_EV5_MASTER_MODE_SELECT_NO_BUSY \
+#define I2C_EV5_MASTER_MODE_SELECT_NO_BUSY \
((uint32_t)((I2C_STS2_TRMODE << 16) | I2C_STS1_STARTF))
-#define I2C_EV6_MASTER_TRA_MODE_SELECTED \
- ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF | I2C_STS2_DIRF) << 16) | \
+#define I2C_EV6_MASTER_TRA_MODE_SELECTED \
+ ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF | I2C_STS2_DIRF) << 16) | \
I2C_STS1_ADDR7F | I2C_STS1_TDBE))
-#define I2C_EV6_MASTER_REC_MODE_SELECTED \
- ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF) << 16) | I2C_STS1_ADDR7F))
+#define I2C_EV6_MASTER_REC_MODE_SELECTED \
+ ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF) << 16) | \
+ I2C_STS1_ADDR7F))
-#define I2C_EV8_2_MASTER_BYTE_TRANSMITTED \
- ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF | I2C_STS2_DIRF) << 16) | \
+#define I2C_EV8_2_MASTER_BYTE_TRANSMITTED \
+ ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF | I2C_STS2_DIRF) << 16) | \
I2C_STS1_TDC | I2C_STS1_TDBE))
-#define I2C_EV9_MASTER_ADD10 \
- ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF) << 16) | I2C_STS1_ADDRHF))
+#define I2C_EV9_MASTER_ADD10 \
+ ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF) << 16) | \
+ I2C_STS1_ADDRHF))
-#define I2C_EV5_MASTER_MODE_INVALID \
- ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF) << 16) | (I2C_STS1_STARTF | \
- I2C_STS1_STOPF)))
+#define I2C_EV5_MASTER_MODE_INVALID \
+ ((uint32_t)(((I2C_STS2_TRMODE | I2C_STS2_BUSYF) << 16) | \
+ (I2C_STS1_STARTF | I2C_STS1_STOPF)))
#define I2C_EV_MASK 0x00FF00FF
-#define I2C_ERROR_MASK \
- ((uint16_t)(I2C_STS1_BUSERR | I2C_STS1_ARLOST | I2C_STS1_ACKFAIL | \
- I2C_STS1_OUF | I2C_STS1_PECERR | I2C_STS1_TMOUT | \
+#define I2C_ERROR_MASK \
+ ((uint16_t)(I2C_STS1_BUSERR | I2C_STS1_ARLOST | I2C_STS1_ACKFAIL | \
+ I2C_STS1_OUF | I2C_STS1_PECERR | I2C_STS1_TMOUT | \
I2C_STS1_ALERTF))
-
+
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+#define I2C_EV1_SLAVE_RECEIVER_ADDRESS_MATCHED \
+ ((uint32_t)(I2C_STS2_BUSYF << 16) | I2C_STS1_ADDR7F)
+
+#define I2C_EV1_SLAVE_TRANSMITTER_ADDRESS_MATCHED \
+ ((uint32_t)((I2C_STS2_DIRF | I2C_STS2_BUSYF) << 16) | \
+ I2C_STS1_TDBE | I2C_STS1_ADDR7F)
+
+#define I2C_EV1_SLAVE_RECEIVER_SECONDADDRESS_MATCHED \
+ ((uint32_t)(I2C_STS2_ADDR2F | I2C_STS2_BUSYF) << 16)
+
+#define I2C_EV1_SLAVE_TRANSMITTER_SECONDADDRESS_MATCHED \
+ ((uint32_t)((I2C_STS2_ADDR2F | I2C_STS2_DIRF | I2C_STS2_BUSYF) << 16) | \
+ I2C_STS1_TDBE)
+
+#define I2C_EV1_SLAVE_GENERALCALLADDRESS_MATCHED \
+ ((uint32_t)(I2C_STS2_GCADDRF | I2C_STS2_BUSYF) << 16)
+
+#define I2C_EV2_SLAVE_BYTE_RECEIVED \
+ ((uint32_t)(I2C_STS2_BUSYF << 16) | I2C_STS1_RDBF)
+
+#define I2C_EV4_SLAVE_STOP_DETECTED \
+ ((uint32_t) I2C_STS1_STOPF)
+
+#define I2C_EV3_SLAVE_BYTE_TRANSMITTED \
+ ((uint32_t)((I2C_STS2_DIRF | I2C_STS2_BUSYF) << 16) | I2C_STS1_TDBE | \
+ I2C_STS1_TDC)
+
+#define I2C_EV3_SLAVE_BYTE_TRANSMITTING \
+ ((uint32_t)((I2C_STS2_DIRF | I2C_STS2_BUSYF) << 16) | I2C_STS1_TDBE)
+
+#define I2C_EV2_SLAVE_ACK_FAILURE \
+ ((uint32_t) I2C_STS1_ACKFAIL)
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
@@ -218,7 +256,7 @@ static void i2c_lld_set_opmode(I2CDriver *i2cp) {
}
/**
- * @brief I2C shared ISR code.
+ * @brief I2C shared STS code.
*
* @param[in] i2cp pointer to the @p I2CDriver object
*
@@ -274,13 +312,49 @@ static void i2c_lld_serve_event_interrupt(I2CDriver *i2cp) {
i2c_lld_abort_operation(i2cp);
dp->CTRL2 &= ~I2C_CTRL2_EVTIEN;
break;
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ case I2C_EV1_SLAVE_RECEIVER_ADDRESS_MATCHED:
+ dmaStreamEnable(i2cp->dmarx);
+ break;
+ case I2C_EV1_SLAVE_TRANSMITTER_ADDRESS_MATCHED:
+ dp->CTRL1 &= ~I2C_CTRL1_ACKEN;
+ dp->CTRL2 &= ~I2C_CTRL2_EVTIEN;
+ i2cp->reply_required = true;
+ if (i2cp->state == I2C_ACTIVE_RX) {
+ if (dmaStreamGetTransactionSize(i2cp->dmarx)) {
+ dmaStreamDisable(i2cp->dmarx);
+ }
+ _i2c_wakeup_isr(i2cp);
+ }
+ break;
+ // case I2C_EV1_SLAVE_RECEIVER_SECONDADDRESS_MATCHED:
+ // case I2C_EV1_SLAVE_TRANSMITTER_SECONDADDRESS_MATCHED:
+ // case I2C_EV1_SLAVE_GENERALCALLADDRESS_MATCHED:
+ // case I2C_EV2_SLAVE_BYTE_RECEIVED:
+ case I2C_EV4_SLAVE_STOP_DETECTED:
+ if (dmaStreamGetTransactionSize(i2cp->dmarx)) {
+ dmaStreamDisable(i2cp->dmarx);
+ }
+ _i2c_wakeup_isr(i2cp);
+
+ dp->CTRL1 &= ~I2C_CTRL1_ACKEN;
+ dp->CTRL2 &= ~I2C_CTRL2_EVTIEN;
+ break;
+// case I2C_EV3_SLAVE_BYTE_TRANSMITTED:
+ case I2C_EV3_SLAVE_BYTE_TRANSMITTING:
+ dmaStreamEnable(i2cp->dmatx);
+ dp->CTRL2 &= ~I2C_CTRL2_EVTIEN;
+ break;
+//case I2C_EV2_SLAVE_ACK_FAILURE:
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
default:
break;
}
/* Clear ADDR7F flag. */
if (event & (I2C_STS1_ADDR7F | I2C_STS1_ADDRHF))
(void)dp->STS2;
- /* BUSERR flag doesnt happen anymore in event handling */
+
+ /* BUSERR flag doesn't happen anymore in event handling */
#if 0
/* Errata 1.14.2 for AT32F415, I2C communication error when BUSERR is detected on bus.*/
/* Errata 1.4.4 for AT32F403A/7, BUSERR is detected by I2C before start of communication.*/
@@ -296,7 +370,7 @@ static void i2c_lld_serve_event_interrupt(I2CDriver *i2cp) {
* @brief DMA RX end IRQ handler.
*
* @param[in] i2cp pointer to the @p I2CDriver object
- * @param[in] flags pre-shifted content of the ISR register
+ * @param[in] flags pre-shifted content of the STS register
*
* @notapi
*/
@@ -314,10 +388,23 @@ static void i2c_lld_serve_rx_end_irq(I2CDriver *i2cp, uint32_t flags) {
dmaStreamDisable(i2cp->dmarx);
- dp->CTRL2 &= ~I2C_CTRL2_DMAEND;
- dp->CTRL1 &= ~I2C_CTRL1_ACKEN;
- dp->CTRL1 |= I2C_CTRL1_GENSTOP;
- _i2c_wakeup_isr(i2cp);
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ /* If Slave: lines are released by hardware, do nothing
+ If Master: a Stop or repeated Start condition must be generated by software */
+ if (i2cp->isMaster)
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+ {
+ dp->CTRL2 &= ~I2C_CTRL2_DMAEND;
+ dp->CTRL1 &= ~I2C_CTRL1_ACKEN;
+ dp->CTRL1 |= I2C_CTRL1_GENSTOP;
+ _i2c_wakeup_isr(i2cp);
+ }
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ else {
+ dp->CTRL1 |= I2C_CTRL1_ACKEN;
+ dp->CTRL2 |= I2C_CTRL2_EVTIEN;
+ }
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
}
/**
@@ -382,9 +469,24 @@ static void i2c_lld_serve_error_interrupt(I2CDriver *i2cp, uint16_t sts) {
i2cp->errors |= I2C_ARBITRATION_LOST;
if (sts & I2C_STS1_ACKFAIL) { /* Acknowledge failure. */
- i2cp->i2c->CTRL2 &= ~I2C_CTRL2_EVTIEN;
- i2cp->i2c->CTRL1 |= I2C_CTRL1_GENSTOP; /* Generate stop. */
- i2cp->errors |= I2C_ACK_FAILURE;
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ /* If Slave: lines are released by hardware, do nothing
+ If Master: a Stop or repeated Start condition must be generated by software */
+ if (i2cp->isMaster)
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+ {
+ i2cp->i2c->CTRL2 &= ~I2C_CTRL2_EVTIEN;
+ i2cp->i2c->CTRL1 |= I2C_CTRL1_GENSTOP; /* Generate stop. */
+ i2cp->errors |= I2C_ACK_FAILURE;
+ }
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ else {
+ i2cp->i2c->STS1 &= ~I2C_STS1_ACKFAIL;
+ i2cp->i2c->CTRL2 &= ~I2C_CTRL2_DATAIEN;
+ i2cp->reply_required = false;
+ _i2c_wakeup_isr(i2cp);
+ }
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
}
if (sts & I2C_STS1_OUF) /* Overload. */
@@ -544,6 +646,9 @@ void i2c_lld_start(I2CDriver *i2cp) {
i2cp->rxdmamode |= AT32_DMA_CCTRL_CHPL(AT32_I2C_I2C1_DMA_PRIORITY);
i2cp->txdmamode |= AT32_DMA_CCTRL_CHPL(AT32_I2C_I2C1_DMA_PRIORITY);
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ i2cp->reply_required = false;
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
}
#endif /* AT32_I2C_USE_I2C1 */
@@ -573,6 +678,9 @@ void i2c_lld_start(I2CDriver *i2cp) {
i2cp->rxdmamode |= AT32_DMA_CCTRL_CHPL(AT32_I2C_I2C2_DMA_PRIORITY);
i2cp->txdmamode |= AT32_DMA_CCTRL_CHPL(AT32_I2C_I2C2_DMA_PRIORITY);
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ i2cp->reply_required = false;
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
}
#endif /* AT32_I2C_USE_I2C2 */
}
@@ -663,6 +771,10 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr,
osalDbgCheck(rxbytes > 1);
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ i2cp->isMaster = true;
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+
/* Resetting error flags for this transfer.*/
i2cp->errors = I2C_NO_ERROR;
@@ -749,6 +861,10 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr,
osalDbgCheck((rxbytes == 0) || ((rxbytes > 1) && (rxbuf != NULL)));
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ i2cp->isMaster = true;
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+
/* Resetting error flags for this transfer.*/
i2cp->errors = I2C_NO_ERROR;
@@ -807,6 +923,125 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr,
return msg;
}
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+/**
+ * @brief Listen I2C bus for address match.
+ * @details Use 7 bit address.
+ *
+ * @param[in] i2cp pointer to the @p I2CDriver object
+ * @param[in] addr slave device address
+ * .
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more I2C errors occurred, the errors can
+ * be retrieved using @p i2cGetErrors().
+ *
+ * @notapi
+ */
+msg_t i2c_lld_match_address(I2CDriver *i2cp, i2caddr_t addr) {
+ I2C_TypeDef *dp = i2cp->i2c;
+
+ /* Slave mode */
+ i2cp->isMaster = false;
+
+ uint16_t i2cadr = addr << 1;
+ uint16_t ownAdr = dp->OADDR1 & (0x7f << 1);
+
+ if (ownAdr == 0 || ownAdr == i2cadr)
+ /* 14 bit should always be kept at 1 by software */
+ dp->OADDR1 = i2cadr | 0x4000;
+ else
+ /* cannot add this address to set of those matched */
+ return MSG_RESET;
+
+ return MSG_OK;
+}
+
+/**
+ * @brief Receive data via the I2C bus as slave and call handler.
+ *
+ * @param[in] i2cp pointer to the @p I2CDriver object
+ * @param[out] rxbuf pointer to the receive buffer
+ * @param[in] rxbytes size of receive buffer
+ * @param[in] timeout the number of ticks before the operation timeouts,
+ * the following special values are allowed:
+ * - @a TIME_INFINITE no timeout.
+ * .
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more I2C errors occurred, the errors can
+ * be retrieved using @p i2cGetErrors().
+ * @retval MSG_TIMEOUT if a timeout occurred before operation end. After a
+ * timeout the driver must be stopped and restarted
+ * because the bus is in an uncertain state.
+ *
+ * @notapi
+ */
+msg_t i2c_lld_slave_receive_timeout(I2CDriver *i2cp, uint8_t *rxbuf, size_t rxbytes, sysinterval_t timeout) {
+ I2C_TypeDef *dp = i2cp->i2c;
+
+ /* Slave mode */
+ i2cp->isMaster = false;
+
+ /* Reset Reply flag */
+ i2cp->reply_required = false;
+
+ dp->CTRL1 |= I2C_CTRL1_ACKEN;
+ dp->CTRL2 |= I2C_CTRL2_EVTIEN;
+
+ /* RX DMA setup.*/
+ dmaStreamSetMode(i2cp->dmarx, i2cp->rxdmamode);
+ dmaStreamSetMemory0(i2cp->dmarx, rxbuf);
+ dmaStreamSetTransactionSize(i2cp->dmarx, rxbytes);
+
+ /* Waits for the operation completion or a timeout.*/
+ return osalThreadSuspendTimeoutS(&i2cp->thread, timeout);
+}
+
+/**
+ * @brief Transmits data via the I2C bus as slave.
+ * @details Call this function when Master request data (in request handler)
+ *
+ * @param[in] i2cp pointer to the @p I2CDriver object
+ * @param[in] txbuf pointer to the transmit buffer
+ * @param[in] txbytes number of bytes to be transmitted
+ * @param[in] timeout the number of ticks before the operation timeouts,
+ * the following special values are allowed:
+ * - @a TIME_INFINITE no timeout.
+ * .
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more I2C errors occurred, the errors can
+ * be retrieved using @p i2cGetErrors().
+ * @retval MSG_TIMEOUT if a timeout occurred before operation end. After a
+ * timeout the driver must be stopped and restarted
+ * because the bus is in an uncertain state.
+ *
+ * @notapi
+ */
+msg_t i2c_lld_slave_transmit_timeout(I2CDriver *i2cp,
+ const uint8_t *txbuf,
+ size_t txbytes,
+ sysinterval_t timeout) {
+ I2C_TypeDef *dp = i2cp->i2c;
+
+ /* Slave mode */
+ i2cp->isMaster = false;
+
+ /* TX DMA setup.*/
+ dmaStreamSetMode(i2cp->dmatx, i2cp->txdmamode);
+ dmaStreamSetMemory0(i2cp->dmatx, txbuf);
+ dmaStreamSetTransactionSize(i2cp->dmatx, txbytes);
+
+ dp->CTRL1 &= ~I2C_CTRL1_ACKEN;
+ dp->CTRL2 |= I2C_CTRL2_EVTIEN | I2C_CTRL2_DATAIEN;
+
+ /* Waits for the operation completion or a timeout.*/
+ return osalThreadSuspendTimeoutS(&i2cp->thread, timeout);
+}
+
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+
#endif /* HAL_USE_I2C */
/** @} */
diff --git a/os/hal/ports/AT32/LLD/I2Cv1/hal_i2c_lld.h b/os/hal/ports/AT32/LLD/I2Cv1/hal_i2c_lld.h
index cd306f0053..6e8d689da8 100644
--- a/os/hal/ports/AT32/LLD/I2Cv1/hal_i2c_lld.h
+++ b/os/hal/ports/AT32/LLD/I2Cv1/hal_i2c_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -38,6 +38,11 @@
/* Driver constants. */
/*===========================================================================*/
+/**
+ * @brief This I2C LLD supports slave mode.
+ */
+#define I2C_SUPPORTS_SLAVE_MODE TRUE
+
/**
* @brief Peripheral clock frequency.
*/
@@ -292,6 +297,16 @@ struct hal_i2c_driver {
* @brief Pointer to the I2Cx registers block.
*/
I2C_TypeDef *i2c;
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ /**
+ * @brief Master needed a reply.
+ */
+ bool reply_required;
+ /**
+ * @brief Master/Slave mode.
+ */
+ bool isMaster;
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
};
/*===========================================================================*/
@@ -334,6 +349,13 @@ extern "C" {
msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr,
uint8_t *rxbuf, size_t rxbytes,
sysinterval_t timeout);
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ msg_t i2c_lld_match_address(I2CDriver *i2cp, i2caddr_t addr);
+ msg_t i2c_lld_slave_receive_timeout(I2CDriver *i2cp, uint8_t *rxbuf,
+ size_t rxbytes, sysinterval_t timeout);
+ msg_t i2c_lld_slave_transmit_timeout(I2CDriver *i2cp, const uint8_t *txbuf,
+ size_t txbytes, sysinterval_t timeout);
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
#ifdef __cplusplus
}
#endif
diff --git a/os/hal/ports/AT32/LLD/I2Cv2/hal_i2c_lld.c b/os/hal/ports/AT32/LLD/I2Cv2/hal_i2c_lld.c
index 520a895e5e..bd4446520a 100644
--- a/os/hal/ports/AT32/LLD/I2Cv2/hal_i2c_lld.c
+++ b/os/hal/ports/AT32/LLD/I2Cv2/hal_i2c_lld.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -201,14 +201,31 @@ static void i2c_lld_abort_operation(I2CDriver *i2cp) {
static void i2c_lld_serve_interrupt(I2CDriver *i2cp, uint32_t sts) {
I2C_TypeDef *dp = i2cp->i2c;
+#if (AT32_I2C_USE_DMA == FALSE) || (I2C_ENABLE_SLAVE_MODE == TRUE)
+ uint32_t ctrl1 = dp->CTRL1;
+#endif
+
/* Special case of a received ACKFAIL, the transfer is aborted.*/
if ((sts & I2C_STS_ACKFAILF) != 0U) {
+
#if AT32_I2C_USE_DMA == TRUE
/* Stops the associated DMA streams.*/
dmaStreamDisable(i2cp->dmatx);
dmaStreamDisable(i2cp->dmarx);
#endif
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ /* If master is done reading data and indicates this to the slave through a ACKFAIL.*/
+ if (!i2cp->isMaster) {
+ if (i2cp->state == I2C_ACTIVE_TX) {
+ if (((sts & I2C_STS_SDIR) != 0U) && ((sts & I2C_STS_TDIS) != 0U)) {
+ /* Next interrupt is GENSTOP.*/
+ return;
+ }
+ }
+ }
+#endif
+
/* Error flag.*/
i2cp->errors |= I2C_ACK_FAILURE;
@@ -224,11 +241,88 @@ static void i2c_lld_serve_interrupt(I2CDriver *i2cp, uint32_t sts) {
return;
}
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ if (!i2cp->isMaster) {
+ /* Handling I2C Slave */
+ /* Note: (sts & I2C_STS_TDC) is not supported in slave mode.*/
+
+ /* Communication completed.*/
+ if (sts & I2C_STS_STOPF) {
+
+ dp->CTRL1 &= ~I2C_CTRL1_TDIEN;
+ dp->CTRL1 &= ~I2C_CTRL1_RDIEN;
+#if AT32_I2C_USE_DMA == TRUE
+ /* Disabling TX/RX DMA channel */
+ dmaStreamDisable(i2cp->dmatx);
+ dmaStreamDisable(i2cp->dmarx);
+#endif /* AT32_I2C_USE_DMA == TRUE */
+
+ /* Normal transaction end.*/
+ _i2c_wakeup_isr(i2cp);
+
+ return;
+ }
+
+ /* Check slave address match */
+ if (sts & I2C_STS_ADDRF) {
+ /* Check direction */
+ if (sts & I2C_STS_SDIR) {
+ /* Reply required */
+ i2cp->reply_required = true;
+
+ if (i2cp->state == I2C_ACTIVE_RX) {
+ /* Disable interrupt on RX */
+ dp->CTRL1 &= ~I2C_CTRL1_RDIEN;
+#if AT32_I2C_USE_DMA == TRUE
+ dmaStreamDisable(i2cp->dmarx);
+#endif /* AT32_I2C_USE_DMA == TRUE */
+ _i2c_wakeup_isr(i2cp);
+ }
+ }
+ return;
+ }
+
+ if (i2cp->state == I2C_ACTIVE_TX) {
+ /* Transmission phase.*/
+ if (((ctrl1 & I2C_CTRL1_TDIEN) != 0U) && ((sts & I2C_STS_TDIS) != 0U)) {
+#if AT32_I2C_USE_DMA == FALSE
+ /* Handling of data transfer if the DMA mode is disabled.*/
+ dp->TXDT = (uint32_t)*i2cp->txptr;
+ i2cp->txptr++;
+ i2cp->txbytes--;
+ if (i2cp->txbytes == 0U) {
+ dp->CTRL1 &= ~I2C_CTRL1_TDIEN;
+ }
+#else
+ /* Enabling TX DMA.*/
+ dmaStreamEnable(i2cp->dmatx);
+#endif /* AT32_I2C_USE_DMA == FALSE */
+ }
+ }
+ else {
+ /* Receive phase.*/
+ if (((ctrl1 & I2C_CTRL1_RDIEN) != 0U) && ((sts & I2C_STS_RDBF) != 0U)) {
+#if AT32_I2C_USE_DMA == FALSE
+ *i2cp->rxptr = (uint8_t)dp->RXDT;
+ i2cp->rxptr++;
+ i2cp->rxbytes--;
+ if (i2cp->rxbytes == 0U) {
+ dp->CTRL1 &= ~I2C_CTRL1_RDIEN;
+ }
+#else
+ /* Enabling RX DMA.*/
+ dmaStreamEnable(i2cp->dmarx);
+#endif /* AT32_I2C_USE_DMA == FALSE */
+ }
+ }
+
+ return;
+ }
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+
#if AT32_I2C_USE_DMA == FALSE
/* Handling of data transfer if the DMA mode is disabled.*/
{
- uint32_t ctrl1 = dp->CTRL1;
-
if (i2cp->state == I2C_ACTIVE_TX) {
/* Transmission phase.*/
if (((ctrl1 & I2C_CTRL1_TDIEN) != 0U) && ((sts & I2C_STS_TDIS) != 0U)) {
@@ -817,6 +911,10 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr,
I2C_TypeDef *dp = i2cp->i2c;
systime_t start, end;
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ i2cp->isMaster = true;
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+
/* Resetting error flags for this transfer.*/
i2cp->errors = I2C_NO_ERROR;
@@ -923,6 +1021,10 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr,
I2C_TypeDef *dp = i2cp->i2c;
systime_t start, end;
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ i2cp->isMaster = true;
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+
/* Resetting error flags for this transfer.*/
i2cp->errors = I2C_NO_ERROR;
@@ -1005,6 +1107,135 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr,
return msg;
}
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+/**
+ * @brief Listen I2C bus for address match.
+ * @details Use 7 bit address.
+ *
+ * @param[in] i2cp pointer to the @p I2CDriver object
+ * @param[in] addr slave device address
+ * .
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more I2C errors occurred, the errors can
+ * be retrieved using @p i2cGetErrors().
+ *
+ * @notapi
+ */
+msg_t i2c_lld_match_address(I2CDriver *i2cp, i2caddr_t addr) {
+ I2C_TypeDef *dp = i2cp->i2c;
+
+ i2cp->isMaster = false;
+
+ /* Check 7 bit address.*/
+ if ((addr >> 7) == 0) {
+ /* Clean register */
+ dp->OADDR1 = 0;
+ /* ADDR1 bits can be written only when ADDR1EN = 0.*/
+ /* Configure and enable own address 1 */
+ dp->OADDR1 = (addr << 1) | I2C_OADDR1_ADDR1EN;
+ }
+ else {
+ /* cannot add this address to set of those matched */
+ return MSG_RESET;
+ }
+
+ return MSG_OK;
+}
+
+/**
+ * @brief Receive data via the I2C bus as slave and call handler.
+ *
+ * @param[in] i2cp pointer to the @p I2CDriver object
+ * @param[out] rxbuf pointer to the receive buffer
+ * @param[in] rxbytes size of receive buffer
+ * @param[in] timeout the number of ticks before the operation timeouts,
+ * the following special values are allowed:
+ * - @a TIME_INFINITE no timeout.
+ * .
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more I2C errors occurred, the errors can
+ * be retrieved using @p i2cGetErrors().
+ * @retval MSG_TIMEOUT if a timeout occurred before operation end. After a
+ * timeout the driver must be stopped and restarted
+ * because the bus is in an uncertain state.
+ *
+ * @notapi
+ */
+msg_t i2c_lld_slave_receive_timeout(I2CDriver *i2cp, uint8_t *rxbuf, size_t rxbytes, sysinterval_t timeout) {
+ I2C_TypeDef *dp = i2cp->i2c;
+
+ i2cp->isMaster = false;
+
+ /* Reset Reply flag */
+ i2cp->reply_required = false;
+
+#if AT32_I2C_USE_DMA == TRUE
+ /* RX DMA setup.*/
+ dmaStreamSetMode(i2cp->dmarx, i2cp->rxdmamode);
+ dmaStreamSetMemory0(i2cp->dmarx, rxbuf);
+ dmaStreamSetTransactionSize(i2cp->dmarx, rxbytes);
+#else
+ i2cp->rxptr = rxbuf;
+ i2cp->rxbytes = rxbytes;
+#endif
+
+ /* Address match, RX and GENSTOP interrupts enabled.*/
+ dp->CTRL1 |= I2C_CTRL1_ADDRIEN | I2C_CTRL1_RDIEN | I2C_CTRL1_STOPIEN;
+
+ /* Waits for the operation completion or a timeout.*/
+ return osalThreadSuspendTimeoutS(&i2cp->thread, timeout);
+}
+
+/**
+ * @brief Transmits data via the I2C bus as slave.
+ * @details Call this function when Master request data (in request handler)
+ *
+ * @param[in] i2cp pointer to the @p I2CDriver object
+ * @param[in] txbuf pointer to the transmit buffer
+ * @param[in] txbytes number of bytes to be transmitted
+ * @param[in] timeout the number of ticks before the operation timeouts,
+ * the following special values are allowed:
+ * - @a TIME_INFINITE no timeout.
+ * .
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more I2C errors occurred, the errors can
+ * be retrieved using @p i2cGetErrors().
+ * @retval MSG_TIMEOUT if a timeout occurred before operation end. After a
+ * timeout the driver must be stopped and restarted
+ * because the bus is in an uncertain state.
+ *
+ * @notapi
+ */
+msg_t i2c_lld_slave_transmit_timeout(I2CDriver *i2cp,
+ const uint8_t *txbuf,
+ size_t txbytes,
+ sysinterval_t timeout) {
+ I2C_TypeDef *dp = i2cp->i2c;
+
+ i2cp->isMaster = false;
+
+#if AT32_I2C_USE_DMA == TRUE
+ /* TX DMA setup.*/
+ dmaStreamSetMode(i2cp->dmatx, i2cp->txdmamode);
+ dmaStreamSetMemory0(i2cp->dmatx, txbuf);
+ dmaStreamSetTransactionSize(i2cp->dmatx, txbytes);
+#else
+ i2cp->txptr = txbuf;
+ i2cp->txbytes = txbytes;
+#endif
+
+ /* Address match, TX and GENSTOP interrupts enabled.*/
+ dp->CTRL1 |= I2C_CTRL1_ADDRIEN | I2C_CTRL1_TDIEN | I2C_CTRL1_STOPIEN;
+
+ /* Waits for the operation completion or a timeout.*/
+ return osalThreadSuspendTimeoutS(&i2cp->thread, timeout);
+}
+
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
+
#endif /* HAL_USE_I2C */
/** @} */
diff --git a/os/hal/ports/AT32/LLD/I2Cv2/hal_i2c_lld.h b/os/hal/ports/AT32/LLD/I2Cv2/hal_i2c_lld.h
index 619bf3b819..a69c337452 100644
--- a/os/hal/ports/AT32/LLD/I2Cv2/hal_i2c_lld.h
+++ b/os/hal/ports/AT32/LLD/I2Cv2/hal_i2c_lld.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -38,6 +38,11 @@
/* Driver constants. */
/*===========================================================================*/
+/**
+ * @brief This I2C LLD supports slave mode.
+ */
+#define I2C_SUPPORTS_SLAVE_MODE TRUE
+
/**
* @name CLKCTRL register definitions
* @{
@@ -73,7 +78,7 @@
* @note The default is @p FALSE.
*/
#if !defined(AT32_I2C_USE_I2C1) || defined(__DOXYGEN__)
-#define AT32_I2C_USE_I2C1 FALSE
+#define AT32_I2C_USE_I2C1 FALSE
#endif
/**
@@ -82,7 +87,7 @@
* @note The default is @p FALSE.
*/
#if !defined(AT32_I2C_USE_I2C2) || defined(__DOXYGEN__)
-#define AT32_I2C_USE_I2C2 FALSE
+#define AT32_I2C_USE_I2C2 FALSE
#endif
/**
@@ -91,42 +96,42 @@
* @note The default is @p FALSE.
*/
#if !defined(AT32_I2C_USE_I2C3) || defined(__DOXYGEN__)
-#define AT32_I2C_USE_I2C3 FALSE
+#define AT32_I2C_USE_I2C3 FALSE
#endif
/**
* @brief I2C timeout on busy condition in milliseconds.
*/
#if !defined(AT32_I2C_BUSY_TIMEOUT) || defined(__DOXYGEN__)
-#define AT32_I2C_BUSY_TIMEOUT 50
+#define AT32_I2C_BUSY_TIMEOUT 50
#endif
/**
* @brief I2C1 interrupt priority level setting.
*/
#if !defined(AT32_I2C_I2C1_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define AT32_I2C_I2C1_IRQ_PRIORITY 10
+#define AT32_I2C_I2C1_IRQ_PRIORITY 10
#endif
/**
* @brief I2C2 interrupt priority level setting.
*/
#if !defined(AT32_I2C_I2C2_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define AT32_I2C_I2C2_IRQ_PRIORITY 10
+#define AT32_I2C_I2C2_IRQ_PRIORITY 10
#endif
/**
* @brief I2C3 interrupt priority level setting.
*/
#if !defined(AT32_I2C_I2C3_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define AT32_I2C_I2C3_IRQ_PRIORITY 10
+#define AT32_I2C_I2C3_IRQ_PRIORITY 10
#endif
/**
* @brief DMA use switch.
*/
#if !defined(AT32_I2C_USE_DMA) || defined(__DOXYGEN__)
-#define AT32_I2C_USE_DMA TRUE
+#define AT32_I2C_USE_DMA TRUE
#endif
/**
@@ -136,7 +141,7 @@
* over the TX stream.
*/
#if !defined(AT32_I2C_I2C1_DMA_PRIORITY) || defined(__DOXYGEN__)
-#define AT32_I2C_I2C1_DMA_PRIORITY 1
+#define AT32_I2C_I2C1_DMA_PRIORITY 1
#endif
/**
@@ -146,7 +151,7 @@
* over the TX stream.
*/
#if !defined(AT32_I2C_I2C2_DMA_PRIORITY) || defined(__DOXYGEN__)
-#define AT32_I2C_I2C2_DMA_PRIORITY 1
+#define AT32_I2C_I2C2_DMA_PRIORITY 1
#endif
/**
@@ -156,7 +161,7 @@
* over the TX stream.
*/
#if !defined(AT32_I2C_I2C3_DMA_PRIORITY) || defined(__DOXYGEN__)
-#define AT32_I2C_I2C3_DMA_PRIORITY 1
+#define AT32_I2C_I2C3_DMA_PRIORITY 1
#endif
/**
@@ -165,7 +170,7 @@
* error can only happen because programming errors.
*/
#if !defined(AT32_I2C_DMA_ERROR_HOOK) || defined(__DOXYGEN__)
-#define AT32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
+#define AT32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
#endif
/** @} */
@@ -360,6 +365,16 @@ struct hal_i2c_driver {
* @brief Pointer to the I2Cx registers block.
*/
I2C_TypeDef *i2c;
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ /**
+ * @brief Master needed a reply.
+ */
+ bool reply_required;
+ /**
+ * @brief Master/Slave mode.
+ */
+ bool isMaster;
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
};
/*===========================================================================*/
@@ -407,6 +422,13 @@ extern "C" {
msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr,
uint8_t *rxbuf, size_t rxbytes,
sysinterval_t timeout);
+#if (I2C_ENABLE_SLAVE_MODE == TRUE)
+ msg_t i2c_lld_match_address(I2CDriver *i2cp, i2caddr_t addr);
+ msg_t i2c_lld_slave_receive_timeout(I2CDriver *i2cp, uint8_t *rxbuf,
+ size_t rxbytes, sysinterval_t timeout);
+ msg_t i2c_lld_slave_transmit_timeout(I2CDriver *i2cp, const uint8_t *txbuf,
+ size_t txbytes, sysinterval_t timeout);
+#endif /* I2C_ENABLE_SLAVE_MODE == TRUE */
#ifdef __cplusplus
}
#endif
diff --git a/os/hal/ports/AT32/LLD/OTGv1/at32_otg.h b/os/hal/ports/AT32/LLD/OTGv1/at32_otg.h
index cb749d1720..338521d8a5 100644
--- a/os/hal/ports/AT32/LLD/OTGv1/at32_otg.h
+++ b/os/hal/ports/AT32/LLD/OTGv1/at32_otg.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/OTGv1/hal_usb_lld.c b/os/hal/ports/AT32/LLD/OTGv1/hal_usb_lld.c
index 50f2e90232..69ed10ef82 100644
--- a/os/hal/ports/AT32/LLD/OTGv1/hal_usb_lld.c
+++ b/os/hal/ports/AT32/LLD/OTGv1/hal_usb_lld.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -79,11 +79,11 @@ USBDriver USBD2;
/*===========================================================================*/
/**
- * @brief EP0 state.
+ * @brief EP0 transfer state type.
* @note It is an union because IN and OUT endpoints are never used at the
* same time for EP0.
*/
-static union {
+typedef union {
/**
* @brief IN EP0 state.
*/
@@ -92,30 +92,31 @@ static union {
* @brief OUT EP0 state.
*/
USBOutEndpointState out;
-} ep0_state;
+} otg_ep0_state_t;
+#if AT32_USB_USE_OTG1
/**
- * @brief Buffer for the EP0 setup packets.
+ * @brief Private OTG1 EP0 storage, preserving the USBDriver layout.
*/
-static uint8_t ep0setup_buffer[8];
+static otg_ep0_state_t ep0_state1;
+static uint8_t ep0setup_buffer1[8];
/**
- * @brief EP0 initialization structure.
+ * @brief OTG1 EP0 initialization structure.
*/
-static const USBEndpointConfig ep0config = {
+static const USBEndpointConfig ep0config1 = {
USB_EP_MODE_TYPE_CTRL,
_usb_ep0setup,
_usb_ep0in,
_usb_ep0out,
- 0x40,
- 0x40,
- &ep0_state.in,
- &ep0_state.out,
+ EP0_MAX_INSIZE,
+ EP0_MAX_OUTSIZE,
+ &ep0_state1.in,
+ &ep0_state1.out,
1,
- ep0setup_buffer
+ ep0setup_buffer1
};
-#if AT32_USB_USE_OTG1
static const at32_otg_params_t fsparams = {
AT32_USB_OTG1_RX_FIFO_SIZE / 4,
AT32_OTG1_FIFO_MEM_SIZE,
@@ -125,6 +126,28 @@ static const at32_otg_params_t fsparams = {
#endif
#if AT32_USB_USE_OTG2
+/**
+ * @brief Private OTG2 EP0 storage, preserving the USBDriver layout.
+ */
+static otg_ep0_state_t ep0_state2;
+static uint8_t ep0setup_buffer2[8];
+
+/**
+ * @brief OTG2 EP0 initialization structure.
+ */
+static const USBEndpointConfig ep0config2 = {
+ USB_EP_MODE_TYPE_CTRL,
+ _usb_ep0setup,
+ _usb_ep0in,
+ _usb_ep0out,
+ EP0_MAX_INSIZE,
+ EP0_MAX_OUTSIZE,
+ &ep0_state2.in,
+ &ep0_state2.out,
+ 1,
+ ep0setup_buffer2
+};
+
static const at32_otg_params_t hsparams = {
AT32_USB_OTG2_RX_FIFO_SIZE / 4,
AT32_OTG2_FIFO_MEM_SIZE,
@@ -148,13 +171,17 @@ static void otg_core_reset(USBDriver *usbp) {
while ((otgp->GRSTCTL & GRSTCTL_AHBIDLE) == 0)
;
- /* Core reset and delay of at least 3 PHY cycles.*/
+ /* Allow at least 10 PHY clocks after PHY selection before core reset.
+ One microsecond covers both the 48MHz FS and 60MHz HS interfaces.*/
+ osalSysPolledDelayX(OSAL_US2RTC(SystemCoreClock, 1U));
+
+ /* Core reset.*/
otgp->GRSTCTL = GRSTCTL_CSFTRST;
- osalSysPolledDelayX(12);
while ((otgp->GRSTCTL & GRSTCTL_CSFTRST) != 0)
;
- osalSysPolledDelayX(18);
+ /* Wait at least 3 PHY clocks before accessing the PHY clock domain.*/
+ osalSysPolledDelayX(OSAL_US2RTC(SystemCoreClock, 1U));
/* Wait AHB idle condition again.*/
while ((otgp->GRSTCTL & GRSTCTL_AHBIDLE) == 0)
@@ -183,16 +210,26 @@ static void otg_disable_ep(USBDriver *usbp) {
static void otg_enable_ep(USBDriver *usbp) {
at32_otg_t *otgp = usbp->otg;
+ uint32_t daintmsk = 0U;
unsigned i;
+ /* Rebuild endpoint interrupt mask from the active endpoint
+ configurations, this avoids dereferencing not-yet initialized
+ endpoint entries during early SOF/WKUP handling. */
for (i = 0; i <= usbp->otgparams->num_endpoints; i++) {
- if (usbp->epc[i]->out_state != NULL) {
- otgp->DAINTMSK |= DAINTMSK_OUTEPTMSK(i);
+ const USBEndpointConfig *epcp = usbp->epc[i];
+
+ if (epcp == NULL) {
+ continue;
}
- if (usbp->epc[i]->in_state != NULL) {
- otgp->DAINTMSK |= DAINTMSK_INEPTMSK(i);
+ if (epcp->out_state != NULL) {
+ daintmsk |= DAINTMSK_OUTEPTMSK(i);
+ }
+ if (epcp->in_state != NULL) {
+ daintmsk |= DAINTMSK_INEPTMSK(i);
}
}
+ otgp->DAINTMSK = daintmsk;
}
static void otg_rxfifo_flush(USBDriver *usbp) {
@@ -201,8 +238,8 @@ static void otg_rxfifo_flush(USBDriver *usbp) {
otgp->GRSTCTL = GRSTCTL_RXFFLSH;
while ((otgp->GRSTCTL & GRSTCTL_RXFFLSH) != 0)
;
- /* Wait for 3 PHY Clocks.*/
- osalSysPolledDelayX(18);
+ /* Wait at least 3 PHY clocks, independently of the CPU frequency.*/
+ osalSysPolledDelayX(OSAL_US2RTC(SystemCoreClock, 1U));
}
static void otg_txfifo_flush(USBDriver *usbp, uint32_t fifo) {
@@ -211,8 +248,8 @@ static void otg_txfifo_flush(USBDriver *usbp, uint32_t fifo) {
otgp->GRSTCTL = GRSTCTL_TXFNUM(fifo) | GRSTCTL_TXFFLSH;
while ((otgp->GRSTCTL & GRSTCTL_TXFFLSH) != 0)
;
- /* Wait for 3 PHY Clocks.*/
- osalSysPolledDelayX(18);
+ /* Wait at least 3 PHY clocks, independently of the CPU frequency.*/
+ osalSysPolledDelayX(OSAL_US2RTC(SystemCoreClock, 1U));
}
/**
@@ -260,14 +297,47 @@ static void otg_fifo_write_from_buffer(volatile uint32_t *fifop,
osalDbgAssert(n > 0, "is zero");
+#if defined(OTG_USE_SIMPLIFIED_LOOPS)
while (true) {
*fifop = *((uint32_t *)buf);
- if (n <= 4) {
+ if (n <= 4U) {
break;
}
- n -= 4;
+ n -= 4U;
buf += 4;
}
+#else
+ while (n >= 4U) {
+ uint32_t w;
+
+ w = (uint32_t)buf[0];
+ w |= (uint32_t)buf[1] << 8;
+ w |= (uint32_t)buf[2] << 16;
+ w |= (uint32_t)buf[3] << 24;
+ *fifop = w;
+ buf += 4;
+ n -= 4U;
+ }
+
+ if (n != 0U) {
+ uint32_t w = 0U;
+
+ switch (n) {
+ case 3:
+ w |= (uint32_t)buf[2] << 16;
+ /* Falls through.*/
+ case 2:
+ w |= (uint32_t)buf[1] << 8;
+ /* Falls through.*/
+ case 1:
+ w |= (uint32_t)buf[0];
+ break;
+ default:
+ break;
+ }
+ *fifop = w;
+ }
+#endif
}
/**
@@ -360,6 +430,9 @@ static bool otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
/* The TXFIFO is filled until there is space and data to be transmitted.*/
while (true) {
uint32_t n;
+#if AT32_USB_OTGFIFO_FILL_BASEPRI
+ uint32_t basepri;
+#endif
/* Transaction end condition.*/
if (usbp->epc[ep]->in_state->txcnt >= usbp->epc[ep]->in_state->txsize) {
@@ -380,7 +453,8 @@ static bool otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
return false;
#if AT32_USB_OTGFIFO_FILL_BASEPRI
- __set_BASEPRI(CORTEX_PRIO_MASK(AT32_USB_OTGFIFO_FILL_BASEPRI));
+ basepri = __get_BASEPRI();
+ __set_BASEPRI_MAX(CORTEX_PRIO_MASK(AT32_USB_OTGFIFO_FILL_BASEPRI));
#endif
#if AT32_USE_USB_OTG2_HS_DMA
if (usbp->otgparams->dma_en) {
@@ -396,7 +470,7 @@ static bool otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
usbp->epc[ep]->in_state->txbuf += n;
usbp->epc[ep]->in_state->txcnt += n;
#if AT32_USB_OTGFIFO_FILL_BASEPRI
- __set_BASEPRI(0);
+ __set_BASEPRI(basepri);
#endif
}
}
@@ -416,7 +490,8 @@ static void otg_epin_handler(USBDriver *usbp, usbep_t ep) {
otgp->ie[ep].DIEPINT = epint;
if (epint & DIEPINT_TIMEOUT) {
- /* Timeouts not handled yet, not sure how to handle.*/
+ /* Timeout condition is intentionally masked out in DIEPMSK because
+ it does not represent transfer completion/failure for this driver.*/
}
if ((epint & DIEPINT_XFERC) && (otgp->DIEPMSK & DIEPMSK_XFERCMSK)) {
/* Transmit transfer complete.*/
@@ -1004,6 +1079,13 @@ void usb_lld_stop(USBDriver *usbp) {
void usb_lld_reset(USBDriver *usbp) {
unsigned i;
at32_otg_t *otgp = usbp->otg;
+#if AT32_USB_USE_OTG1 && AT32_USB_USE_OTG2
+ const USBEndpointConfig *epcp = &USBD1 == usbp ? &ep0config1 : &ep0config2;
+#elif AT32_USB_USE_OTG1
+ const USBEndpointConfig *epcp = &ep0config1;
+#else
+ const USBEndpointConfig *epcp = &ep0config2;
+#endif
/* Flush the Tx FIFO.*/
otg_txfifo_flush(usbp, 0);
@@ -1037,31 +1119,31 @@ void usb_lld_reset(USBDriver *usbp) {
otgp->GINTMSK &= ~GINTMSK_RXFLVLMSK;
}
#endif
- otgp->DIEPMSK = DIEPMSK_TIMEOUTMSK | DIEPMSK_XFERCMSK;
+ otgp->DIEPMSK = /* DIEPMSK_TIMEOUTMSK |*/ DIEPMSK_XFERCMSK;
otgp->DOEPMSK = DOEPMSK_SETUPMSK | DOEPMSK_XFERCMSK;
/* EP0 initialization, it is a special case.*/
- usbp->epc[0] = &ep0config;
+ usbp->epc[0] = epcp;
otgp->oe[0].DOEPTSIZ = DOEPTSIZ_SETUPCNT(3);
#if AT32_USE_USB_OTG2_HS_DMA
if (usbp->otgparams->dma_en) {
otgp->oe[0].DOEPDMA = (uint32_t)(usbp->epc[0]->setup_buf);
otgp->oe[0].DOEPCTL = DOEPCTL_SETD0PID | DOEPCTL_USBACEPT | DOEPCTL_EPTYPE_CTRL | DOEPCTL_EPTENA |
- DOEPCTL_MPS(ep0config.out_maxsize);
+ DOEPCTL_MPS(epcp->out_maxsize);
}
else
#endif
{
otgp->oe[0].DOEPCTL = DOEPCTL_SETD0PID | DOEPCTL_USBACEPT | DOEPCTL_EPTYPE_CTRL |
- DOEPCTL_MPS(ep0config.out_maxsize);
+ DOEPCTL_MPS(epcp->out_maxsize);
}
otgp->ie[0].DIEPTSIZ = 0;
otgp->ie[0].DIEPCTL = DIEPCTL_SETD0PID | DIEPCTL_USBACEPT | DIEPCTL_EPTYPE_CTRL |
- DIEPCTL_TXFNUM(0) | DIEPCTL_MPS(ep0config.in_maxsize);
- otgp->DIEPTXF0 = DIEPTXF_INEPTXFDEP(ep0config.in_maxsize / 4) |
+ DIEPCTL_TXFNUM(0) | DIEPCTL_MPS(epcp->in_maxsize);
+ otgp->DIEPTXF0 = DIEPTXF_INEPTXFDEP(epcp->in_maxsize / 4) |
DIEPTXF_INEPTXFSTADDR(otg_ram_alloc(usbp,
- ep0config.in_maxsize / 4));
+ epcp->in_maxsize / 4));
}
/**
@@ -1121,10 +1203,14 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) {
/* IN endpoint activation or deactivation.*/
otgp->ie[ep].DIEPTSIZ = 0;
if (usbp->epc[ep]->in_state != NULL) {
- /* FIFO allocation for the IN endpoint.*/
- fsize = usbp->epc[ep]->in_maxsize / 4;
- if (usbp->epc[ep]->in_multiplier > 1)
+ /* Round each packet up to words and enforce the 16-word FIFO minimum.*/
+ fsize = (usbp->epc[ep]->in_maxsize + 3U) / 4U;
+ if (usbp->epc[ep]->in_multiplier > 1U) {
fsize *= usbp->epc[ep]->in_multiplier;
+ }
+ if (fsize < 16U) {
+ fsize = 16U;
+ }
otgp->DIEPTXF[ep - 1] = DIEPTXF_INEPTXFDEP(fsize) |
DIEPTXF_INEPTXFSTADDR(otg_ram_alloc(usbp, fsize));
otg_txfifo_flush(usbp, ep);
@@ -1150,12 +1236,26 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) {
* @notapi
*/
void usb_lld_disable_endpoints(USBDriver *usbp) {
+ at32_otg_t *otgp = usbp->otg;
+ unsigned ep;
- /* Resets the FIFO memory allocator.*/
+ /* Preserve the RX FIFO and EP0 TX FIFO allocations and EP0 operation.*/
otg_ram_reset(usbp);
-
- /* Disabling all endpoints.*/
- otg_disable_ep(usbp);
+ usbp->pmnext += EP0_MAX_INSIZE / 4U;
+ otgp->DIEPEMPMSK &= DIEPEMPMSK_INEPTXFEMSK(0);
+ otgp->DAINTMSK = DAINTMSK_OUTEPTMSK(0) | DAINTMSK_INEPTMSK(0);
+ for (ep = 1U; ep <= usbp->otgparams->num_endpoints; ep++) {
+ if ((otgp->ie[ep].DIEPCTL & DIEPCTL_EPTENA) != 0U) {
+ otgp->ie[ep].DIEPCTL |= DIEPCTL_EPTDIS | DIEPCTL_SNAK;
+ }
+ if ((otgp->oe[ep].DOEPCTL & DOEPCTL_EPTENA) != 0U) {
+ otgp->oe[ep].DOEPCTL |= DOEPCTL_EPTDIS | DOEPCTL_SNAK;
+ }
+ otgp->ie[ep].DIEPCTL &= ~DIEPCTL_USBACEPT;
+ otgp->oe[ep].DOEPCTL &= ~DOEPCTL_USBACEPT;
+ otgp->ie[ep].DIEPINT = 0xFFFFFFFFU;
+ otgp->oe[ep].DOEPINT = 0xFFFFFFFFU;
+ }
}
/**
diff --git a/os/hal/ports/AT32/LLD/OTGv1/hal_usb_lld.h b/os/hal/ports/AT32/LLD/OTGv1/hal_usb_lld.h
index 1221fa8bcb..223dc6cb5b 100644
--- a/os/hal/ports/AT32/LLD/OTGv1/hal_usb_lld.h
+++ b/os/hal/ports/AT32/LLD/OTGv1/hal_usb_lld.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -135,6 +135,8 @@
* @note The value zero means disabled, when disabled calling USB
* functions is only safe from thread level or from USB
* callbacks.
+ * @note A stronger pre-existing BASEPRI mask is preserved. The original
+ * mask is restored after each packet copy.
*/
#if !defined(AT32_USB_OTGFIFO_FILL_BASEPRI) || defined(__DOXYGEN__)
#define AT32_USB_OTGFIFO_FILL_BASEPRI 0
@@ -147,6 +149,13 @@
#define AT32_USB_HOST_WAKEUP_DURATION 2
#endif
+/**
+ * @brief Allowed deviation for the 48MHz clock.
+ */
+#if !defined(AT32_USB_48MHZ_DELTA) || defined(__DOXYGEN__)
+#define AT32_USB_48MHZ_DELTA 120000
+#endif
+
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
@@ -215,12 +224,12 @@
#define USB_MAX_ENDPOINTS AT32_OTG2_ENDPOINTS
#endif
-#if AT32_USB_USE_OTG1 && \
+#if AT32_USB_USE_OTG1 && \
!OSAL_IRQ_IS_VALID_PRIORITY(AT32_USB_OTG1_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to OTG1"
#endif
-#if AT32_USB_USE_OTG2 && \
+#if AT32_USB_USE_OTG2 && \
!OSAL_IRQ_IS_VALID_PRIORITY(AT32_USB_OTG2_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to OTG2"
#endif
@@ -233,13 +242,18 @@
#error "OTG2 RX FIFO size must be a multiple of 4"
#endif
+#if (AT32_USB_HOST_WAKEUP_DURATION < 2) || (AT32_USB_HOST_WAKEUP_DURATION > 15)
+#error "invalid AT32_USB_HOST_WAKEUP_DURATION setting, it must be between 2 and 15"
+#endif
+
/* Allowing for a small tolerance.*/
-#if AT32_USBCLK < 47880000 || AT32_USBCLK > 48120000
-#error "the USB OTG driver requires a 48MHz clock"
+#if (AT32_USB_48MHZ_DELTA < 0) || (AT32_USB_48MHZ_DELTA > 120000)
+#error "invalid AT32_USB_48MHZ_DELTA setting, it must not exceed 120000"
#endif
-#if (AT32_USB_HOST_WAKEUP_DURATION < 2) || (AT32_USB_HOST_WAKEUP_DURATION > 15)
-#error "invalid AT32_USB_HOST_WAKEUP_DURATION setting, it must be between 2 and 15"
+#if (AT32_USBCLK < (48000000 - AT32_USB_48MHZ_DELTA)) || \
+ (AT32_USBCLK > (48000000 + AT32_USB_48MHZ_DELTA))
+#error "the USB OTGv1 driver requires a 48MHz clock"
#endif
/*===========================================================================*/
@@ -395,12 +409,14 @@ typedef struct {
* @note This callback is mandatory and cannot be set to @p NULL.
*/
usbgetdescriptor_t get_descriptor_cb;
+#if (USB_USE_EP0_THREAD == FALSE) || defined(__DOXYGEN__)
/**
* @brief Requests hook callback.
* @details This hook allows to be notified of standard requests or to
* handle non standard requests.
*/
usbreqhandler_t requests_hook_cb;
+#endif
/**
* @brief Start Of Frame callback.
*/
@@ -462,6 +478,28 @@ struct USBDriver {
* @brief Endpoint 0 end transaction callback.
*/
usbcallback_t ep0endcb;
+#if (USB_USE_EP0_THREAD == TRUE) || defined(__DOXYGEN__)
+ /**
+ * @brief Waiting thread for EP0 operations.
+ */
+ thread_reference_t ep0thread;
+ /**
+ * @brief Current EP0 sequence number.
+ */
+ uint8_t ep0seq;
+ /**
+ * @brief EP0 sequence number owned by the worker thread.
+ */
+ uint8_t ep0rseq;
+ /**
+ * @brief Pending setup notification for the worker thread.
+ */
+ uint8_t ep0setup;
+ /**
+ * @brief Pending reset notification for the worker thread.
+ */
+ uint8_t ep0reset;
+#endif
/**
* @brief Setup packet buffer.
*/
diff --git a/os/hal/ports/AT32/LLD/RTCv2/hal_rtc_lld.c b/os/hal/ports/AT32/LLD/RTCv2/hal_rtc_lld.c
index 01f340fe08..9496329840 100644
--- a/os/hal/ports/AT32/LLD/RTCv2/hal_rtc_lld.c
+++ b/os/hal/ports/AT32/LLD/RTCv2/hal_rtc_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/RTCv2/hal_rtc_lld.h b/os/hal/ports/AT32/LLD/RTCv2/hal_rtc_lld.h
index d39d0baa56..a1070dc05f 100644
--- a/os/hal/ports/AT32/LLD/RTCv2/hal_rtc_lld.h
+++ b/os/hal/ports/AT32/LLD/RTCv2/hal_rtc_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/SDIOv1/hal_sdc_lld.c b/os/hal/ports/AT32/LLD/SDIOv1/hal_sdc_lld.c
index 4ce71d826b..faa723226c 100644
--- a/os/hal/ports/AT32/LLD/SDIOv1/hal_sdc_lld.c
+++ b/os/hal/ports/AT32/LLD/SDIOv1/hal_sdc_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2026 HorrorTroll
- ChibiOS - Copyright (C) 2023..2026 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/SDIOv1/hal_sdc_lld.h b/os/hal/ports/AT32/LLD/SDIOv1/hal_sdc_lld.h
index 01440bed08..caac8b9a1f 100644
--- a/os/hal/ports/AT32/LLD/SDIOv1/hal_sdc_lld.h
+++ b/os/hal/ports/AT32/LLD/SDIOv1/hal_sdc_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2026 HorrorTroll
- ChibiOS - Copyright (C) 2023..2026 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/SPIv1/hal_spi_v2_lld.c b/os/hal/ports/AT32/LLD/SPIv1/hal_spi_v2_lld.c
index caf65de7f1..c796109912 100644
--- a/os/hal/ports/AT32/LLD/SPIv1/hal_spi_v2_lld.c
+++ b/os/hal/ports/AT32/LLD/SPIv1/hal_spi_v2_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -323,6 +323,8 @@ msg_t spi_lld_start(SPIDriver *spip) {
/* If in stopped state then enables the SPI and DMA clocks.*/
if (spip->state == SPI_STOP) {
+
+ /* Enables the peripheral.*/
if (false) {
}
@@ -382,6 +384,7 @@ msg_t spi_lld_start(SPIDriver *spip) {
else {
osalDbgAssert(false, "invalid SPI instance");
+ return HAL_RET_IS_INVALID;
}
/* DMA setup.*/
diff --git a/os/hal/ports/AT32/LLD/SPIv1/hal_spi_v2_lld.h b/os/hal/ports/AT32/LLD/SPIv1/hal_spi_v2_lld.h
index 34031f41e1..62c1ebf0c2 100644
--- a/os/hal/ports/AT32/LLD/SPIv1/hal_spi_v2_lld.h
+++ b/os/hal/ports/AT32/LLD/SPIv1/hal_spi_v2_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/SPIv2/hal_spi_v2_lld.c b/os/hal/ports/AT32/LLD/SPIv2/hal_spi_v2_lld.c
index 6369ce9ebf..4305621ea2 100644
--- a/os/hal/ports/AT32/LLD/SPIv2/hal_spi_v2_lld.c
+++ b/os/hal/ports/AT32/LLD/SPIv2/hal_spi_v2_lld.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -324,6 +324,8 @@ msg_t spi_lld_start(SPIDriver *spip) {
/* If in stopped state then enables the SPI and DMA clocks.*/
if (spip->state == SPI_STOP) {
+
+ /* Enables the peripheral.*/
if (false) {
}
@@ -383,6 +385,7 @@ msg_t spi_lld_start(SPIDriver *spip) {
else {
osalDbgAssert(false, "invalid SPI instance");
+ return HAL_RET_IS_INVALID;
}
/* DMA setup.*/
diff --git a/os/hal/ports/AT32/LLD/SPIv2/hal_spi_v2_lld.h b/os/hal/ports/AT32/LLD/SPIv2/hal_spi_v2_lld.h
index da014ae4e3..bbcff508f0 100644
--- a/os/hal/ports/AT32/LLD/SPIv2/hal_spi_v2_lld.h
+++ b/os/hal/ports/AT32/LLD/SPIv2/hal_spi_v2_lld.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/SYSTICKv1/hal_st_lld.c b/os/hal/ports/AT32/LLD/SYSTICKv1/hal_st_lld.c
index cd930a3a60..c315c6c1b8 100644
--- a/os/hal/ports/AT32/LLD/SYSTICKv1/hal_st_lld.c
+++ b/os/hal/ports/AT32/LLD/SYSTICKv1/hal_st_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2026 HorrorTroll
- ChibiOS - Copyright (C) 2023..2026 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -210,15 +210,18 @@
#error "AT32_ST_USE_TIMER specifies an unsupported timer"
#endif
-#if 0 /* TODO remove */
-#if ST_CLOCK_SRC % OSAL_ST_FREQUENCY != 0
-#error "the selected ST frequency is not obtainable because integer rounding"
-#endif
-
-#if (ST_CLOCK_SRC / OSAL_ST_FREQUENCY) - 1 > 0xFFFF
-#error "the selected ST frequency is not obtainable because TMR timer prescaler limits"
-#endif
-#endif
+/* Free running prescaler rounded to the nearest integer, the resulting tick
+ frequency and its absolute deviation from OSAL_ST_FREQUENCY. These are
+ expressions only (no objects): they fold to constants on static-clock
+ devices and, where used solely inside osalDbgAssert(), they fully vanish
+ when assertions are disabled.*/
+#define ST_PSC ((((halfreq_t)ST_CLOCK_SRC + \
+ ((halfreq_t)OSAL_ST_FREQUENCY / 2U)) / \
+ (halfreq_t)OSAL_ST_FREQUENCY) - 1U)
+#define ST_TICK ((halfreq_t)ST_CLOCK_SRC / (ST_PSC + 1U))
+#define ST_TICK_ERROR ((ST_TICK >= (halfreq_t)OSAL_ST_FREQUENCY) ? \
+ (ST_TICK - (halfreq_t)OSAL_ST_FREQUENCY) : \
+ ((halfreq_t)OSAL_ST_FREQUENCY - ST_TICK))
#endif /* OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING */
@@ -290,11 +293,16 @@ OSAL_IRQ_HANDLER(ST_HANDLER) {
void st_lld_init(void) {
#if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
- /* Free running counter mode.*/
- osalDbgAssert((ST_CLOCK_SRC % OSAL_ST_FREQUENCY) == 0U,
+ /* Free running counter mode. The prescaler is rounded to the nearest
+ integer; the resulting tick frequency is required to be within
+ AT32_ST_FREQUENCY_TOLERANCE per-mille of OSAL_ST_FREQUENCY (a tolerance
+ of zero, the default, requires an exact integer divisor). The checks are
+ pure expressions confined to the assertions, so they leave no code
+ when assertions are disabled.*/
+ osalDbgAssert(ST_PSC < 0x10000U, "clock prescaler overflow");
+ osalDbgAssert((ST_TICK_ERROR * 1000U) <= ((halfreq_t)OSAL_ST_FREQUENCY *
+ (halfreq_t)AT32_ST_FREQUENCY_TOLERANCE),
"clock rounding error");
- osalDbgAssert(((ST_CLOCK_SRC / OSAL_ST_FREQUENCY) - 1U) < 0x10000,
- "clock prescaler overflow");
/* Enabling timer clock.*/
ST_ENABLE_CLOCK();
@@ -304,7 +312,7 @@ void st_lld_init(void) {
/* Initializing the counter in free running mode.*/
AT32_ST_TMR->CTRL1 = ST_CTRL1_INIT;
- AT32_ST_TMR->DIV = (ST_CLOCK_SRC / OSAL_ST_FREQUENCY) - 1;
+ AT32_ST_TMR->DIV = (uint32_t)ST_PSC;
AT32_ST_TMR->PR = ST_PR_INIT;
AT32_ST_TMR->CM1 = 0;
AT32_ST_TMR->CDT[0] = 0;
diff --git a/os/hal/ports/AT32/LLD/SYSTICKv1/hal_st_lld.h b/os/hal/ports/AT32/LLD/SYSTICKv1/hal_st_lld.h
index c67f91d167..dc718b8224 100644
--- a/os/hal/ports/AT32/LLD/SYSTICKv1/hal_st_lld.h
+++ b/os/hal/ports/AT32/LLD/SYSTICKv1/hal_st_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -71,12 +71,30 @@
#if !defined(AT32_ST_OVERRIDE_ALARMS) || defined(__DOXYGEN__)
#define AT32_ST_OVERRIDE_ALARMS 1
#endif
+
+/**
+ * @brief Allowed ST clock frequency deviation, in per-mille (1/1000).
+ * @details In free running mode the timer prescaler is rounded to the
+ * nearest integer; the resulting tick frequency is then allowed to
+ * deviate from @p OSAL_ST_FREQUENCY by up to this many per-mille
+ * (e.g. 5 means 0.5%). The default of zero requires the ST clock to
+ * be an exact integer multiple of the tick frequency. Useful on
+ * devices whose clock tree cannot produce an exact multiple.
+ * @note Only meaningful in free running mode.
+ */
+#if !defined(AT32_ST_FREQUENCY_TOLERANCE) || defined(__DOXYGEN__)
+#define AT32_ST_FREQUENCY_TOLERANCE 0
+#endif
/** @} */
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
+#if (AT32_ST_FREQUENCY_TOLERANCE < 0) || (AT32_ST_FREQUENCY_TOLERANCE > 1000)
+#error "invalid AT32_ST_FREQUENCY_TOLERANCE value, must be 0..1000 (per-mille)"
+#endif
+
/* This has to go after transition to shared handlers is complete for all
platforms.*/
#if !defined(AT32_HAS_TMR1)
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr.h b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr.h
index 9768a3d005..4336b25ccd 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr.h
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -364,6 +364,10 @@ typedef struct {
/* External declarations. */
/*===========================================================================*/
+/*===========================================================================*/
+/* Driver inline functions. */
+/*===========================================================================*/
+
#endif /* AT32_TMR_H */
/** @} */
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr12.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr12.inc
index 7692931b18..145e712595 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr12.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr12.inc
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2024 HorrorTroll
- ChibiOS - Copyright (C) 2023..2024 Zhaqian
- ChibiOS - Copyright (C) 2023..2024 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr13.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr13.inc
index 1c3f22680b..6aa33e99d1 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr13.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr13.inc
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr14.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr14.inc
index c5c1c2ffb2..7991588695 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr14.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr14.inc
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr1_9_10_11.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr1_9_10_11.inc
index f1fb9baf05..647015158d 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr1_9_10_11.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr1_9_10_11.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr2.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr2.inc
index 4ddac9bbd6..d5100a34a9 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr2.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr2.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr20.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr20.inc
index 1b3d8ca4f4..4c0dd972de 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr20.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr20.inc
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr3.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr3.inc
index 557ced5f4c..08ac0b23aa 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr3.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr3.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr4.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr4.inc
index 48cc110f4f..286472d182 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr4.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr4.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr5.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr5.inc
index 772037c1f2..e599247414 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr5.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr5.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr6.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr6.inc
index 5f1298b7b6..e87121f1a1 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr6.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr6.inc
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr7.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr7.inc
index f1f9807660..5f79c3569e 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr7.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr7.inc
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr8_12_13_14.inc b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr8_12_13_14.inc
index e01a22f4aa..63489a9fa8 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/at32_tmr8_12_13_14.inc
+++ b/os/hal/ports/AT32/LLD/TMRv1/at32_tmr8_12_13_14.inc
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/hal_gpt_lld.c b/os/hal/ports/AT32/LLD/TMRv1/hal_gpt_lld.c
index b49a18baf7..fae4f7d564 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/hal_gpt_lld.c
+++ b/os/hal/ports/AT32/LLD/TMRv1/hal_gpt_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/hal_gpt_lld.h b/os/hal/ports/AT32/LLD/TMRv1/hal_gpt_lld.h
index fb5cf7d3e9..0bd7ac9eb9 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/hal_gpt_lld.h
+++ b/os/hal/ports/AT32/LLD/TMRv1/hal_gpt_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/hal_icu_lld.c b/os/hal/ports/AT32/LLD/TMRv1/hal_icu_lld.c
index 39f3c30955..dcc4d16b60 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/hal_icu_lld.c
+++ b/os/hal/ports/AT32/LLD/TMRv1/hal_icu_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/hal_icu_lld.h b/os/hal/ports/AT32/LLD/TMRv1/hal_icu_lld.h
index 137cb24401..7083b105a4 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/hal_icu_lld.h
+++ b/os/hal/ports/AT32/LLD/TMRv1/hal_icu_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/hal_pwm_lld.c b/os/hal/ports/AT32/LLD/TMRv1/hal_pwm_lld.c
index c7036eff18..910c63096a 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/hal_pwm_lld.c
+++ b/os/hal/ports/AT32/LLD/TMRv1/hal_pwm_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/TMRv1/hal_pwm_lld.h b/os/hal/ports/AT32/LLD/TMRv1/hal_pwm_lld.h
index 72740a81e3..90843eeac5 100644
--- a/os/hal/ports/AT32/LLD/TMRv1/hal_pwm_lld.h
+++ b/os/hal/ports/AT32/LLD/TMRv1/hal_pwm_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USART/at32_uart4.inc b/os/hal/ports/AT32/LLD/USART/at32_uart4.inc
index c3afdd304e..137d6a8f6f 100644
--- a/os/hal/ports/AT32/LLD/USART/at32_uart4.inc
+++ b/os/hal/ports/AT32/LLD/USART/at32_uart4.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USART/at32_uart5.inc b/os/hal/ports/AT32/LLD/USART/at32_uart5.inc
index 1499bd7fe4..d999f14576 100644
--- a/os/hal/ports/AT32/LLD/USART/at32_uart5.inc
+++ b/os/hal/ports/AT32/LLD/USART/at32_uart5.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USART/at32_uart7.inc b/os/hal/ports/AT32/LLD/USART/at32_uart7.inc
index 3a4401a69c..5c38f61dff 100644
--- a/os/hal/ports/AT32/LLD/USART/at32_uart7.inc
+++ b/os/hal/ports/AT32/LLD/USART/at32_uart7.inc
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USART/at32_uart8.inc b/os/hal/ports/AT32/LLD/USART/at32_uart8.inc
index 832fc13fc9..a10a51e55b 100644
--- a/os/hal/ports/AT32/LLD/USART/at32_uart8.inc
+++ b/os/hal/ports/AT32/LLD/USART/at32_uart8.inc
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USART/at32_usart1.inc b/os/hal/ports/AT32/LLD/USART/at32_usart1.inc
index da86470108..2156b207a8 100644
--- a/os/hal/ports/AT32/LLD/USART/at32_usart1.inc
+++ b/os/hal/ports/AT32/LLD/USART/at32_usart1.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USART/at32_usart2.inc b/os/hal/ports/AT32/LLD/USART/at32_usart2.inc
index 81ee8f9aee..695cc71955 100644
--- a/os/hal/ports/AT32/LLD/USART/at32_usart2.inc
+++ b/os/hal/ports/AT32/LLD/USART/at32_usart2.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USART/at32_usart3.inc b/os/hal/ports/AT32/LLD/USART/at32_usart3.inc
index d23f4aaa62..4a2d19d204 100644
--- a/os/hal/ports/AT32/LLD/USART/at32_usart3.inc
+++ b/os/hal/ports/AT32/LLD/USART/at32_usart3.inc
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USART/at32_usart6.inc b/os/hal/ports/AT32/LLD/USART/at32_usart6.inc
index 20320dc1ce..b3d127f5c7 100644
--- a/os/hal/ports/AT32/LLD/USART/at32_usart6.inc
+++ b/os/hal/ports/AT32/LLD/USART/at32_usart6.inc
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv1/hal_serial_lld.c b/os/hal/ports/AT32/LLD/USARTv1/hal_serial_lld.c
index f7033d04fb..da1b6c6d41 100644
--- a/os/hal/ports/AT32/LLD/USARTv1/hal_serial_lld.c
+++ b/os/hal/ports/AT32/LLD/USARTv1/hal_serial_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv1/hal_serial_lld.h b/os/hal/ports/AT32/LLD/USARTv1/hal_serial_lld.h
index e27bbb0ef2..abb9cb7ec7 100644
--- a/os/hal/ports/AT32/LLD/USARTv1/hal_serial_lld.h
+++ b/os/hal/ports/AT32/LLD/USARTv1/hal_serial_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv1/hal_uart_lld.c b/os/hal/ports/AT32/LLD/USARTv1/hal_uart_lld.c
index 9d995c2311..adfa65f20e 100644
--- a/os/hal/ports/AT32/LLD/USARTv1/hal_uart_lld.c
+++ b/os/hal/ports/AT32/LLD/USARTv1/hal_uart_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv1/hal_uart_lld.h b/os/hal/ports/AT32/LLD/USARTv1/hal_uart_lld.h
index 8fdef0815a..80c54e5bb3 100644
--- a/os/hal/ports/AT32/LLD/USARTv1/hal_uart_lld.h
+++ b/os/hal/ports/AT32/LLD/USARTv1/hal_uart_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv2/at32_usart.h b/os/hal/ports/AT32/LLD/USARTv2/at32_usart.h
index ba1341368d..2497507f30 100644
--- a/os/hal/ports/AT32/LLD/USARTv2/at32_usart.h
+++ b/os/hal/ports/AT32/LLD/USARTv2/at32_usart.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv2/hal_serial_lld.c b/os/hal/ports/AT32/LLD/USARTv2/hal_serial_lld.c
index 805637dccc..b6b749caec 100644
--- a/os/hal/ports/AT32/LLD/USARTv2/hal_serial_lld.c
+++ b/os/hal/ports/AT32/LLD/USARTv2/hal_serial_lld.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv2/hal_serial_lld.h b/os/hal/ports/AT32/LLD/USARTv2/hal_serial_lld.h
index 5777ff8723..31f5c782f5 100644
--- a/os/hal/ports/AT32/LLD/USARTv2/hal_serial_lld.h
+++ b/os/hal/ports/AT32/LLD/USARTv2/hal_serial_lld.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv2/hal_sio_lld.c b/os/hal/ports/AT32/LLD/USARTv2/hal_sio_lld.c
index fcd6913b8f..ed8f180ec4 100644
--- a/os/hal/ports/AT32/LLD/USARTv2/hal_sio_lld.c
+++ b/os/hal/ports/AT32/LLD/USARTv2/hal_sio_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2026 HorrorTroll
- ChibiOS - Copyright (C) 2023..2026 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -277,7 +277,7 @@ msg_t sio_lld_start(SIODriver *siop) {
if (siop->state == SIO_STOP) {
- /* Enables the peripheral.*/
+ /* Enables the peripheral.*/
if (false) {
}
#if AT32_SIO_USE_USART1 == TRUE
@@ -330,6 +330,7 @@ msg_t sio_lld_start(SIODriver *siop) {
#endif
else {
osalDbgAssert(false, "invalid SIO instance");
+ return HAL_RET_IS_INVALID;
}
}
@@ -707,6 +708,8 @@ void sio_lld_serve_interrupt(SIODriver *siop) {
to the state of the various CRx registers.*/
stsmask = __sio_reloc_field(ctrl1, USART_CTRL1_TDBEIEN, USART_CTRL1_TDBEIEN_Pos, USART_STS_TDBE_Pos) |
__sio_reloc_field(ctrl1, USART_CTRL1_RDBFIEN, USART_CTRL1_RDBFIEN_Pos, USART_STS_RDBF_Pos) |
+ /* NOTE: ROERR interrupt also enabled by USART_CTRL1_RDBFIEN, not just USART_CTRL3_ERRIEN.*/
+ __sio_reloc_field(ctrl1, USART_CTRL1_RDBFIEN, USART_CTRL1_RDBFIEN_Pos, USART_STS_ROERR_Pos) |
__sio_reloc_field(ctrl1, USART_CTRL1_IDLEIEN, USART_CTRL1_IDLEIEN_Pos, USART_STS_IDLEF_Pos) |
__sio_reloc_field(ctrl1, USART_CTRL1_TDCIEN, USART_CTRL1_TDCIEN_Pos, USART_STS_TDC_Pos) |
__sio_reloc_field(ctrl1, USART_CTRL1_PERRIEN, USART_CTRL1_PERRIEN_Pos, USART_STS_PERR_Pos) |
@@ -782,7 +785,8 @@ void sio_lld_serve_interrupt(SIODriver *siop) {
__sio_callback(siop);
}
else {
- osalDbgAssert(false, "spurious interrupt");
+ /* Shared STM32 USART vectors can dispatch multiple instances, ignore the
+ call if this peripheral has no pending enabled source.*/
}
}
diff --git a/os/hal/ports/AT32/LLD/USARTv2/hal_sio_lld.h b/os/hal/ports/AT32/LLD/USARTv2/hal_sio_lld.h
index 7649a657d2..b18258282e 100644
--- a/os/hal/ports/AT32/LLD/USARTv2/hal_sio_lld.h
+++ b/os/hal/ports/AT32/LLD/USARTv2/hal_sio_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv2/hal_uart_lld.c b/os/hal/ports/AT32/LLD/USARTv2/hal_uart_lld.c
index 8ae1ee6296..3ee54ab36a 100644
--- a/os/hal/ports/AT32/LLD/USARTv2/hal_uart_lld.c
+++ b/os/hal/ports/AT32/LLD/USARTv2/hal_uart_lld.c
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/USARTv2/hal_uart_lld.h b/os/hal/ports/AT32/LLD/USARTv2/hal_uart_lld.h
index 4608c29c4b..cee5ee49e2 100644
--- a/os/hal/ports/AT32/LLD/USARTv2/hal_uart_lld.h
+++ b/os/hal/ports/AT32/LLD/USARTv2/hal_uart_lld.h
@@ -1,8 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
- ChibiOS - Copyright (C) 2024..2025 Maxjta
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/xWDGv1/hal_wdg_lld.c b/os/hal/ports/AT32/LLD/xWDGv1/hal_wdg_lld.c
index eef84a0a0e..28201ea37d 100644
--- a/os/hal/ports/AT32/LLD/xWDGv1/hal_wdg_lld.c
+++ b/os/hal/ports/AT32/LLD/xWDGv1/hal_wdg_lld.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/os/hal/ports/AT32/LLD/xWDGv1/hal_wdg_lld.h b/os/hal/ports/AT32/LLD/xWDGv1/hal_wdg_lld.h
index 554f200c7f..271381f31e 100644
--- a/os/hal/ports/AT32/LLD/xWDGv1/hal_wdg_lld.h
+++ b/os/hal/ports/AT32/LLD/xWDGv1/hal_wdg_lld.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f402/chconf.h b/testhal/AT32/multi/ERTC/cfg/at-start-f402/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f402/chconf.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f402/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f402/config.h b/testhal/AT32/multi/ERTC/cfg/at-start-f402/config.h
index 1e7c044f47..74e0f4980d 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f402/config.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f402/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f402/halconf.h b/testhal/AT32/multi/ERTC/cfg/at-start-f402/halconf.h
index 4a431aeabe..00dc7e4e8f 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f402/halconf.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f402/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f402/halconf_community.h b/testhal/AT32/multi/ERTC/cfg/at-start-f402/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f402/halconf_community.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f402/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f402/mcuconf.h b/testhal/AT32/multi/ERTC/cfg/at-start-f402/mcuconf.h
index af05f71aa5..256fa462c8 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f402/mcuconf.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f402/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +229,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f402/portab.c b/testhal/AT32/multi/ERTC/cfg/at-start-f402/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f402/portab.c
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f402/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f402/portab.h b/testhal/AT32/multi/ERTC/cfg/at-start-f402/portab.h
index ef5548aeb7..88d5215f85 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f402/portab.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f402/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SD1 SD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f405/chconf.h b/testhal/AT32/multi/ERTC/cfg/at-start-f405/chconf.h
index 56fe06776a..e87d2f17e6 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f405/chconf.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f405/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f405/config.h b/testhal/AT32/multi/ERTC/cfg/at-start-f405/config.h
index 1e7c044f47..4eec5f91bc 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f405/config.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f405/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f405/halconf.h b/testhal/AT32/multi/ERTC/cfg/at-start-f405/halconf.h
index 4a431aeabe..71ce7de682 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f405/halconf.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f405/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f405/halconf_community.h b/testhal/AT32/multi/ERTC/cfg/at-start-f405/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f405/halconf_community.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f405/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f405/mcuconf.h b/testhal/AT32/multi/ERTC/cfg/at-start-f405/mcuconf.h
index e745923283..24f37962b9 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f405/mcuconf.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f405/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f405/portab.c b/testhal/AT32/multi/ERTC/cfg/at-start-f405/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f405/portab.c
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f405/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f405/portab.h b/testhal/AT32/multi/ERTC/cfg/at-start-f405/portab.h
index ef5548aeb7..88d5215f85 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f405/portab.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f405/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SD1 SD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/ERTC/cfg/at-start-f415/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f415/chconf.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f415/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f415/config.h b/testhal/AT32/multi/ERTC/cfg/at-start-f415/config.h
index 056a8f39ff..fe19c2eb77 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f415/config.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f415/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/ERTC/cfg/at-start-f415/halconf.h
index 4a431aeabe..00dc7e4e8f 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f415/halconf.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f415/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/ERTC/cfg/at-start-f415/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f415/halconf_community.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f415/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/ERTC/cfg/at-start-f415/mcuconf.h
index f0b85388f2..7dff88e9f6 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f415/mcuconf.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f415/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f415/portab.c b/testhal/AT32/multi/ERTC/cfg/at-start-f415/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f415/portab.c
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f415/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/ERTC/cfg/at-start-f415/portab.h b/testhal/AT32/multi/ERTC/cfg/at-start-f415/portab.h
index ef5548aeb7..88d5215f85 100644
--- a/testhal/AT32/multi/ERTC/cfg/at-start-f415/portab.h
+++ b/testhal/AT32/multi/ERTC/cfg/at-start-f415/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SD1 SD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/ERTC/main.c b/testhal/AT32/multi/ERTC/main.c
index 80acf12a1c..a35de0403d 100644
--- a/testhal/AT32/multi/ERTC/main.c
+++ b/testhal/AT32/multi/ERTC/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/.cproject b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/.cproject
new file mode 100644
index 0000000000..8dadf0bb03
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/.cproject
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/.project b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/.project
new file mode 100644
index 0000000000..e17bd47c6c
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/.project
@@ -0,0 +1,78 @@
+
+
+ AT32-I2C_HW-MASTER_SLAVE
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+ ?name?
+
+
+
+ org.eclipse.cdt.make.core.append_environment
+ true
+
+
+ org.eclipse.cdt.make.core.autoBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.buildArguments
+
+
+
+ org.eclipse.cdt.make.core.buildCommand
+ mingw32-make
+
+
+ org.eclipse.cdt.make.core.cleanBuildTarget
+ clean
+
+
+ org.eclipse.cdt.make.core.contents
+ org.eclipse.cdt.make.core.activeConfigSettings
+
+
+ org.eclipse.cdt.make.core.enableAutoBuild
+ false
+
+
+ org.eclipse.cdt.make.core.enableCleanBuild
+ true
+
+
+ org.eclipse.cdt.make.core.enableFullBuild
+ true
+
+
+ org.eclipse.cdt.make.core.fullBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.stopOnError
+ true
+
+
+ org.eclipse.cdt.make.core.useDefaultBuildCmd
+ false
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/Makefile b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/Makefile
new file mode 100644
index 0000000000..fdf3019a85
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/Makefile
@@ -0,0 +1,30 @@
+##############################################################################
+# Multi-project makefile rules
+#
+
+all:
+ @echo
+ @echo === Building for AT-START-F402 =====================================
+ +@make --no-print-directory -f ./make/at-start-f402.make all
+ @echo ====================================================================
+ @echo
+ @echo === Building for AT-START-F405 =====================================
+ +@make --no-print-directory -f ./make/at-start-f405.make all
+ @echo ====================================================================
+ @echo
+ @echo === Building for AT-START-F415 =====================================
+ +@make --no-print-directory -f ./make/at-start-f415.make all
+ @echo ====================================================================
+ @echo
+
+clean:
+ @echo
+ +@make --no-print-directory -f ./make/at-start-f402.make clean
+ @echo
+ +@make --no-print-directory -f ./make/at-start-f405.make clean
+ @echo
+ +@make --no-print-directory -f ./make/at-start-f415.make clean
+ @echo
+
+#
+##############################################################################
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/chconf.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/chconf.h
new file mode 100644
index 0000000000..71a25b9a32
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/chconf.h
@@ -0,0 +1,856 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file rt/templates/chconf.h
+ * @brief Configuration file template.
+ * @details A copy of this file must be placed in each project directory, it
+ * contains the application specific kernel settings.
+ *
+ * @addtogroup config
+ * @details Kernel related settings and hooks.
+ * @{
+ */
+
+#ifndef CHCONF_H
+#define CHCONF_H
+
+#define _CHIBIOS_RT_CONF_
+#define _CHIBIOS_RT_CONF_VER_7_0_
+
+/*===========================================================================*/
+/**
+ * @name System settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Handling of instances.
+ * @note If enabled then threads assigned to various instances can
+ * interact each other using the same synchronization objects.
+ * If disabled then each OS instance is a separate world, no
+ * direct interactions are handled by the OS.
+ */
+#if !defined(CH_CFG_SMP_MODE)
+#define CH_CFG_SMP_MODE FALSE
+#endif
+
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name System timers settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief System time counter resolution.
+ * @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
+ */
+#if !defined(CH_CFG_ST_RESOLUTION)
+#define CH_CFG_ST_RESOLUTION 32
+#endif
+
+/**
+ * @brief System tick frequency.
+ * @details Frequency of the system timer that drives the system ticks. This
+ * setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
+ */
+#if !defined(CH_CFG_ST_FREQUENCY)
+#define CH_CFG_ST_FREQUENCY 10000
+#endif
+
+/**
+ * @brief Time intervals data size.
+ * @note Allowed values are 16, 32 or 64 bits.
+ */
+#if !defined(CH_CFG_INTERVALS_SIZE)
+#define CH_CFG_INTERVALS_SIZE 32
+#endif
+
+/**
+ * @brief Time types data size.
+ * @note Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_TIME_TYPES_SIZE)
+#define CH_CFG_TIME_TYPES_SIZE 32
+#endif
+
+/**
+ * @brief Time delta constant for the tick-less mode.
+ * @note If this value is zero then the system uses the classic
+ * periodic tick. This value represents the minimum number
+ * of ticks that is safe to specify in a timeout directive.
+ * The value one is not valid, timeouts are rounded up to
+ * this value.
+ */
+#if !defined(CH_CFG_ST_TIMEDELTA)
+#define CH_CFG_ST_TIMEDELTA 2
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel parameters and options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Round robin interval.
+ * @details This constant is the number of system ticks allowed for the
+ * threads before preemption occurs. Setting this value to zero
+ * disables the preemption for threads with equal priority and the
+ * round robin becomes cooperative. Note that higher priority
+ * threads can still preempt, the kernel is always preemptive.
+ * @note Disabling the round robin preemption makes the kernel more compact
+ * and generally faster.
+ * @note The round robin preemption is not supported in tickless mode and
+ * must be set to zero in that case.
+ */
+#if !defined(CH_CFG_TIME_QUANTUM)
+#define CH_CFG_TIME_QUANTUM 0
+#endif
+
+/**
+ * @brief Idle thread automatic spawn suppression.
+ * @details When this option is activated the function @p chSysInit()
+ * does not spawn the idle thread. The application @p main()
+ * function becomes the idle thread and must implement an
+ * infinite loop.
+ */
+#if !defined(CH_CFG_NO_IDLE_THREAD)
+#define CH_CFG_NO_IDLE_THREAD FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Performance options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief OS optimization.
+ * @details If enabled then time efficient rather than space efficient code
+ * is used when two possible implementations exist.
+ *
+ * @note This is not related to the compiler optimization options.
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_OPTIMIZE_SPEED)
+#define CH_CFG_OPTIMIZE_SPEED TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Subsystem options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Time Measurement APIs.
+ * @details If enabled then the time measurement APIs are included in
+ * the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TM)
+#define CH_CFG_USE_TM TRUE
+#endif
+
+/**
+ * @brief Time Stamps APIs.
+ * @details If enabled then the time stamps APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TIMESTAMP)
+#define CH_CFG_USE_TIMESTAMP TRUE
+#endif
+
+/**
+ * @brief Threads registry APIs.
+ * @details If enabled then the registry APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_REGISTRY)
+#define CH_CFG_USE_REGISTRY TRUE
+#endif
+
+/**
+ * @brief Threads synchronization APIs.
+ * @details If enabled then the @p chThdWait() function is included in
+ * the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_WAITEXIT)
+#define CH_CFG_USE_WAITEXIT TRUE
+#endif
+
+/**
+ * @brief Semaphores APIs.
+ * @details If enabled then the Semaphores APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES)
+#define CH_CFG_USE_SEMAPHORES TRUE
+#endif
+
+/**
+ * @brief Semaphores queuing mode.
+ * @details If enabled then the threads are enqueued on semaphores by
+ * priority rather than in FIFO order.
+ *
+ * @note The default is @p FALSE. Enable this if you have special
+ * requirements.
+ * @note Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
+#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
+#endif
+
+/**
+ * @brief Mutexes APIs.
+ * @details If enabled then the mutexes APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MUTEXES)
+#define CH_CFG_USE_MUTEXES TRUE
+#endif
+
+/**
+ * @brief Enables recursive behavior on mutexes.
+ * @note Recursive mutexes are heavier and have an increased
+ * memory footprint.
+ *
+ * @note The default is @p FALSE.
+ * @note Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
+#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
+#endif
+
+/**
+ * @brief Conditional Variables APIs.
+ * @details If enabled then the conditional variables APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_CONDVARS)
+#define CH_CFG_USE_CONDVARS TRUE
+#endif
+
+/**
+ * @brief Conditional Variables APIs with timeout.
+ * @details If enabled then the conditional variables APIs with timeout
+ * specification are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_CONDVARS.
+ */
+#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
+#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
+#endif
+
+/**
+ * @brief Events Flags APIs.
+ * @details If enabled then the event flags APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_EVENTS)
+#define CH_CFG_USE_EVENTS TRUE
+#endif
+
+/**
+ * @brief Events Flags APIs with timeout.
+ * @details If enabled then the events APIs with timeout specification
+ * are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_EVENTS.
+ */
+#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
+#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
+#endif
+
+/**
+ * @brief Synchronous Messages APIs.
+ * @details If enabled then the synchronous messages APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MESSAGES)
+#define CH_CFG_USE_MESSAGES TRUE
+#endif
+
+/**
+ * @brief Synchronous Messages queuing mode.
+ * @details If enabled then messages are served by priority rather than in
+ * FIFO order.
+ *
+ * @note The default is @p FALSE. Enable this if you have special
+ * requirements.
+ * @note Requires @p CH_CFG_USE_MESSAGES.
+ */
+#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
+#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
+#endif
+
+/**
+ * @brief Dynamic Threads APIs.
+ * @details If enabled then the dynamic threads creation APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_WAITEXIT.
+ * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
+ */
+#if !defined(CH_CFG_USE_DYNAMIC)
+#define CH_CFG_USE_DYNAMIC TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name OSLIB options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Mailboxes APIs.
+ * @details If enabled then the asynchronous messages (mailboxes) APIs are
+ * included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_MAILBOXES)
+#define CH_CFG_USE_MAILBOXES TRUE
+#endif
+
+/**
+ * @brief Memory checks APIs.
+ * @details If enabled then the memory checks APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMCHECKS)
+#define CH_CFG_USE_MEMCHECKS TRUE
+#endif
+
+/**
+ * @brief Core Memory Manager APIs.
+ * @details If enabled then the core memory manager APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMCORE)
+#define CH_CFG_USE_MEMCORE TRUE
+#endif
+
+/**
+ * @brief Managed RAM size.
+ * @details Size of the RAM area to be managed by the OS. If set to zero
+ * then the whole available RAM is used. The core memory is made
+ * available to the heap allocator and/or can be used directly through
+ * the simplified core memory allocator.
+ *
+ * @note In order to let the OS manage the whole RAM the linker script must
+ * provide the @p __heap_base__ and @p __heap_end__ symbols.
+ * @note Requires @p CH_CFG_USE_MEMCORE.
+ */
+#if !defined(CH_CFG_MEMCORE_SIZE)
+#define CH_CFG_MEMCORE_SIZE 0
+#endif
+
+/**
+ * @brief Heap Allocator APIs.
+ * @details If enabled then the memory heap allocator APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
+ * @p CH_CFG_USE_SEMAPHORES.
+ * @note Mutexes are recommended.
+ */
+#if !defined(CH_CFG_USE_HEAP)
+#define CH_CFG_USE_HEAP TRUE
+#endif
+
+/**
+ * @brief Memory Pools Allocator APIs.
+ * @details If enabled then the memory pools allocator APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMPOOLS)
+#define CH_CFG_USE_MEMPOOLS TRUE
+#endif
+
+/**
+ * @brief Objects FIFOs APIs.
+ * @details If enabled then the objects FIFOs APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_FIFOS)
+#define CH_CFG_USE_OBJ_FIFOS TRUE
+#endif
+
+/**
+ * @brief Pipes APIs.
+ * @details If enabled then the pipes APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_PIPES)
+#define CH_CFG_USE_PIPES TRUE
+#endif
+
+/**
+ * @brief Objects Caches APIs.
+ * @details If enabled then the objects caches APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_CACHES)
+#define CH_CFG_USE_OBJ_CACHES TRUE
+#endif
+
+/**
+ * @brief Delegate threads APIs.
+ * @details If enabled then the delegate threads APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_DELEGATES)
+#define CH_CFG_USE_DELEGATES TRUE
+#endif
+
+/**
+ * @brief Jobs Queues APIs.
+ * @details If enabled then the jobs queues APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_JOBS)
+#define CH_CFG_USE_JOBS TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Objects factory options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Objects Factory APIs.
+ * @details If enabled then the objects factory APIs are included in the
+ * kernel.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_CFG_USE_FACTORY)
+#define CH_CFG_USE_FACTORY TRUE
+#endif
+
+/**
+ * @brief Maximum length for object names.
+ * @details If the specified length is zero then the name is stored by
+ * pointer but this could have unintended side effects.
+ */
+#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
+#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
+#endif
+
+/**
+ * @brief Enables the registry of generic objects.
+ */
+#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
+#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
+#endif
+
+/**
+ * @brief Enables factory for generic buffers.
+ */
+#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
+#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
+#endif
+
+/**
+ * @brief Enables factory for semaphores.
+ */
+#if !defined(CH_CFG_FACTORY_SEMAPHORES)
+#define CH_CFG_FACTORY_SEMAPHORES TRUE
+#endif
+
+/**
+ * @brief Enables factory for mailboxes.
+ */
+#if !defined(CH_CFG_FACTORY_MAILBOXES)
+#define CH_CFG_FACTORY_MAILBOXES TRUE
+#endif
+
+/**
+ * @brief Enables factory for objects FIFOs.
+ */
+#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
+#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
+#endif
+
+/**
+ * @brief Enables factory for Pipes.
+ */
+#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
+#define CH_CFG_FACTORY_PIPES TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Debug options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Debug option, kernel statistics.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_STATISTICS)
+#define CH_DBG_STATISTICS FALSE
+#endif
+
+/**
+ * @brief Debug option, system state check.
+ * @details If enabled the correct call protocol for system APIs is checked
+ * at runtime.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
+#define CH_DBG_SYSTEM_STATE_CHECK TRUE
+#endif
+
+/**
+ * @brief Debug option, parameters checks.
+ * @details If enabled then the checks on the API functions input
+ * parameters are activated.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_CHECKS)
+#define CH_DBG_ENABLE_CHECKS TRUE
+#endif
+
+/**
+ * @brief Debug option, consistency checks.
+ * @details If enabled then all the assertions in the kernel code are
+ * activated. This includes consistency checks inside the kernel,
+ * runtime anomalies and port-defined checks.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_ASSERTS)
+#define CH_DBG_ENABLE_ASSERTS TRUE
+#endif
+
+/**
+ * @brief Debug option, trace buffer.
+ * @details If enabled then the trace buffer is activated.
+ *
+ * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_MASK)
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
+#endif
+
+/**
+ * @brief Trace buffer entries.
+ * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
+ * different from @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
+#define CH_DBG_TRACE_BUFFER_SIZE 128
+#endif
+
+/**
+ * @brief Debug option, stack checks.
+ * @details If enabled then a runtime stack check is performed.
+ *
+ * @note The default is @p FALSE.
+ * @note The stack check is performed in a architecture/port dependent way.
+ * It may not be implemented or some ports.
+ * @note The default failure mode is to halt the system with the global
+ * @p panic_msg variable set to @p NULL.
+ */
+#if !defined(CH_DBG_ENABLE_STACK_CHECK)
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
+#endif
+
+/**
+ * @brief Debug option, stacks initialization.
+ * @details If enabled then the threads working area is filled with a byte
+ * value when a thread is created. This can be useful for the
+ * runtime measurement of the used stack.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_FILL_THREADS)
+#define CH_DBG_FILL_THREADS FALSE
+#endif
+
+/**
+ * @brief Debug option, threads profiling.
+ * @details If enabled then a field is added to the @p thread_t structure that
+ * counts the system ticks occurred while executing the thread.
+ *
+ * @note The default is @p FALSE.
+ * @note This debug option is not currently compatible with the
+ * tickless mode.
+ */
+#if !defined(CH_DBG_THREADS_PROFILING)
+#define CH_DBG_THREADS_PROFILING FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel hooks
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief System structure extension.
+ * @details User fields added to the end of the @p ch_system_t structure.
+ */
+#define CH_CFG_SYSTEM_EXTRA_FIELDS \
+ /* Add system custom fields here.*/
+
+/**
+ * @brief System initialization hook.
+ * @details User initialization code added to the @p chSysInit() function
+ * just before interrupts are enabled globally.
+ */
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
+ /* Add system initialization code here.*/ \
+} while (false)
+
+/**
+ * @brief OS instance structure extension.
+ * @details User fields added to the end of the @p os_instance_t structure.
+ */
+#define CH_CFG_OS_INSTANCE_EXTRA_FIELDS \
+ /* Add OS instance custom fields here.*/
+
+/**
+ * @brief OS instance initialization hook.
+ *
+ * @param[in] oip pointer to the @p os_instance_t structure
+ */
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
+ /* Add OS instance initialization code here.*/ \
+} while (false)
+
+/**
+ * @brief Threads descriptor structure extension.
+ * @details User fields added to the end of the @p thread_t structure.
+ */
+#define CH_CFG_THREAD_EXTRA_FIELDS \
+ /* Add threads custom fields here.*/
+
+/**
+ * @brief Threads initialization hook.
+ * @details User initialization code added to the @p _thread_init() function.
+ *
+ * @note It is invoked from within @p _thread_init() and implicitly from all
+ * the threads creation APIs.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
+ */
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
+ /* Add threads initialization code here.*/ \
+} while (false)
+
+/**
+ * @brief Threads finalization hook.
+ * @details User finalization code added to the @p chThdExit() API.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
+ */
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
+ /* Add threads finalization code here.*/ \
+} while (false)
+
+/**
+ * @brief Context switch hook.
+ * @details This hook is invoked just before switching between threads.
+ *
+ * @param[in] ntp thread being switched in
+ * @param[in] otp thread being switched out
+ */
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
+ /* Context switch code here.*/ \
+} while (false)
+
+/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
+ /* IRQ prologue code here.*/ \
+} while (false)
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
+ /* IRQ epilogue code here.*/ \
+} while (false)
+
+/**
+ * @brief Idle thread enter hook.
+ * @note This hook is invoked within a critical zone, no OS functions
+ * should be invoked from here.
+ * @note This macro can be used to activate a power saving mode.
+ */
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
+ /* Idle-enter code here.*/ \
+} while (false)
+
+/**
+ * @brief Idle thread leave hook.
+ * @note This hook is invoked within a critical zone, no OS functions
+ * should be invoked from here.
+ * @note This macro can be used to deactivate a power saving mode.
+ */
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
+ /* Idle-leave code here.*/ \
+} while (false)
+
+/**
+ * @brief Idle Loop hook.
+ * @details This hook is continuously invoked by the idle thread loop.
+ */
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
+ /* Idle loop code here.*/ \
+} while (false)
+
+/**
+ * @brief System tick event hook.
+ * @details This hook is invoked in the system tick handler immediately
+ * after processing the virtual timers queue.
+ */
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
+ /* System tick event code here.*/ \
+} while (false)
+
+/**
+ * @brief System halt hook.
+ * @details This hook is invoked in case to a system halting error before
+ * the system is halted.
+ */
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
+ /* System halt code here.*/ \
+} while (false)
+
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) do { \
+ /* Trace code here.*/ \
+} while (false)
+
+/**
+ * @brief Runtime Faults Collection Unit hook.
+ * @details This hook is invoked each time new faults are collected and stored.
+ */
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
+ /* Faults handling code here.*/ \
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
+
+/** @} */
+
+/*===========================================================================*/
+/* Port-specific settings (override port settings defaulted in chcore.h). */
+/*===========================================================================*/
+
+#endif /* CHCONF_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/config.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/config.h
new file mode 100644
index 0000000000..74e0f4980d
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/config.h
@@ -0,0 +1,39 @@
+/*
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/*
+ * CRC driver system settings.
+ */
+#define AT32_CRC_USE_CRC1 FALSE
+
+#define CRC_USE_DMA FALSE
+#define AT32_CRC_CRC1_DMA_PRIORITY 2
+#define AT32_CRC_CRC1_IRQ_PRIORITY 5
+#define AT32_CRC_CRC1_DMA_STREAM AT32_DMA_STREAM_ID_ANY
+
+/*
+ * I2C fallback driver system settings.
+ */
+#define SW_I2C_USE_I2C1 FALSE
+#define SW_I2C_USE_I2C2 FALSE
+#define SW_I2C_USE_I2C3 FALSE
+#define SW_I2C_USE_I2C4 FALSE
+
+/*
+ * Other settings.
+ */
+#define BOARD_OTG_VBUSIG
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/halconf.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/halconf.h
new file mode 100644
index 0000000000..cc71e5074d
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/halconf.h
@@ -0,0 +1,588 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file templates/halconf.h
+ * @brief HAL configuration header.
+ * @details HAL configuration file, this file allows to enable or disable the
+ * various device drivers from your application. You may also use
+ * this file in order to override the device drivers default settings.
+ *
+ * @addtogroup HAL_CONF
+ * @{
+ */
+
+#ifndef HALCONF_H
+#define HALCONF_H
+
+#define _CHIBIOS_HAL_CONF_
+#define _CHIBIOS_HAL_CONF_VER_9_1_
+
+#include "mcuconf.h"
+
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
+/**
+ * @brief Enables the PAL subsystem.
+ */
+#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
+#define HAL_USE_PAL TRUE
+#endif
+
+/**
+ * @brief Enables the ADC subsystem.
+ */
+#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
+#define HAL_USE_ADC FALSE
+#endif
+
+/**
+ * @brief Enables the CAN subsystem.
+ */
+#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
+#define HAL_USE_CAN FALSE
+#endif
+
+/**
+ * @brief Enables the cryptographic subsystem.
+ */
+#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
+#define HAL_USE_CRY FALSE
+#endif
+
+/**
+ * @brief Enables the DAC subsystem.
+ */
+#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
+#define HAL_USE_DAC FALSE
+#endif
+
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
+/**
+ * @brief Enables the EFlash subsystem.
+ */
+#if !defined(HAL_USE_EFL) || defined(__DOXYGEN__)
+#define HAL_USE_EFL FALSE
+#endif
+
+/**
+ * @brief Enables the GPT subsystem.
+ */
+#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
+#define HAL_USE_GPT FALSE
+#endif
+
+/**
+ * @brief Enables the I2C subsystem.
+ */
+#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
+#define HAL_USE_I2C TRUE
+#endif
+
+/**
+ * @brief Enables the I2S subsystem.
+ */
+#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
+#define HAL_USE_I2S FALSE
+#endif
+
+/**
+ * @brief Enables the ICU subsystem.
+ */
+#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
+#define HAL_USE_ICU FALSE
+#endif
+
+/**
+ * @brief Enables the MAC subsystem.
+ */
+#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
+#define HAL_USE_MAC FALSE
+#endif
+
+/**
+ * @brief Enables the MMC_SPI subsystem.
+ */
+#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
+#define HAL_USE_MMC_SPI FALSE
+#endif
+
+/**
+ * @brief Enables the PWM subsystem.
+ */
+#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
+#define HAL_USE_PWM FALSE
+#endif
+
+/**
+ * @brief Enables the RTC subsystem.
+ */
+#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
+#define HAL_USE_RTC FALSE
+#endif
+
+/**
+ * @brief Enables the SDC subsystem.
+ */
+#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
+#define HAL_USE_SDC FALSE
+#endif
+
+/**
+ * @brief Enables the SERIAL subsystem.
+ */
+#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
+#define HAL_USE_SERIAL FALSE
+#endif
+
+/**
+ * @brief Enables the SERIAL over USB subsystem.
+ */
+#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
+#define HAL_USE_SERIAL_USB FALSE
+#endif
+
+/**
+ * @brief Enables the SIO subsystem.
+ */
+#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
+#define HAL_USE_SIO FALSE
+#endif
+
+/**
+ * @brief Enables the SPI subsystem.
+ */
+#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
+#define HAL_USE_SPI FALSE
+#endif
+
+/**
+ * @brief Enables the TRNG subsystem.
+ */
+#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
+#define HAL_USE_TRNG FALSE
+#endif
+
+/**
+ * @brief Enables the UART subsystem.
+ */
+#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
+#define HAL_USE_UART FALSE
+#endif
+
+/**
+ * @brief Enables the USB subsystem.
+ */
+#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
+#define HAL_USE_USB FALSE
+#endif
+
+/**
+ * @brief Enables the WDG subsystem.
+ */
+#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
+#define HAL_USE_WDG FALSE
+#endif
+
+/**
+ * @brief Enables the WSPI subsystem.
+ */
+#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
+#define HAL_USE_WSPI FALSE
+#endif
+
+/*===========================================================================*/
+/* PAL driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define PAL_USE_CALLBACKS FALSE
+#endif
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
+#define PAL_USE_WAIT FALSE
+#endif
+
+/*===========================================================================*/
+/* ADC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
+#define ADC_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define ADC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* CAN driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Sleep mode related APIs inclusion switch.
+ */
+#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
+#define CAN_USE_SLEEP_MODE TRUE
+#endif
+
+/**
+ * @brief Enforces the driver to use direct callbacks rather than OSAL events.
+ */
+#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define CAN_ENFORCE_USE_CALLBACKS FALSE
+#endif
+
+/*===========================================================================*/
+/* CRY driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the SW fall-back of the cryptographic driver.
+ * @details When enabled, this option, activates a fall-back software
+ * implementation for algorithms not supported by the underlying
+ * hardware.
+ * @note Fall-back implementations may not be present for all algorithms.
+ */
+#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
+#define HAL_CRY_USE_FALLBACK FALSE
+#endif
+
+/**
+ * @brief Makes the driver forcibly use the fall-back implementations.
+ */
+#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
+#define HAL_CRY_ENFORCE_FALLBACK FALSE
+#endif
+
+/*===========================================================================*/
+/* DAC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
+#define DAC_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define DAC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* I2C driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE TRUE
+#endif
+
+/**
+ * @brief Enables the mutual exclusion APIs on the I2C bus.
+ */
+#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define I2C_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* MAC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the zero-copy API.
+ */
+#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
+#define MAC_USE_ZERO_COPY FALSE
+#endif
+
+/**
+ * @brief Enables an event sources for incoming packets.
+ */
+#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
+#define MAC_USE_EVENTS TRUE
+#endif
+
+/*===========================================================================*/
+/* MMC_SPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Timeout before assuming a failure while waiting for card idle.
+ * @note Time is in milliseconds.
+ */
+#if !defined(MMC_IDLE_TIMEOUT_MS) || defined(__DOXYGEN__)
+#define MMC_IDLE_TIMEOUT_MS 1000
+#endif
+
+/**
+ * @brief Mutual exclusion on the SPI bus.
+ */
+#if !defined(MMC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define MMC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* SDC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Number of initialization attempts before rejecting the card.
+ * @note Attempts are performed at 10mS intervals.
+ */
+#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
+#define SDC_INIT_RETRY 100
+#endif
+
+/**
+ * @brief Include support for MMC cards.
+ * @note MMC support is not yet implemented so this option must be kept
+ * at @p FALSE.
+ */
+#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
+#define SDC_MMC_SUPPORT FALSE
+#endif
+
+/**
+ * @brief Delays insertions.
+ * @details If enabled this options inserts delays into the MMC waiting
+ * routines releasing some extra CPU time for the threads with
+ * lower priority, this may slow down the driver a bit however.
+ */
+#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
+#define SDC_NICE_WAITING TRUE
+#endif
+
+/**
+ * @brief OCR initialization constant for V20 cards.
+ */
+#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR_V20 0x50FF8000U
+#endif
+
+/**
+ * @brief OCR initialization constant for non-V20 cards.
+ */
+#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR 0x80100000U
+#endif
+
+/*===========================================================================*/
+/* SERIAL driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Default bit rate.
+ * @details Configuration parameter, this is the baud rate selected for the
+ * default configuration.
+ */
+#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
+#define SERIAL_DEFAULT_BITRATE 38400
+#endif
+
+/**
+ * @brief Serial buffers size.
+ * @details Configuration parameter, you can change the depth of the queue
+ * buffers depending on the requirements of your application.
+ * @note The default is 16 bytes for both the transmission and receive
+ * buffers.
+ */
+#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
+#define SERIAL_BUFFERS_SIZE 16
+#endif
+
+/*===========================================================================*/
+/* SIO driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Default bit rate.
+ * @details Configuration parameter, this is the baud rate selected for the
+ * default configuration.
+ */
+#if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__)
+#define SIO_DEFAULT_BITRATE 38400
+#endif
+
+/**
+ * @brief Support for thread synchronization API.
+ */
+#if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__)
+#define SIO_USE_SYNCHRONIZATION TRUE
+#endif
+
+/*===========================================================================*/
+/* SERIAL_USB driver related setting. */
+/*===========================================================================*/
+
+/**
+ * @brief Serial over USB buffers size.
+ * @details Configuration parameter, the buffer size must be a multiple of
+ * the USB data endpoint maximum packet size.
+ * @note The default is 256 bytes for both the transmission and receive
+ * buffers.
+ */
+#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
+#define SERIAL_USB_BUFFERS_SIZE 256
+#endif
+
+/**
+ * @brief Serial over USB number of buffers.
+ * @note The default is 2 buffers.
+ */
+#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
+#define SERIAL_USB_BUFFERS_NUMBER 2
+#endif
+
+/*===========================================================================*/
+/* SPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
+#define SPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Inserts an assertion on function errors before returning.
+ */
+#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__)
+#define SPI_USE_ASSERT_ON_ERROR TRUE
+#endif
+
+/**
+ * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define SPI_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/**
+ * @brief Handling method for SPI CS line.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
+#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
+#endif
+
+/*===========================================================================*/
+/* UART driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
+#define UART_USE_WAIT FALSE
+#endif
+
+/**
+ * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define UART_USE_MUTUAL_EXCLUSION FALSE
+#endif
+
+/*===========================================================================*/
+/* USB driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
+#define USB_USE_WAIT FALSE
+#endif
+
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
+/*===========================================================================*/
+/* WSPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
+#define WSPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define WSPI_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+#include "halconf_community.h"
+
+#endif /* HALCONF_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/halconf_community.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/halconf_community.h
new file mode 100644
index 0000000000..e21bd723b7
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/halconf_community.h
@@ -0,0 +1,182 @@
+/*
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef HALCONF_COMMUNITY_H
+#define HALCONF_COMMUNITY_H
+
+/**
+ * @brief Enables the community overlay.
+ */
+#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
+#define HAL_USE_COMMUNITY TRUE
+#endif
+
+/**
+ * @brief Enables the FSMC subsystem.
+ */
+#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__)
+#define HAL_USE_FSMC FALSE
+#endif
+
+/**
+ * @brief Enables the NAND subsystem.
+ */
+#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__)
+#define HAL_USE_NAND FALSE
+#endif
+
+/**
+ * @brief Enables the 1-wire subsystem.
+ */
+#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__)
+#define HAL_USE_ONEWIRE FALSE
+#endif
+
+/**
+ * @brief Enables the EICU subsystem.
+ */
+#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__)
+#define HAL_USE_EICU FALSE
+#endif
+
+/**
+ * @brief Enables the CRC subsystem.
+ */
+#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__)
+#define HAL_USE_CRC FALSE
+#endif
+
+/**
+ * @brief Enables the RNG subsystem.
+ */
+#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__)
+#define HAL_USE_RNG FALSE
+#endif
+
+/**
+ * @brief Enables the EEPROM subsystem.
+ */
+#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__)
+#define HAL_USE_EEPROM FALSE
+#endif
+
+/**
+ * @brief Enables the TIMCAP subsystem.
+ */
+#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__)
+#define HAL_USE_TIMCAP FALSE
+#endif
+
+/**
+ * @brief Enables the COMP subsystem.
+ */
+#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__)
+#define HAL_USE_COMP FALSE
+#endif
+
+/**
+ * @brief Enables the OPAMP subsystem.
+ */
+#if !defined(HAL_USE_OPAMP) || defined(__DOXYGEN__)
+#define HAL_USE_OPAMP FALSE
+#endif
+
+/**
+ * @brief Enables the QEI subsystem.
+ */
+#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__)
+#define HAL_USE_QEI FALSE
+#endif
+
+/**
+ * @brief Enables the USBH subsystem.
+ */
+#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__)
+#define HAL_USE_USBH FALSE
+#endif
+
+/**
+ * @brief Enables the USB_MSD subsystem.
+ */
+#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__)
+#define HAL_USE_USB_MSD FALSE
+#endif
+
+/*===========================================================================*/
+/* FSMCNAND driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define NAND_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* 1-wire driver related settings. */
+/*===========================================================================*/
+/**
+ * @brief Enables strong pull up feature.
+ * @note Disabling this option saves both code and data space.
+ */
+#define ONEWIRE_USE_STRONG_PULLUP FALSE
+
+/**
+ * @brief Enables search ROM feature.
+ * @note Disabling this option saves both code and data space.
+ */
+#define ONEWIRE_USE_SEARCH_ROM TRUE
+
+/*===========================================================================*/
+/* QEI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables discard of overlow
+ */
+#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__)
+#define QEI_USE_OVERFLOW_DISCARD FALSE
+#endif
+
+/**
+ * @brief Enables min max of overlow
+ */
+#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__)
+#define QEI_USE_OVERFLOW_MINMAX FALSE
+#endif
+
+/*===========================================================================*/
+/* EEProm driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables 24xx series I2C eeprom device driver.
+ * @note Disabling this option saves both code and data space.
+ */
+#define EEPROM_USE_EE24XX FALSE
+ /**
+ * @brief Enables 25xx series SPI eeprom device driver.
+ * @note Disabling this option saves both code and data space.
+ */
+#define EEPROM_USE_EE25XX FALSE
+
+#endif /* HALCONF_COMMUNITY_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/mcuconf.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/mcuconf.h
new file mode 100644
index 0000000000..8c327ddc6b
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/mcuconf.h
@@ -0,0 +1,269 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef MCUCONF_H
+#define MCUCONF_H
+
+/*
+ * AT32F402 drivers configuration.
+ * The following settings override the default settings present in
+ * the various device driver implementation headers.
+ * Note that the settings for each driver only have effect if the whole
+ * driver is enabled in halconf.h.
+ *
+ * IRQ priorities:
+ * 15...0 Lowest...Highest.
+ *
+ * DMA priorities:
+ * 0...3 Lowest...Highest.
+ */
+
+#define AT32F402_MCUCONF
+
+/*
+ * General settings.
+ */
+#define AT32_NO_INIT FALSE
+
+/*
+ * HAL driver system settings.
+ */
+#define AT32_HICK_ENABLED TRUE
+#define AT32_LICK_ENABLED FALSE
+#define AT32_HEXT_ENABLED TRUE
+#define AT32_LEXT_ENABLED FALSE
+#define AT32_PLLU_ENABLED TRUE
+#define AT32_SCLKSEL AT32_SCLKSEL_PLL
+#define AT32_PLLRCS AT32_PLLRCS_HEXT
+#define AT32_PLL_MS_VALUE 1
+#define AT32_PLL_NS_VALUE 72
+#define AT32_PLL_FP_VALUE 4
+#define AT32_PLL_FU_VALUE 18
+#define AT32_AHBDIV AT32_AHBDIV_DIV1
+#define AT32_APB1DIV AT32_APB1DIV_DIV2
+#define AT32_APB2DIV AT32_APB2DIV_DIV1
+#define AT32_HICK_TO_SCLK AT32_HICK_TO_SCLK_48M
+#define AT32_HICKDIV AT32_HICKDIV_DIV1
+#define AT32_HICK_TO_SCLK_DIV AT32_HICK_TO_SCLK_DIV_DIV1
+#define AT32_HEXT_TO_SCLK_DIV AT32_HEXT_TO_SCLK_DIV_DIV1
+#define AT32_USB_CLOCK48_REQUIRED TRUE
+#define AT32_PLLU_USB48_SEL AT32_PLLU_USB48_SEL_PLLU
+#define AT32_CLKOUT_SEL AT32_CLKOUT_SEL_HICK
+#define AT32_CLKOUTDIV1 AT32_CLKOUTDIV1_DIV1
+#define AT32_CLKOUTDIV2 AT32_CLKOUTDIV2_DIV1
+#define AT32_ERTCSEL AT32_ERTCSEL_NOCLOCK
+#define AT32_ERTCDIV_VALUE 12
+#define AT32_I2SF5CLKSEL AT32_I2SF5CLKSEL_SCLK
+#define AT32_PVM_ENABLE FALSE
+#define AT32_PVMSEL AT32_PVMSEL_LEV1
+#define AT32_LDOOVSEL AT32_LDOOVSEL_LEV3
+
+/*
+ * IRQ system settings.
+ */
+#define AT32_IRQ_EXINT0_PRIORITY 6
+#define AT32_IRQ_EXINT1_PRIORITY 6
+#define AT32_IRQ_EXINT2_PRIORITY 6
+#define AT32_IRQ_EXINT3_PRIORITY 6
+#define AT32_IRQ_EXINT4_PRIORITY 6
+#define AT32_IRQ_EXINT5_9_PRIORITY 6
+#define AT32_IRQ_EXINT10_15_PRIORITY 6
+#define AT32_IRQ_EXINT16_PRIORITY 6
+#define AT32_IRQ_EXINT17_PRIORITY 15
+#define AT32_IRQ_EXINT18_PRIORITY 6
+#define AT32_IRQ_EXINT20_PRIORITY 6
+#define AT32_IRQ_EXINT21_PRIORITY 15
+#define AT32_IRQ_EXINT22_PRIORITY 15
+
+#define AT32_IRQ_TMR1_BRK_TMR9_PRIORITY 7
+#define AT32_IRQ_TMR1_OVF_TMR10_PRIORITY 7
+#define AT32_IRQ_TMR1_HALL_TMR11_PRIORITY 7
+#define AT32_IRQ_TMR1_CH_PRIORITY 7
+#define AT32_IRQ_TMR2_PRIORITY 7
+#define AT32_IRQ_TMR3_PRIORITY 7
+#define AT32_IRQ_TMR4_PRIORITY 7
+#define AT32_IRQ_TMR6_PRIORITY 7
+#define AT32_IRQ_TMR7_PRIORITY 7
+#define AT32_IRQ_TMR13_PRIORITY 7
+#define AT32_IRQ_TMR14_PRIORITY 7
+
+#define AT32_IRQ_USART1_PRIORITY 12
+#define AT32_IRQ_USART2_PRIORITY 12
+#define AT32_IRQ_USART3_PRIORITY 12
+#define AT32_IRQ_UART4_PRIORITY 12
+#define AT32_IRQ_UART5_PRIORITY 12
+#define AT32_IRQ_USART6_PRIORITY 12
+#define AT32_IRQ_UART7_PRIORITY 12
+#define AT32_IRQ_UART8_PRIORITY 12
+
+/*
+ * ADC driver system settings.
+ */
+#define AT32_ADC_USE_ADC1 FALSE
+#define AT32_ADC_ADC1_DMA_PRIORITY 2
+#define AT32_ADC_IRQ_PRIORITY 6
+#define AT32_ADC_ADC1_DMA_IRQ_PRIORITY 6
+#define AT32_ADC_ADCDIV 8
+
+/*
+ * CAN driver system settings.
+ */
+#define AT32_CAN_USE_CAN1 FALSE
+#define AT32_CAN_CAN1_IRQ_PRIORITY 11
+
+/*
+ * GPT driver system settings.
+ */
+#define AT32_GPT_USE_TMR1 FALSE
+#define AT32_GPT_USE_TMR2 FALSE
+#define AT32_GPT_USE_TMR3 FALSE
+#define AT32_GPT_USE_TMR4 FALSE
+#define AT32_GPT_USE_TMR6 FALSE
+#define AT32_GPT_USE_TMR7 FALSE
+#define AT32_GPT_USE_TMR9 FALSE
+#define AT32_GPT_USE_TMR10 FALSE
+#define AT32_GPT_USE_TMR11 FALSE
+#define AT32_GPT_USE_TMR13 FALSE
+#define AT32_GPT_USE_TMR14 FALSE
+
+/*
+ * I2C driver system settings.
+ */
+#define AT32_I2C_USE_I2C1 TRUE
+#define AT32_I2C_USE_I2C2 TRUE
+#define AT32_I2C_USE_I2C3 FALSE
+#define AT32_I2C_BUSY_TIMEOUT 50
+#define AT32_I2C_I2C1_DMA_PRIORITY 3
+#define AT32_I2C_I2C2_DMA_PRIORITY 3
+#define AT32_I2C_I2C3_DMA_PRIORITY 3
+#define AT32_I2C_I2C1_IRQ_PRIORITY 5
+#define AT32_I2C_I2C2_IRQ_PRIORITY 5
+#define AT32_I2C_I2C3_IRQ_PRIORITY 5
+#define AT32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
+
+/*
+ * ICU driver system settings.
+ */
+#define AT32_ICU_USE_TMR1 FALSE
+#define AT32_ICU_USE_TMR2 FALSE
+#define AT32_ICU_USE_TMR3 FALSE
+#define AT32_ICU_USE_TMR4 FALSE
+#define AT32_ICU_USE_TMR9 FALSE
+
+/*
+ * PWM driver system settings.
+ */
+#define AT32_PWM_USE_TMR1 FALSE
+#define AT32_PWM_USE_TMR2 FALSE
+#define AT32_PWM_USE_TMR3 FALSE
+#define AT32_PWM_USE_TMR4 FALSE
+#define AT32_PWM_USE_TMR9 FALSE
+#define AT32_PWM_USE_TMR10 FALSE
+#define AT32_PWM_USE_TMR11 FALSE
+#define AT32_PWM_USE_TMR13 FALSE
+#define AT32_PWM_USE_TMR14 FALSE
+
+/*
+ * RTC driver system settings.
+ */
+#define AT32_ERTC_DIVA_VALUE 32
+#define AT32_ERTC_DIVB_VALUE 1024
+#define AT32_ERTC_CTRL_INIT 0
+#define AT32_ERTC_TAMP_INIT 0
+
+/*
+ * SERIAL driver system settings.
+ */
+#define AT32_SERIAL_USE_USART1 FALSE
+#define AT32_SERIAL_USE_USART2 FALSE
+#define AT32_SERIAL_USE_USART3 FALSE
+#define AT32_SERIAL_USE_UART4 FALSE
+#define AT32_SERIAL_USE_UART5 FALSE
+#define AT32_SERIAL_USE_USART6 FALSE
+#define AT32_SERIAL_USE_UART7 FALSE
+#define AT32_SERIAL_USE_UART8 FALSE
+
+/*
+ * SIO driver system settings.
+ */
+#define AT32_SIO_USE_USART1 FALSE
+#define AT32_SIO_USE_USART2 FALSE
+#define AT32_SIO_USE_USART3 FALSE
+#define AT32_SIO_USE_UART4 FALSE
+#define AT32_SIO_USE_UART5 FALSE
+#define AT32_SIO_USE_USART6 FALSE
+#define AT32_SIO_USE_UART7 FALSE
+#define AT32_SIO_USE_UART8 FALSE
+
+/*
+ * SPI driver system settings.
+ */
+#define AT32_SPI_USE_SPI1 FALSE
+#define AT32_SPI_USE_SPI2 FALSE
+#define AT32_SPI_USE_SPI3 FALSE
+#define AT32_SPI_SPI1_DMA_PRIORITY 1
+#define AT32_SPI_SPI2_DMA_PRIORITY 1
+#define AT32_SPI_SPI3_DMA_PRIORITY 1
+#define AT32_SPI_SPI1_IRQ_PRIORITY 10
+#define AT32_SPI_SPI2_IRQ_PRIORITY 10
+#define AT32_SPI_SPI3_IRQ_PRIORITY 10
+#define AT32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
+
+/*
+ * ST driver system settings.
+ */
+#define AT32_ST_IRQ_PRIORITY 8
+#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
+
+/*
+ * UART driver system settings.
+ */
+#define AT32_UART_USE_USART1 FALSE
+#define AT32_UART_USE_USART2 FALSE
+#define AT32_UART_USE_USART3 FALSE
+#define AT32_UART_USE_UART4 FALSE
+#define AT32_UART_USE_UART5 FALSE
+#define AT32_UART_USE_USART6 FALSE
+#define AT32_UART_USE_UART7 FALSE
+#define AT32_UART_USE_UART8 FALSE
+#define AT32_UART_USART1_DMA_PRIORITY 0
+#define AT32_UART_USART2_DMA_PRIORITY 0
+#define AT32_UART_USART3_DMA_PRIORITY 0
+#define AT32_UART_UART4_DMA_PRIORITY 0
+#define AT32_UART_UART5_DMA_PRIORITY 0
+#define AT32_UART_USART6_DMA_PRIORITY 0
+#define AT32_UART_UART7_DMA_PRIORITY 0
+#define AT32_UART_UART8_DMA_PRIORITY 0
+#define AT32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
+
+/*
+ * USB driver system settings.
+ */
+#define AT32_USB_USE_OTG1 FALSE
+#define AT32_USB_OTG1_IRQ_PRIORITY 14
+#define AT32_USB_OTG1_RX_FIFO_SIZE 512
+
+/*
+ * WDG driver system settings.
+ */
+#define AT32_WDG_USE_WDT FALSE
+
+#include "config.h"
+
+#endif /* MCUCONF_H */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/portab.c b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/portab.c
new file mode 100644
index 0000000000..9a3520e18f
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/portab.c
@@ -0,0 +1,81 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file portab.c
+ * @brief Application portability module code.
+ *
+ * @addtogroup application_portability
+ * @{
+ */
+
+#include "hal.h"
+
+#include "portab.h"
+
+/*===========================================================================*/
+/* Module local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported variables. */
+/*===========================================================================*/
+
+/*
+ * I2C driver configuration structure.
+ */
+I2CConfig i2ccfg = {
+ AT32_CLKCTRL_DIV(9U) |
+ AT32_CLKCTRL_SCLD(14U) | AT32_CLKCTRL_SDAD(0U) |
+ AT32_CLKCTRL_SCLH(49U) | AT32_CLKCTRL_SCLL(49U),
+ 0,
+ 0
+};
+
+/*===========================================================================*/
+/* Module local types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported functions. */
+/*===========================================================================*/
+
+void portab_setup(void) {
+
+ /* Master I2C1 SCL on PB6, SDA on PB7 */
+ palSetPadMode(GPIOB, 6, PAL_MODE_MUX(4) | PAL_AT32_OMODE_OPENDRAIN |
+ PAL_AT32_PULL_PULLUP);
+ palSetPadMode(GPIOB, 7, PAL_MODE_MUX(4) | PAL_AT32_OMODE_OPENDRAIN |
+ PAL_AT32_PULL_PULLUP);
+
+ /* Slave I2C2 SCL on PB10, SDA on PB11 */
+ palSetPadMode(GPIOB, 10, PAL_MODE_MUX(4) | PAL_AT32_OMODE_OPENDRAIN |
+ PAL_AT32_PULL_PULLUP);
+ palSetPadMode(GPIOB, 11, PAL_MODE_MUX(4) | PAL_AT32_OMODE_OPENDRAIN |
+ PAL_AT32_PULL_PULLUP);
+}
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/portab.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/portab.h
new file mode 100644
index 0000000000..89faf985cc
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f402/portab.h
@@ -0,0 +1,81 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file portab.h
+ * @brief Application portability macros and structures.
+ *
+ * @addtogroup application_portability
+ * @{
+ */
+
+#ifndef PORTAB_H
+#define PORTAB_H
+
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+#define PORTAB_LINE_BUTTON LINE_BUTTON
+
+#define PORTAB_I2C_MASTER I2CD1
+#define PORTAB_I2C_SLAVE I2CD2
+
+#define PORTAB_BLINK_LED1 LINE_LED_RED
+#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
+#define PORTAB_BLINK_LED3 LINE_LED_GREEN
+
+#define PORTAB_SECTION
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+extern I2CConfig i2ccfg;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void portab_setup(void);
+#ifdef __cplusplus
+}
+#endif
+
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
+#endif /* PORTAB_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/chconf.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/chconf.h
new file mode 100644
index 0000000000..e87d2f17e6
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/chconf.h
@@ -0,0 +1,857 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file rt/templates/chconf.h
+ * @brief Configuration file template.
+ * @details A copy of this file must be placed in each project directory, it
+ * contains the application specific kernel settings.
+ *
+ * @addtogroup config
+ * @details Kernel related settings and hooks.
+ * @{
+ */
+
+#ifndef CHCONF_H
+#define CHCONF_H
+
+#define _CHIBIOS_RT_CONF_
+#define _CHIBIOS_RT_CONF_VER_7_0_
+
+/*===========================================================================*/
+/**
+ * @name System settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Handling of instances.
+ * @note If enabled then threads assigned to various instances can
+ * interact each other using the same synchronization objects.
+ * If disabled then each OS instance is a separate world, no
+ * direct interactions are handled by the OS.
+ */
+#if !defined(CH_CFG_SMP_MODE)
+#define CH_CFG_SMP_MODE FALSE
+#endif
+
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name System timers settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief System time counter resolution.
+ * @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
+ */
+#if !defined(CH_CFG_ST_RESOLUTION)
+#define CH_CFG_ST_RESOLUTION 32
+#endif
+
+/**
+ * @brief System tick frequency.
+ * @details Frequency of the system timer that drives the system ticks. This
+ * setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
+ */
+#if !defined(CH_CFG_ST_FREQUENCY)
+#define CH_CFG_ST_FREQUENCY 10000
+#endif
+
+/**
+ * @brief Time intervals data size.
+ * @note Allowed values are 16, 32 or 64 bits.
+ */
+#if !defined(CH_CFG_INTERVALS_SIZE)
+#define CH_CFG_INTERVALS_SIZE 32
+#endif
+
+/**
+ * @brief Time types data size.
+ * @note Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_TIME_TYPES_SIZE)
+#define CH_CFG_TIME_TYPES_SIZE 32
+#endif
+
+/**
+ * @brief Time delta constant for the tick-less mode.
+ * @note If this value is zero then the system uses the classic
+ * periodic tick. This value represents the minimum number
+ * of ticks that is safe to specify in a timeout directive.
+ * The value one is not valid, timeouts are rounded up to
+ * this value.
+ */
+#if !defined(CH_CFG_ST_TIMEDELTA)
+#define CH_CFG_ST_TIMEDELTA 2
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel parameters and options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Round robin interval.
+ * @details This constant is the number of system ticks allowed for the
+ * threads before preemption occurs. Setting this value to zero
+ * disables the preemption for threads with equal priority and the
+ * round robin becomes cooperative. Note that higher priority
+ * threads can still preempt, the kernel is always preemptive.
+ * @note Disabling the round robin preemption makes the kernel more compact
+ * and generally faster.
+ * @note The round robin preemption is not supported in tickless mode and
+ * must be set to zero in that case.
+ */
+#if !defined(CH_CFG_TIME_QUANTUM)
+#define CH_CFG_TIME_QUANTUM 0
+#endif
+
+/**
+ * @brief Idle thread automatic spawn suppression.
+ * @details When this option is activated the function @p chSysInit()
+ * does not spawn the idle thread. The application @p main()
+ * function becomes the idle thread and must implement an
+ * infinite loop.
+ */
+#if !defined(CH_CFG_NO_IDLE_THREAD)
+#define CH_CFG_NO_IDLE_THREAD FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Performance options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief OS optimization.
+ * @details If enabled then time efficient rather than space efficient code
+ * is used when two possible implementations exist.
+ *
+ * @note This is not related to the compiler optimization options.
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_OPTIMIZE_SPEED)
+#define CH_CFG_OPTIMIZE_SPEED TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Subsystem options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Time Measurement APIs.
+ * @details If enabled then the time measurement APIs are included in
+ * the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TM)
+#define CH_CFG_USE_TM TRUE
+#endif
+
+/**
+ * @brief Time Stamps APIs.
+ * @details If enabled then the time stamps APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TIMESTAMP)
+#define CH_CFG_USE_TIMESTAMP TRUE
+#endif
+
+/**
+ * @brief Threads registry APIs.
+ * @details If enabled then the registry APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_REGISTRY)
+#define CH_CFG_USE_REGISTRY TRUE
+#endif
+
+/**
+ * @brief Threads synchronization APIs.
+ * @details If enabled then the @p chThdWait() function is included in
+ * the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_WAITEXIT)
+#define CH_CFG_USE_WAITEXIT TRUE
+#endif
+
+/**
+ * @brief Semaphores APIs.
+ * @details If enabled then the Semaphores APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES)
+#define CH_CFG_USE_SEMAPHORES TRUE
+#endif
+
+/**
+ * @brief Semaphores queuing mode.
+ * @details If enabled then the threads are enqueued on semaphores by
+ * priority rather than in FIFO order.
+ *
+ * @note The default is @p FALSE. Enable this if you have special
+ * requirements.
+ * @note Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
+#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
+#endif
+
+/**
+ * @brief Mutexes APIs.
+ * @details If enabled then the mutexes APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MUTEXES)
+#define CH_CFG_USE_MUTEXES TRUE
+#endif
+
+/**
+ * @brief Enables recursive behavior on mutexes.
+ * @note Recursive mutexes are heavier and have an increased
+ * memory footprint.
+ *
+ * @note The default is @p FALSE.
+ * @note Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
+#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
+#endif
+
+/**
+ * @brief Conditional Variables APIs.
+ * @details If enabled then the conditional variables APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_CONDVARS)
+#define CH_CFG_USE_CONDVARS TRUE
+#endif
+
+/**
+ * @brief Conditional Variables APIs with timeout.
+ * @details If enabled then the conditional variables APIs with timeout
+ * specification are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_CONDVARS.
+ */
+#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
+#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
+#endif
+
+/**
+ * @brief Events Flags APIs.
+ * @details If enabled then the event flags APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_EVENTS)
+#define CH_CFG_USE_EVENTS TRUE
+#endif
+
+/**
+ * @brief Events Flags APIs with timeout.
+ * @details If enabled then the events APIs with timeout specification
+ * are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_EVENTS.
+ */
+#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
+#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
+#endif
+
+/**
+ * @brief Synchronous Messages APIs.
+ * @details If enabled then the synchronous messages APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MESSAGES)
+#define CH_CFG_USE_MESSAGES TRUE
+#endif
+
+/**
+ * @brief Synchronous Messages queuing mode.
+ * @details If enabled then messages are served by priority rather than in
+ * FIFO order.
+ *
+ * @note The default is @p FALSE. Enable this if you have special
+ * requirements.
+ * @note Requires @p CH_CFG_USE_MESSAGES.
+ */
+#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
+#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
+#endif
+
+/**
+ * @brief Dynamic Threads APIs.
+ * @details If enabled then the dynamic threads creation APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_WAITEXIT.
+ * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
+ */
+#if !defined(CH_CFG_USE_DYNAMIC)
+#define CH_CFG_USE_DYNAMIC TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name OSLIB options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Mailboxes APIs.
+ * @details If enabled then the asynchronous messages (mailboxes) APIs are
+ * included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_MAILBOXES)
+#define CH_CFG_USE_MAILBOXES TRUE
+#endif
+
+/**
+ * @brief Memory checks APIs.
+ * @details If enabled then the memory checks APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMCHECKS)
+#define CH_CFG_USE_MEMCHECKS TRUE
+#endif
+
+/**
+ * @brief Core Memory Manager APIs.
+ * @details If enabled then the core memory manager APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMCORE)
+#define CH_CFG_USE_MEMCORE TRUE
+#endif
+
+/**
+ * @brief Managed RAM size.
+ * @details Size of the RAM area to be managed by the OS. If set to zero
+ * then the whole available RAM is used. The core memory is made
+ * available to the heap allocator and/or can be used directly through
+ * the simplified core memory allocator.
+ *
+ * @note In order to let the OS manage the whole RAM the linker script must
+ * provide the @p __heap_base__ and @p __heap_end__ symbols.
+ * @note Requires @p CH_CFG_USE_MEMCORE.
+ */
+#if !defined(CH_CFG_MEMCORE_SIZE)
+#define CH_CFG_MEMCORE_SIZE 0
+#endif
+
+/**
+ * @brief Heap Allocator APIs.
+ * @details If enabled then the memory heap allocator APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
+ * @p CH_CFG_USE_SEMAPHORES.
+ * @note Mutexes are recommended.
+ */
+#if !defined(CH_CFG_USE_HEAP)
+#define CH_CFG_USE_HEAP TRUE
+#endif
+
+/**
+ * @brief Memory Pools Allocator APIs.
+ * @details If enabled then the memory pools allocator APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMPOOLS)
+#define CH_CFG_USE_MEMPOOLS TRUE
+#endif
+
+/**
+ * @brief Objects FIFOs APIs.
+ * @details If enabled then the objects FIFOs APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_FIFOS)
+#define CH_CFG_USE_OBJ_FIFOS TRUE
+#endif
+
+/**
+ * @brief Pipes APIs.
+ * @details If enabled then the pipes APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_PIPES)
+#define CH_CFG_USE_PIPES TRUE
+#endif
+
+/**
+ * @brief Objects Caches APIs.
+ * @details If enabled then the objects caches APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_CACHES)
+#define CH_CFG_USE_OBJ_CACHES TRUE
+#endif
+
+/**
+ * @brief Delegate threads APIs.
+ * @details If enabled then the delegate threads APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_DELEGATES)
+#define CH_CFG_USE_DELEGATES TRUE
+#endif
+
+/**
+ * @brief Jobs Queues APIs.
+ * @details If enabled then the jobs queues APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_JOBS)
+#define CH_CFG_USE_JOBS TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Objects factory options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Objects Factory APIs.
+ * @details If enabled then the objects factory APIs are included in the
+ * kernel.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_CFG_USE_FACTORY)
+#define CH_CFG_USE_FACTORY TRUE
+#endif
+
+/**
+ * @brief Maximum length for object names.
+ * @details If the specified length is zero then the name is stored by
+ * pointer but this could have unintended side effects.
+ */
+#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
+#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
+#endif
+
+/**
+ * @brief Enables the registry of generic objects.
+ */
+#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
+#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
+#endif
+
+/**
+ * @brief Enables factory for generic buffers.
+ */
+#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
+#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
+#endif
+
+/**
+ * @brief Enables factory for semaphores.
+ */
+#if !defined(CH_CFG_FACTORY_SEMAPHORES)
+#define CH_CFG_FACTORY_SEMAPHORES TRUE
+#endif
+
+/**
+ * @brief Enables factory for mailboxes.
+ */
+#if !defined(CH_CFG_FACTORY_MAILBOXES)
+#define CH_CFG_FACTORY_MAILBOXES TRUE
+#endif
+
+/**
+ * @brief Enables factory for objects FIFOs.
+ */
+#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
+#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
+#endif
+
+/**
+ * @brief Enables factory for Pipes.
+ */
+#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
+#define CH_CFG_FACTORY_PIPES TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Debug options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Debug option, kernel statistics.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_STATISTICS)
+#define CH_DBG_STATISTICS FALSE
+#endif
+
+/**
+ * @brief Debug option, system state check.
+ * @details If enabled the correct call protocol for system APIs is checked
+ * at runtime.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
+#define CH_DBG_SYSTEM_STATE_CHECK TRUE
+#endif
+
+/**
+ * @brief Debug option, parameters checks.
+ * @details If enabled then the checks on the API functions input
+ * parameters are activated.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_CHECKS)
+#define CH_DBG_ENABLE_CHECKS TRUE
+#endif
+
+/**
+ * @brief Debug option, consistency checks.
+ * @details If enabled then all the assertions in the kernel code are
+ * activated. This includes consistency checks inside the kernel,
+ * runtime anomalies and port-defined checks.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_ASSERTS)
+#define CH_DBG_ENABLE_ASSERTS TRUE
+#endif
+
+/**
+ * @brief Debug option, trace buffer.
+ * @details If enabled then the trace buffer is activated.
+ *
+ * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_MASK)
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
+#endif
+
+/**
+ * @brief Trace buffer entries.
+ * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
+ * different from @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
+#define CH_DBG_TRACE_BUFFER_SIZE 128
+#endif
+
+/**
+ * @brief Debug option, stack checks.
+ * @details If enabled then a runtime stack check is performed.
+ *
+ * @note The default is @p FALSE.
+ * @note The stack check is performed in a architecture/port dependent way.
+ * It may not be implemented or some ports.
+ * @note The default failure mode is to halt the system with the global
+ * @p panic_msg variable set to @p NULL.
+ */
+#if !defined(CH_DBG_ENABLE_STACK_CHECK)
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
+#endif
+
+/**
+ * @brief Debug option, stacks initialization.
+ * @details If enabled then the threads working area is filled with a byte
+ * value when a thread is created. This can be useful for the
+ * runtime measurement of the used stack.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_FILL_THREADS)
+#define CH_DBG_FILL_THREADS FALSE
+#endif
+
+/**
+ * @brief Debug option, threads profiling.
+ * @details If enabled then a field is added to the @p thread_t structure that
+ * counts the system ticks occurred while executing the thread.
+ *
+ * @note The default is @p FALSE.
+ * @note This debug option is not currently compatible with the
+ * tickless mode.
+ */
+#if !defined(CH_DBG_THREADS_PROFILING)
+#define CH_DBG_THREADS_PROFILING FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel hooks
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief System structure extension.
+ * @details User fields added to the end of the @p ch_system_t structure.
+ */
+#define CH_CFG_SYSTEM_EXTRA_FIELDS \
+ /* Add system custom fields here.*/
+
+/**
+ * @brief System initialization hook.
+ * @details User initialization code added to the @p chSysInit() function
+ * just before interrupts are enabled globally.
+ */
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
+ /* Add system initialization code here.*/ \
+} while (false)
+
+/**
+ * @brief OS instance structure extension.
+ * @details User fields added to the end of the @p os_instance_t structure.
+ */
+#define CH_CFG_OS_INSTANCE_EXTRA_FIELDS \
+ /* Add OS instance custom fields here.*/
+
+/**
+ * @brief OS instance initialization hook.
+ *
+ * @param[in] oip pointer to the @p os_instance_t structure
+ */
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
+ /* Add OS instance initialization code here.*/ \
+} while (false)
+
+/**
+ * @brief Threads descriptor structure extension.
+ * @details User fields added to the end of the @p thread_t structure.
+ */
+#define CH_CFG_THREAD_EXTRA_FIELDS \
+ /* Add threads custom fields here.*/
+
+/**
+ * @brief Threads initialization hook.
+ * @details User initialization code added to the @p _thread_init() function.
+ *
+ * @note It is invoked from within @p _thread_init() and implicitly from all
+ * the threads creation APIs.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
+ */
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
+ /* Add threads initialization code here.*/ \
+} while (false)
+
+/**
+ * @brief Threads finalization hook.
+ * @details User finalization code added to the @p chThdExit() API.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
+ */
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
+ /* Add threads finalization code here.*/ \
+} while (false)
+
+/**
+ * @brief Context switch hook.
+ * @details This hook is invoked just before switching between threads.
+ *
+ * @param[in] ntp thread being switched in
+ * @param[in] otp thread being switched out
+ */
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
+ /* Context switch code here.*/ \
+} while (false)
+
+/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
+ /* IRQ prologue code here.*/ \
+} while (false)
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
+ /* IRQ epilogue code here.*/ \
+} while (false)
+
+/**
+ * @brief Idle thread enter hook.
+ * @note This hook is invoked within a critical zone, no OS functions
+ * should be invoked from here.
+ * @note This macro can be used to activate a power saving mode.
+ */
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
+ /* Idle-enter code here.*/ \
+} while (false)
+
+/**
+ * @brief Idle thread leave hook.
+ * @note This hook is invoked within a critical zone, no OS functions
+ * should be invoked from here.
+ * @note This macro can be used to deactivate a power saving mode.
+ */
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
+ /* Idle-leave code here.*/ \
+} while (false)
+
+/**
+ * @brief Idle Loop hook.
+ * @details This hook is continuously invoked by the idle thread loop.
+ */
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
+ /* Idle loop code here.*/ \
+} while (false)
+
+/**
+ * @brief System tick event hook.
+ * @details This hook is invoked in the system tick handler immediately
+ * after processing the virtual timers queue.
+ */
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
+ /* System tick event code here.*/ \
+} while (false)
+
+/**
+ * @brief System halt hook.
+ * @details This hook is invoked in case to a system halting error before
+ * the system is halted.
+ */
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
+ /* System halt code here.*/ \
+} while (false)
+
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) do { \
+ /* Trace code here.*/ \
+} while (false)
+
+/**
+ * @brief Runtime Faults Collection Unit hook.
+ * @details This hook is invoked each time new faults are collected and stored.
+ */
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
+ /* Faults handling code here.*/ \
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
+
+/** @} */
+
+/*===========================================================================*/
+/* Port-specific settings (override port settings defaulted in chcore.h). */
+/*===========================================================================*/
+
+#endif /* CHCONF_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/config.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/config.h
new file mode 100644
index 0000000000..4eec5f91bc
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/config.h
@@ -0,0 +1,40 @@
+/*
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/*
+ * CRC driver system settings.
+ */
+#define AT32_CRC_USE_CRC1 FALSE
+
+#define CRC_USE_DMA FALSE
+#define AT32_CRC_CRC1_DMA_PRIORITY 2
+#define AT32_CRC_CRC1_IRQ_PRIORITY 5
+#define AT32_CRC_CRC1_DMA_STREAM AT32_DMA_STREAM_ID_ANY
+
+/*
+ * I2C fallback driver system settings.
+ */
+#define SW_I2C_USE_I2C1 FALSE
+#define SW_I2C_USE_I2C2 FALSE
+#define SW_I2C_USE_I2C3 FALSE
+#define SW_I2C_USE_I2C4 FALSE
+
+/*
+ * Other settings.
+ */
+#define BOARD_OTG_VBUSIG
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/halconf.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/halconf.h
new file mode 100644
index 0000000000..e2f864dafb
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/halconf.h
@@ -0,0 +1,589 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file templates/halconf.h
+ * @brief HAL configuration header.
+ * @details HAL configuration file, this file allows to enable or disable the
+ * various device drivers from your application. You may also use
+ * this file in order to override the device drivers default settings.
+ *
+ * @addtogroup HAL_CONF
+ * @{
+ */
+
+#ifndef HALCONF_H
+#define HALCONF_H
+
+#define _CHIBIOS_HAL_CONF_
+#define _CHIBIOS_HAL_CONF_VER_9_1_
+
+#include "mcuconf.h"
+
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
+/**
+ * @brief Enables the PAL subsystem.
+ */
+#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
+#define HAL_USE_PAL TRUE
+#endif
+
+/**
+ * @brief Enables the ADC subsystem.
+ */
+#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
+#define HAL_USE_ADC FALSE
+#endif
+
+/**
+ * @brief Enables the CAN subsystem.
+ */
+#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
+#define HAL_USE_CAN FALSE
+#endif
+
+/**
+ * @brief Enables the cryptographic subsystem.
+ */
+#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
+#define HAL_USE_CRY FALSE
+#endif
+
+/**
+ * @brief Enables the DAC subsystem.
+ */
+#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
+#define HAL_USE_DAC FALSE
+#endif
+
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
+/**
+ * @brief Enables the EFlash subsystem.
+ */
+#if !defined(HAL_USE_EFL) || defined(__DOXYGEN__)
+#define HAL_USE_EFL FALSE
+#endif
+
+/**
+ * @brief Enables the GPT subsystem.
+ */
+#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
+#define HAL_USE_GPT FALSE
+#endif
+
+/**
+ * @brief Enables the I2C subsystem.
+ */
+#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
+#define HAL_USE_I2C TRUE
+#endif
+
+/**
+ * @brief Enables the I2S subsystem.
+ */
+#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
+#define HAL_USE_I2S FALSE
+#endif
+
+/**
+ * @brief Enables the ICU subsystem.
+ */
+#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
+#define HAL_USE_ICU FALSE
+#endif
+
+/**
+ * @brief Enables the MAC subsystem.
+ */
+#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
+#define HAL_USE_MAC FALSE
+#endif
+
+/**
+ * @brief Enables the MMC_SPI subsystem.
+ */
+#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
+#define HAL_USE_MMC_SPI FALSE
+#endif
+
+/**
+ * @brief Enables the PWM subsystem.
+ */
+#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
+#define HAL_USE_PWM FALSE
+#endif
+
+/**
+ * @brief Enables the RTC subsystem.
+ */
+#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
+#define HAL_USE_RTC FALSE
+#endif
+
+/**
+ * @brief Enables the SDC subsystem.
+ */
+#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
+#define HAL_USE_SDC FALSE
+#endif
+
+/**
+ * @brief Enables the SERIAL subsystem.
+ */
+#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
+#define HAL_USE_SERIAL FALSE
+#endif
+
+/**
+ * @brief Enables the SERIAL over USB subsystem.
+ */
+#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
+#define HAL_USE_SERIAL_USB FALSE
+#endif
+
+/**
+ * @brief Enables the SIO subsystem.
+ */
+#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
+#define HAL_USE_SIO FALSE
+#endif
+
+/**
+ * @brief Enables the SPI subsystem.
+ */
+#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
+#define HAL_USE_SPI FALSE
+#endif
+
+/**
+ * @brief Enables the TRNG subsystem.
+ */
+#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
+#define HAL_USE_TRNG FALSE
+#endif
+
+/**
+ * @brief Enables the UART subsystem.
+ */
+#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
+#define HAL_USE_UART FALSE
+#endif
+
+/**
+ * @brief Enables the USB subsystem.
+ */
+#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
+#define HAL_USE_USB FALSE
+#endif
+
+/**
+ * @brief Enables the WDG subsystem.
+ */
+#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
+#define HAL_USE_WDG FALSE
+#endif
+
+/**
+ * @brief Enables the WSPI subsystem.
+ */
+#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
+#define HAL_USE_WSPI FALSE
+#endif
+
+/*===========================================================================*/
+/* PAL driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define PAL_USE_CALLBACKS FALSE
+#endif
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
+#define PAL_USE_WAIT FALSE
+#endif
+
+/*===========================================================================*/
+/* ADC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
+#define ADC_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define ADC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* CAN driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Sleep mode related APIs inclusion switch.
+ */
+#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
+#define CAN_USE_SLEEP_MODE TRUE
+#endif
+
+/**
+ * @brief Enforces the driver to use direct callbacks rather than OSAL events.
+ */
+#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define CAN_ENFORCE_USE_CALLBACKS FALSE
+#endif
+
+/*===========================================================================*/
+/* CRY driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the SW fall-back of the cryptographic driver.
+ * @details When enabled, this option, activates a fall-back software
+ * implementation for algorithms not supported by the underlying
+ * hardware.
+ * @note Fall-back implementations may not be present for all algorithms.
+ */
+#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
+#define HAL_CRY_USE_FALLBACK FALSE
+#endif
+
+/**
+ * @brief Makes the driver forcibly use the fall-back implementations.
+ */
+#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
+#define HAL_CRY_ENFORCE_FALLBACK FALSE
+#endif
+
+/*===========================================================================*/
+/* DAC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
+#define DAC_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define DAC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* I2C driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE TRUE
+#endif
+
+/**
+ * @brief Enables the mutual exclusion APIs on the I2C bus.
+ */
+#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define I2C_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* MAC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the zero-copy API.
+ */
+#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
+#define MAC_USE_ZERO_COPY FALSE
+#endif
+
+/**
+ * @brief Enables an event sources for incoming packets.
+ */
+#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
+#define MAC_USE_EVENTS TRUE
+#endif
+
+/*===========================================================================*/
+/* MMC_SPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Timeout before assuming a failure while waiting for card idle.
+ * @note Time is in milliseconds.
+ */
+#if !defined(MMC_IDLE_TIMEOUT_MS) || defined(__DOXYGEN__)
+#define MMC_IDLE_TIMEOUT_MS 1000
+#endif
+
+/**
+ * @brief Mutual exclusion on the SPI bus.
+ */
+#if !defined(MMC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define MMC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* SDC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Number of initialization attempts before rejecting the card.
+ * @note Attempts are performed at 10mS intervals.
+ */
+#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
+#define SDC_INIT_RETRY 100
+#endif
+
+/**
+ * @brief Include support for MMC cards.
+ * @note MMC support is not yet implemented so this option must be kept
+ * at @p FALSE.
+ */
+#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
+#define SDC_MMC_SUPPORT FALSE
+#endif
+
+/**
+ * @brief Delays insertions.
+ * @details If enabled this options inserts delays into the MMC waiting
+ * routines releasing some extra CPU time for the threads with
+ * lower priority, this may slow down the driver a bit however.
+ */
+#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
+#define SDC_NICE_WAITING TRUE
+#endif
+
+/**
+ * @brief OCR initialization constant for V20 cards.
+ */
+#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR_V20 0x50FF8000U
+#endif
+
+/**
+ * @brief OCR initialization constant for non-V20 cards.
+ */
+#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR 0x80100000U
+#endif
+
+/*===========================================================================*/
+/* SERIAL driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Default bit rate.
+ * @details Configuration parameter, this is the baud rate selected for the
+ * default configuration.
+ */
+#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
+#define SERIAL_DEFAULT_BITRATE 38400
+#endif
+
+/**
+ * @brief Serial buffers size.
+ * @details Configuration parameter, you can change the depth of the queue
+ * buffers depending on the requirements of your application.
+ * @note The default is 16 bytes for both the transmission and receive
+ * buffers.
+ */
+#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
+#define SERIAL_BUFFERS_SIZE 16
+#endif
+
+/*===========================================================================*/
+/* SIO driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Default bit rate.
+ * @details Configuration parameter, this is the baud rate selected for the
+ * default configuration.
+ */
+#if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__)
+#define SIO_DEFAULT_BITRATE 38400
+#endif
+
+/**
+ * @brief Support for thread synchronization API.
+ */
+#if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__)
+#define SIO_USE_SYNCHRONIZATION TRUE
+#endif
+
+/*===========================================================================*/
+/* SERIAL_USB driver related setting. */
+/*===========================================================================*/
+
+/**
+ * @brief Serial over USB buffers size.
+ * @details Configuration parameter, the buffer size must be a multiple of
+ * the USB data endpoint maximum packet size.
+ * @note The default is 256 bytes for both the transmission and receive
+ * buffers.
+ */
+#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
+#define SERIAL_USB_BUFFERS_SIZE 256
+#endif
+
+/**
+ * @brief Serial over USB number of buffers.
+ * @note The default is 2 buffers.
+ */
+#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
+#define SERIAL_USB_BUFFERS_NUMBER 2
+#endif
+
+/*===========================================================================*/
+/* SPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
+#define SPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Inserts an assertion on function errors before returning.
+ */
+#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__)
+#define SPI_USE_ASSERT_ON_ERROR TRUE
+#endif
+
+/**
+ * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define SPI_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/**
+ * @brief Handling method for SPI CS line.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
+#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
+#endif
+
+/*===========================================================================*/
+/* UART driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
+#define UART_USE_WAIT FALSE
+#endif
+
+/**
+ * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define UART_USE_MUTUAL_EXCLUSION FALSE
+#endif
+
+/*===========================================================================*/
+/* USB driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
+#define USB_USE_WAIT FALSE
+#endif
+
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
+/*===========================================================================*/
+/* WSPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
+#define WSPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define WSPI_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+#include "halconf_community.h"
+
+#endif /* HALCONF_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/halconf_community.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/halconf_community.h
new file mode 100644
index 0000000000..e21bd723b7
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/halconf_community.h
@@ -0,0 +1,182 @@
+/*
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef HALCONF_COMMUNITY_H
+#define HALCONF_COMMUNITY_H
+
+/**
+ * @brief Enables the community overlay.
+ */
+#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
+#define HAL_USE_COMMUNITY TRUE
+#endif
+
+/**
+ * @brief Enables the FSMC subsystem.
+ */
+#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__)
+#define HAL_USE_FSMC FALSE
+#endif
+
+/**
+ * @brief Enables the NAND subsystem.
+ */
+#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__)
+#define HAL_USE_NAND FALSE
+#endif
+
+/**
+ * @brief Enables the 1-wire subsystem.
+ */
+#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__)
+#define HAL_USE_ONEWIRE FALSE
+#endif
+
+/**
+ * @brief Enables the EICU subsystem.
+ */
+#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__)
+#define HAL_USE_EICU FALSE
+#endif
+
+/**
+ * @brief Enables the CRC subsystem.
+ */
+#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__)
+#define HAL_USE_CRC FALSE
+#endif
+
+/**
+ * @brief Enables the RNG subsystem.
+ */
+#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__)
+#define HAL_USE_RNG FALSE
+#endif
+
+/**
+ * @brief Enables the EEPROM subsystem.
+ */
+#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__)
+#define HAL_USE_EEPROM FALSE
+#endif
+
+/**
+ * @brief Enables the TIMCAP subsystem.
+ */
+#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__)
+#define HAL_USE_TIMCAP FALSE
+#endif
+
+/**
+ * @brief Enables the COMP subsystem.
+ */
+#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__)
+#define HAL_USE_COMP FALSE
+#endif
+
+/**
+ * @brief Enables the OPAMP subsystem.
+ */
+#if !defined(HAL_USE_OPAMP) || defined(__DOXYGEN__)
+#define HAL_USE_OPAMP FALSE
+#endif
+
+/**
+ * @brief Enables the QEI subsystem.
+ */
+#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__)
+#define HAL_USE_QEI FALSE
+#endif
+
+/**
+ * @brief Enables the USBH subsystem.
+ */
+#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__)
+#define HAL_USE_USBH FALSE
+#endif
+
+/**
+ * @brief Enables the USB_MSD subsystem.
+ */
+#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__)
+#define HAL_USE_USB_MSD FALSE
+#endif
+
+/*===========================================================================*/
+/* FSMCNAND driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define NAND_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* 1-wire driver related settings. */
+/*===========================================================================*/
+/**
+ * @brief Enables strong pull up feature.
+ * @note Disabling this option saves both code and data space.
+ */
+#define ONEWIRE_USE_STRONG_PULLUP FALSE
+
+/**
+ * @brief Enables search ROM feature.
+ * @note Disabling this option saves both code and data space.
+ */
+#define ONEWIRE_USE_SEARCH_ROM TRUE
+
+/*===========================================================================*/
+/* QEI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables discard of overlow
+ */
+#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__)
+#define QEI_USE_OVERFLOW_DISCARD FALSE
+#endif
+
+/**
+ * @brief Enables min max of overlow
+ */
+#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__)
+#define QEI_USE_OVERFLOW_MINMAX FALSE
+#endif
+
+/*===========================================================================*/
+/* EEProm driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables 24xx series I2C eeprom device driver.
+ * @note Disabling this option saves both code and data space.
+ */
+#define EEPROM_USE_EE24XX FALSE
+ /**
+ * @brief Enables 25xx series SPI eeprom device driver.
+ * @note Disabling this option saves both code and data space.
+ */
+#define EEPROM_USE_EE25XX FALSE
+
+#endif /* HALCONF_COMMUNITY_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/mcuconf.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/mcuconf.h
new file mode 100644
index 0000000000..ad48545781
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/mcuconf.h
@@ -0,0 +1,274 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef MCUCONF_H
+#define MCUCONF_H
+
+/*
+ * AT32F405 drivers configuration.
+ * The following settings override the default settings present in
+ * the various device driver implementation headers.
+ * Note that the settings for each driver only have effect if the whole
+ * driver is enabled in halconf.h.
+ *
+ * IRQ priorities:
+ * 15...0 Lowest...Highest.
+ *
+ * DMA priorities:
+ * 0...3 Lowest...Highest.
+ */
+
+#define AT32F405_MCUCONF
+
+/*
+ * General settings.
+ */
+#define AT32_NO_INIT FALSE
+
+/*
+ * HAL driver system settings.
+ */
+#define AT32_HICK_ENABLED TRUE
+#define AT32_LICK_ENABLED FALSE
+#define AT32_HEXT_ENABLED TRUE
+#define AT32_LEXT_ENABLED FALSE
+#define AT32_PLLU_ENABLED TRUE
+#define AT32_SCLKSEL AT32_SCLKSEL_PLL
+#define AT32_PLLRCS AT32_PLLRCS_HEXT
+#define AT32_PLL_MS_VALUE 1
+#define AT32_PLL_NS_VALUE 72
+#define AT32_PLL_FP_VALUE 4
+#define AT32_PLL_FU_VALUE 18
+#define AT32_AHBDIV AT32_AHBDIV_DIV1
+#define AT32_APB1DIV AT32_APB1DIV_DIV2
+#define AT32_APB2DIV AT32_APB2DIV_DIV1
+#define AT32_HICK_TO_SCLK AT32_HICK_TO_SCLK_48M
+#define AT32_HICKDIV AT32_HICKDIV_DIV1
+#define AT32_HICK_TO_SCLK_DIV AT32_HICK_TO_SCLK_DIV_DIV1
+#define AT32_HEXT_TO_SCLK_DIV AT32_HEXT_TO_SCLK_DIV_DIV1
+#define AT32_USB_CLOCK48_REQUIRED TRUE
+#define AT32_PLLU_USB48_SEL AT32_PLLU_USB48_SEL_PLLU
+#define AT32_CLKOUT_SEL AT32_CLKOUT_SEL_HICK
+#define AT32_CLKOUTDIV1 AT32_CLKOUTDIV1_DIV1
+#define AT32_CLKOUTDIV2 AT32_CLKOUTDIV2_DIV1
+#define AT32_ERTCSEL AT32_ERTCSEL_NOCLOCK
+#define AT32_ERTCDIV_VALUE 12
+#define AT32_I2SF5CLKSEL AT32_I2SF5CLKSEL_SCLK
+#define AT32_PVM_ENABLE FALSE
+#define AT32_PVMSEL AT32_PVMSEL_LEV1
+#define AT32_LDOOVSEL AT32_LDOOVSEL_LEV3
+
+/*
+ * IRQ system settings.
+ */
+#define AT32_IRQ_EXINT0_PRIORITY 6
+#define AT32_IRQ_EXINT1_PRIORITY 6
+#define AT32_IRQ_EXINT2_PRIORITY 6
+#define AT32_IRQ_EXINT3_PRIORITY 6
+#define AT32_IRQ_EXINT4_PRIORITY 6
+#define AT32_IRQ_EXINT5_9_PRIORITY 6
+#define AT32_IRQ_EXINT10_15_PRIORITY 6
+#define AT32_IRQ_EXINT16_PRIORITY 6
+#define AT32_IRQ_EXINT17_PRIORITY 15
+#define AT32_IRQ_EXINT18_PRIORITY 6
+#define AT32_IRQ_EXINT20_PRIORITY 6
+#define AT32_IRQ_EXINT21_PRIORITY 15
+#define AT32_IRQ_EXINT22_PRIORITY 15
+
+#define AT32_IRQ_TMR1_BRK_TMR9_PRIORITY 7
+#define AT32_IRQ_TMR1_OVF_TMR10_PRIORITY 7
+#define AT32_IRQ_TMR1_HALL_TMR11_PRIORITY 7
+#define AT32_IRQ_TMR1_CH_PRIORITY 7
+#define AT32_IRQ_TMR2_PRIORITY 7
+#define AT32_IRQ_TMR3_PRIORITY 7
+#define AT32_IRQ_TMR4_PRIORITY 7
+#define AT32_IRQ_TMR6_PRIORITY 7
+#define AT32_IRQ_TMR7_PRIORITY 7
+#define AT32_IRQ_TMR13_PRIORITY 7
+#define AT32_IRQ_TMR14_PRIORITY 7
+
+#define AT32_IRQ_USART1_PRIORITY 12
+#define AT32_IRQ_USART2_PRIORITY 12
+#define AT32_IRQ_USART3_PRIORITY 12
+#define AT32_IRQ_UART4_PRIORITY 12
+#define AT32_IRQ_UART5_PRIORITY 12
+#define AT32_IRQ_USART6_PRIORITY 12
+#define AT32_IRQ_UART7_PRIORITY 12
+#define AT32_IRQ_UART8_PRIORITY 12
+
+/*
+ * ADC driver system settings.
+ */
+#define AT32_ADC_USE_ADC1 FALSE
+#define AT32_ADC_ADC1_DMA_PRIORITY 2
+#define AT32_ADC_IRQ_PRIORITY 6
+#define AT32_ADC_ADC1_DMA_IRQ_PRIORITY 6
+#define AT32_ADC_ADCDIV 8
+
+/*
+ * CAN driver system settings.
+ */
+#define AT32_CAN_USE_CAN1 FALSE
+#define AT32_CAN_CAN1_IRQ_PRIORITY 11
+
+/*
+ * GPT driver system settings.
+ */
+#define AT32_GPT_USE_TMR1 FALSE
+#define AT32_GPT_USE_TMR2 FALSE
+#define AT32_GPT_USE_TMR3 FALSE
+#define AT32_GPT_USE_TMR4 FALSE
+#define AT32_GPT_USE_TMR6 FALSE
+#define AT32_GPT_USE_TMR7 FALSE
+#define AT32_GPT_USE_TMR9 FALSE
+#define AT32_GPT_USE_TMR10 FALSE
+#define AT32_GPT_USE_TMR11 FALSE
+#define AT32_GPT_USE_TMR13 FALSE
+#define AT32_GPT_USE_TMR14 FALSE
+
+/*
+ * I2C driver system settings.
+ */
+#define AT32_I2C_USE_I2C1 TRUE
+#define AT32_I2C_USE_I2C2 TRUE
+#define AT32_I2C_USE_I2C3 FALSE
+#define AT32_I2C_BUSY_TIMEOUT 50
+#define AT32_I2C_I2C1_DMA_PRIORITY 3
+#define AT32_I2C_I2C2_DMA_PRIORITY 3
+#define AT32_I2C_I2C3_DMA_PRIORITY 3
+#define AT32_I2C_I2C1_IRQ_PRIORITY 5
+#define AT32_I2C_I2C2_IRQ_PRIORITY 5
+#define AT32_I2C_I2C3_IRQ_PRIORITY 5
+#define AT32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
+
+/*
+ * ICU driver system settings.
+ */
+#define AT32_ICU_USE_TMR1 FALSE
+#define AT32_ICU_USE_TMR2 FALSE
+#define AT32_ICU_USE_TMR3 FALSE
+#define AT32_ICU_USE_TMR4 FALSE
+#define AT32_ICU_USE_TMR9 FALSE
+
+/*
+ * PWM driver system settings.
+ */
+#define AT32_PWM_USE_TMR1 FALSE
+#define AT32_PWM_USE_TMR2 FALSE
+#define AT32_PWM_USE_TMR3 FALSE
+#define AT32_PWM_USE_TMR4 FALSE
+#define AT32_PWM_USE_TMR9 FALSE
+#define AT32_PWM_USE_TMR10 FALSE
+#define AT32_PWM_USE_TMR11 FALSE
+#define AT32_PWM_USE_TMR13 FALSE
+#define AT32_PWM_USE_TMR14 FALSE
+
+/*
+ * RTC driver system settings.
+ */
+#define AT32_ERTC_DIVA_VALUE 32
+#define AT32_ERTC_DIVB_VALUE 1024
+#define AT32_ERTC_CTRL_INIT 0
+#define AT32_ERTC_TAMP_INIT 0
+
+/*
+ * SERIAL driver system settings.
+ */
+#define AT32_SERIAL_USE_USART1 FALSE
+#define AT32_SERIAL_USE_USART2 FALSE
+#define AT32_SERIAL_USE_USART3 FALSE
+#define AT32_SERIAL_USE_UART4 FALSE
+#define AT32_SERIAL_USE_UART5 FALSE
+#define AT32_SERIAL_USE_USART6 FALSE
+#define AT32_SERIAL_USE_UART7 FALSE
+#define AT32_SERIAL_USE_UART8 FALSE
+
+/*
+ * SIO driver system settings.
+ */
+#define AT32_SIO_USE_USART1 FALSE
+#define AT32_SIO_USE_USART2 FALSE
+#define AT32_SIO_USE_USART3 FALSE
+#define AT32_SIO_USE_UART4 FALSE
+#define AT32_SIO_USE_UART5 FALSE
+#define AT32_SIO_USE_USART6 FALSE
+#define AT32_SIO_USE_UART7 FALSE
+#define AT32_SIO_USE_UART8 FALSE
+
+/*
+ * SPI driver system settings.
+ */
+#define AT32_SPI_USE_SPI1 FALSE
+#define AT32_SPI_USE_SPI2 FALSE
+#define AT32_SPI_USE_SPI3 FALSE
+#define AT32_SPI_SPI1_DMA_PRIORITY 1
+#define AT32_SPI_SPI2_DMA_PRIORITY 1
+#define AT32_SPI_SPI3_DMA_PRIORITY 1
+#define AT32_SPI_SPI1_IRQ_PRIORITY 10
+#define AT32_SPI_SPI2_IRQ_PRIORITY 10
+#define AT32_SPI_SPI3_IRQ_PRIORITY 10
+#define AT32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
+
+/*
+ * ST driver system settings.
+ */
+#define AT32_ST_IRQ_PRIORITY 8
+#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
+
+/*
+ * UART driver system settings.
+ */
+#define AT32_UART_USE_USART1 FALSE
+#define AT32_UART_USE_USART2 FALSE
+#define AT32_UART_USE_USART3 FALSE
+#define AT32_UART_USE_UART4 FALSE
+#define AT32_UART_USE_UART5 FALSE
+#define AT32_UART_USE_USART6 FALSE
+#define AT32_UART_USE_UART7 FALSE
+#define AT32_UART_USE_UART8 FALSE
+#define AT32_UART_USART1_DMA_PRIORITY 0
+#define AT32_UART_USART2_DMA_PRIORITY 0
+#define AT32_UART_USART3_DMA_PRIORITY 0
+#define AT32_UART_UART4_DMA_PRIORITY 0
+#define AT32_UART_UART5_DMA_PRIORITY 0
+#define AT32_UART_USART6_DMA_PRIORITY 0
+#define AT32_UART_UART7_DMA_PRIORITY 0
+#define AT32_UART_UART8_DMA_PRIORITY 0
+#define AT32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
+
+/*
+ * USB driver system settings.
+ */
+#define AT32_USB_USE_OTG1 FALSE
+#define AT32_USB_USE_OTG2 FALSE
+#define AT32_USB_OTG1_IRQ_PRIORITY 14
+#define AT32_USB_OTG2_IRQ_PRIORITY 14
+#define AT32_USB_OTG1_RX_FIFO_SIZE 512
+#define AT32_USB_OTG2_RX_FIFO_SIZE 1024
+#define AT32_USE_USB_OTG2_HS_DMA FALSE
+
+/*
+ * WDG driver system settings.
+ */
+#define AT32_WDG_USE_WDT FALSE
+
+#include "config.h"
+
+#endif /* MCUCONF_H */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/portab.c b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/portab.c
new file mode 100644
index 0000000000..9a3520e18f
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/portab.c
@@ -0,0 +1,81 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file portab.c
+ * @brief Application portability module code.
+ *
+ * @addtogroup application_portability
+ * @{
+ */
+
+#include "hal.h"
+
+#include "portab.h"
+
+/*===========================================================================*/
+/* Module local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported variables. */
+/*===========================================================================*/
+
+/*
+ * I2C driver configuration structure.
+ */
+I2CConfig i2ccfg = {
+ AT32_CLKCTRL_DIV(9U) |
+ AT32_CLKCTRL_SCLD(14U) | AT32_CLKCTRL_SDAD(0U) |
+ AT32_CLKCTRL_SCLH(49U) | AT32_CLKCTRL_SCLL(49U),
+ 0,
+ 0
+};
+
+/*===========================================================================*/
+/* Module local types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported functions. */
+/*===========================================================================*/
+
+void portab_setup(void) {
+
+ /* Master I2C1 SCL on PB6, SDA on PB7 */
+ palSetPadMode(GPIOB, 6, PAL_MODE_MUX(4) | PAL_AT32_OMODE_OPENDRAIN |
+ PAL_AT32_PULL_PULLUP);
+ palSetPadMode(GPIOB, 7, PAL_MODE_MUX(4) | PAL_AT32_OMODE_OPENDRAIN |
+ PAL_AT32_PULL_PULLUP);
+
+ /* Slave I2C2 SCL on PB10, SDA on PB11 */
+ palSetPadMode(GPIOB, 10, PAL_MODE_MUX(4) | PAL_AT32_OMODE_OPENDRAIN |
+ PAL_AT32_PULL_PULLUP);
+ palSetPadMode(GPIOB, 11, PAL_MODE_MUX(4) | PAL_AT32_OMODE_OPENDRAIN |
+ PAL_AT32_PULL_PULLUP);
+}
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/portab.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/portab.h
new file mode 100644
index 0000000000..89faf985cc
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f405/portab.h
@@ -0,0 +1,81 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file portab.h
+ * @brief Application portability macros and structures.
+ *
+ * @addtogroup application_portability
+ * @{
+ */
+
+#ifndef PORTAB_H
+#define PORTAB_H
+
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+#define PORTAB_LINE_BUTTON LINE_BUTTON
+
+#define PORTAB_I2C_MASTER I2CD1
+#define PORTAB_I2C_SLAVE I2CD2
+
+#define PORTAB_BLINK_LED1 LINE_LED_RED
+#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
+#define PORTAB_BLINK_LED3 LINE_LED_GREEN
+
+#define PORTAB_SECTION
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+extern I2CConfig i2ccfg;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void portab_setup(void);
+#ifdef __cplusplus
+}
+#endif
+
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
+#endif /* PORTAB_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/chconf.h
new file mode 100644
index 0000000000..71a25b9a32
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/chconf.h
@@ -0,0 +1,856 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file rt/templates/chconf.h
+ * @brief Configuration file template.
+ * @details A copy of this file must be placed in each project directory, it
+ * contains the application specific kernel settings.
+ *
+ * @addtogroup config
+ * @details Kernel related settings and hooks.
+ * @{
+ */
+
+#ifndef CHCONF_H
+#define CHCONF_H
+
+#define _CHIBIOS_RT_CONF_
+#define _CHIBIOS_RT_CONF_VER_7_0_
+
+/*===========================================================================*/
+/**
+ * @name System settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Handling of instances.
+ * @note If enabled then threads assigned to various instances can
+ * interact each other using the same synchronization objects.
+ * If disabled then each OS instance is a separate world, no
+ * direct interactions are handled by the OS.
+ */
+#if !defined(CH_CFG_SMP_MODE)
+#define CH_CFG_SMP_MODE FALSE
+#endif
+
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name System timers settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief System time counter resolution.
+ * @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
+ */
+#if !defined(CH_CFG_ST_RESOLUTION)
+#define CH_CFG_ST_RESOLUTION 32
+#endif
+
+/**
+ * @brief System tick frequency.
+ * @details Frequency of the system timer that drives the system ticks. This
+ * setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
+ */
+#if !defined(CH_CFG_ST_FREQUENCY)
+#define CH_CFG_ST_FREQUENCY 10000
+#endif
+
+/**
+ * @brief Time intervals data size.
+ * @note Allowed values are 16, 32 or 64 bits.
+ */
+#if !defined(CH_CFG_INTERVALS_SIZE)
+#define CH_CFG_INTERVALS_SIZE 32
+#endif
+
+/**
+ * @brief Time types data size.
+ * @note Allowed values are 16 or 32 bits.
+ */
+#if !defined(CH_CFG_TIME_TYPES_SIZE)
+#define CH_CFG_TIME_TYPES_SIZE 32
+#endif
+
+/**
+ * @brief Time delta constant for the tick-less mode.
+ * @note If this value is zero then the system uses the classic
+ * periodic tick. This value represents the minimum number
+ * of ticks that is safe to specify in a timeout directive.
+ * The value one is not valid, timeouts are rounded up to
+ * this value.
+ */
+#if !defined(CH_CFG_ST_TIMEDELTA)
+#define CH_CFG_ST_TIMEDELTA 2
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel parameters and options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Round robin interval.
+ * @details This constant is the number of system ticks allowed for the
+ * threads before preemption occurs. Setting this value to zero
+ * disables the preemption for threads with equal priority and the
+ * round robin becomes cooperative. Note that higher priority
+ * threads can still preempt, the kernel is always preemptive.
+ * @note Disabling the round robin preemption makes the kernel more compact
+ * and generally faster.
+ * @note The round robin preemption is not supported in tickless mode and
+ * must be set to zero in that case.
+ */
+#if !defined(CH_CFG_TIME_QUANTUM)
+#define CH_CFG_TIME_QUANTUM 0
+#endif
+
+/**
+ * @brief Idle thread automatic spawn suppression.
+ * @details When this option is activated the function @p chSysInit()
+ * does not spawn the idle thread. The application @p main()
+ * function becomes the idle thread and must implement an
+ * infinite loop.
+ */
+#if !defined(CH_CFG_NO_IDLE_THREAD)
+#define CH_CFG_NO_IDLE_THREAD FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Performance options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief OS optimization.
+ * @details If enabled then time efficient rather than space efficient code
+ * is used when two possible implementations exist.
+ *
+ * @note This is not related to the compiler optimization options.
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_OPTIMIZE_SPEED)
+#define CH_CFG_OPTIMIZE_SPEED TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Subsystem options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Time Measurement APIs.
+ * @details If enabled then the time measurement APIs are included in
+ * the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TM)
+#define CH_CFG_USE_TM TRUE
+#endif
+
+/**
+ * @brief Time Stamps APIs.
+ * @details If enabled then the time stamps APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TIMESTAMP)
+#define CH_CFG_USE_TIMESTAMP TRUE
+#endif
+
+/**
+ * @brief Threads registry APIs.
+ * @details If enabled then the registry APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_REGISTRY)
+#define CH_CFG_USE_REGISTRY TRUE
+#endif
+
+/**
+ * @brief Threads synchronization APIs.
+ * @details If enabled then the @p chThdWait() function is included in
+ * the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_WAITEXIT)
+#define CH_CFG_USE_WAITEXIT TRUE
+#endif
+
+/**
+ * @brief Semaphores APIs.
+ * @details If enabled then the Semaphores APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES)
+#define CH_CFG_USE_SEMAPHORES TRUE
+#endif
+
+/**
+ * @brief Semaphores queuing mode.
+ * @details If enabled then the threads are enqueued on semaphores by
+ * priority rather than in FIFO order.
+ *
+ * @note The default is @p FALSE. Enable this if you have special
+ * requirements.
+ * @note Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
+#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
+#endif
+
+/**
+ * @brief Mutexes APIs.
+ * @details If enabled then the mutexes APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MUTEXES)
+#define CH_CFG_USE_MUTEXES TRUE
+#endif
+
+/**
+ * @brief Enables recursive behavior on mutexes.
+ * @note Recursive mutexes are heavier and have an increased
+ * memory footprint.
+ *
+ * @note The default is @p FALSE.
+ * @note Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
+#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
+#endif
+
+/**
+ * @brief Conditional Variables APIs.
+ * @details If enabled then the conditional variables APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_MUTEXES.
+ */
+#if !defined(CH_CFG_USE_CONDVARS)
+#define CH_CFG_USE_CONDVARS TRUE
+#endif
+
+/**
+ * @brief Conditional Variables APIs with timeout.
+ * @details If enabled then the conditional variables APIs with timeout
+ * specification are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_CONDVARS.
+ */
+#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
+#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
+#endif
+
+/**
+ * @brief Events Flags APIs.
+ * @details If enabled then the event flags APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_EVENTS)
+#define CH_CFG_USE_EVENTS TRUE
+#endif
+
+/**
+ * @brief Events Flags APIs with timeout.
+ * @details If enabled then the events APIs with timeout specification
+ * are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_EVENTS.
+ */
+#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
+#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
+#endif
+
+/**
+ * @brief Synchronous Messages APIs.
+ * @details If enabled then the synchronous messages APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MESSAGES)
+#define CH_CFG_USE_MESSAGES TRUE
+#endif
+
+/**
+ * @brief Synchronous Messages queuing mode.
+ * @details If enabled then messages are served by priority rather than in
+ * FIFO order.
+ *
+ * @note The default is @p FALSE. Enable this if you have special
+ * requirements.
+ * @note Requires @p CH_CFG_USE_MESSAGES.
+ */
+#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
+#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
+#endif
+
+/**
+ * @brief Dynamic Threads APIs.
+ * @details If enabled then the dynamic threads creation APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_WAITEXIT.
+ * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
+ */
+#if !defined(CH_CFG_USE_DYNAMIC)
+#define CH_CFG_USE_DYNAMIC TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name OSLIB options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Mailboxes APIs.
+ * @details If enabled then the asynchronous messages (mailboxes) APIs are
+ * included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#if !defined(CH_CFG_USE_MAILBOXES)
+#define CH_CFG_USE_MAILBOXES TRUE
+#endif
+
+/**
+ * @brief Memory checks APIs.
+ * @details If enabled then the memory checks APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMCHECKS)
+#define CH_CFG_USE_MEMCHECKS TRUE
+#endif
+
+/**
+ * @brief Core Memory Manager APIs.
+ * @details If enabled then the core memory manager APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMCORE)
+#define CH_CFG_USE_MEMCORE TRUE
+#endif
+
+/**
+ * @brief Managed RAM size.
+ * @details Size of the RAM area to be managed by the OS. If set to zero
+ * then the whole available RAM is used. The core memory is made
+ * available to the heap allocator and/or can be used directly through
+ * the simplified core memory allocator.
+ *
+ * @note In order to let the OS manage the whole RAM the linker script must
+ * provide the @p __heap_base__ and @p __heap_end__ symbols.
+ * @note Requires @p CH_CFG_USE_MEMCORE.
+ */
+#if !defined(CH_CFG_MEMCORE_SIZE)
+#define CH_CFG_MEMCORE_SIZE 0
+#endif
+
+/**
+ * @brief Heap Allocator APIs.
+ * @details If enabled then the memory heap allocator APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
+ * @p CH_CFG_USE_SEMAPHORES.
+ * @note Mutexes are recommended.
+ */
+#if !defined(CH_CFG_USE_HEAP)
+#define CH_CFG_USE_HEAP TRUE
+#endif
+
+/**
+ * @brief Memory Pools Allocator APIs.
+ * @details If enabled then the memory pools allocator APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_MEMPOOLS)
+#define CH_CFG_USE_MEMPOOLS TRUE
+#endif
+
+/**
+ * @brief Objects FIFOs APIs.
+ * @details If enabled then the objects FIFOs APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_FIFOS)
+#define CH_CFG_USE_OBJ_FIFOS TRUE
+#endif
+
+/**
+ * @brief Pipes APIs.
+ * @details If enabled then the pipes APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_PIPES)
+#define CH_CFG_USE_PIPES TRUE
+#endif
+
+/**
+ * @brief Objects Caches APIs.
+ * @details If enabled then the objects caches APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_OBJ_CACHES)
+#define CH_CFG_USE_OBJ_CACHES TRUE
+#endif
+
+/**
+ * @brief Delegate threads APIs.
+ * @details If enabled then the delegate threads APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_DELEGATES)
+#define CH_CFG_USE_DELEGATES TRUE
+#endif
+
+/**
+ * @brief Jobs Queues APIs.
+ * @details If enabled then the jobs queues APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_JOBS)
+#define CH_CFG_USE_JOBS TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Objects factory options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Objects Factory APIs.
+ * @details If enabled then the objects factory APIs are included in the
+ * kernel.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_CFG_USE_FACTORY)
+#define CH_CFG_USE_FACTORY TRUE
+#endif
+
+/**
+ * @brief Maximum length for object names.
+ * @details If the specified length is zero then the name is stored by
+ * pointer but this could have unintended side effects.
+ */
+#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
+#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
+#endif
+
+/**
+ * @brief Enables the registry of generic objects.
+ */
+#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
+#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
+#endif
+
+/**
+ * @brief Enables factory for generic buffers.
+ */
+#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
+#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
+#endif
+
+/**
+ * @brief Enables factory for semaphores.
+ */
+#if !defined(CH_CFG_FACTORY_SEMAPHORES)
+#define CH_CFG_FACTORY_SEMAPHORES TRUE
+#endif
+
+/**
+ * @brief Enables factory for mailboxes.
+ */
+#if !defined(CH_CFG_FACTORY_MAILBOXES)
+#define CH_CFG_FACTORY_MAILBOXES TRUE
+#endif
+
+/**
+ * @brief Enables factory for objects FIFOs.
+ */
+#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
+#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
+#endif
+
+/**
+ * @brief Enables factory for Pipes.
+ */
+#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
+#define CH_CFG_FACTORY_PIPES TRUE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Debug options
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Debug option, kernel statistics.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_STATISTICS)
+#define CH_DBG_STATISTICS FALSE
+#endif
+
+/**
+ * @brief Debug option, system state check.
+ * @details If enabled the correct call protocol for system APIs is checked
+ * at runtime.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
+#define CH_DBG_SYSTEM_STATE_CHECK TRUE
+#endif
+
+/**
+ * @brief Debug option, parameters checks.
+ * @details If enabled then the checks on the API functions input
+ * parameters are activated.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_CHECKS)
+#define CH_DBG_ENABLE_CHECKS TRUE
+#endif
+
+/**
+ * @brief Debug option, consistency checks.
+ * @details If enabled then all the assertions in the kernel code are
+ * activated. This includes consistency checks inside the kernel,
+ * runtime anomalies and port-defined checks.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_ENABLE_ASSERTS)
+#define CH_DBG_ENABLE_ASSERTS TRUE
+#endif
+
+/**
+ * @brief Debug option, trace buffer.
+ * @details If enabled then the trace buffer is activated.
+ *
+ * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_MASK)
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
+#endif
+
+/**
+ * @brief Trace buffer entries.
+ * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
+ * different from @p CH_DBG_TRACE_MASK_DISABLED.
+ */
+#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
+#define CH_DBG_TRACE_BUFFER_SIZE 128
+#endif
+
+/**
+ * @brief Debug option, stack checks.
+ * @details If enabled then a runtime stack check is performed.
+ *
+ * @note The default is @p FALSE.
+ * @note The stack check is performed in a architecture/port dependent way.
+ * It may not be implemented or some ports.
+ * @note The default failure mode is to halt the system with the global
+ * @p panic_msg variable set to @p NULL.
+ */
+#if !defined(CH_DBG_ENABLE_STACK_CHECK)
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
+#endif
+
+/**
+ * @brief Debug option, stacks initialization.
+ * @details If enabled then the threads working area is filled with a byte
+ * value when a thread is created. This can be useful for the
+ * runtime measurement of the used stack.
+ *
+ * @note The default is @p FALSE.
+ */
+#if !defined(CH_DBG_FILL_THREADS)
+#define CH_DBG_FILL_THREADS FALSE
+#endif
+
+/**
+ * @brief Debug option, threads profiling.
+ * @details If enabled then a field is added to the @p thread_t structure that
+ * counts the system ticks occurred while executing the thread.
+ *
+ * @note The default is @p FALSE.
+ * @note This debug option is not currently compatible with the
+ * tickless mode.
+ */
+#if !defined(CH_DBG_THREADS_PROFILING)
+#define CH_DBG_THREADS_PROFILING FALSE
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/**
+ * @name Kernel hooks
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief System structure extension.
+ * @details User fields added to the end of the @p ch_system_t structure.
+ */
+#define CH_CFG_SYSTEM_EXTRA_FIELDS \
+ /* Add system custom fields here.*/
+
+/**
+ * @brief System initialization hook.
+ * @details User initialization code added to the @p chSysInit() function
+ * just before interrupts are enabled globally.
+ */
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
+ /* Add system initialization code here.*/ \
+} while (false)
+
+/**
+ * @brief OS instance structure extension.
+ * @details User fields added to the end of the @p os_instance_t structure.
+ */
+#define CH_CFG_OS_INSTANCE_EXTRA_FIELDS \
+ /* Add OS instance custom fields here.*/
+
+/**
+ * @brief OS instance initialization hook.
+ *
+ * @param[in] oip pointer to the @p os_instance_t structure
+ */
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
+ /* Add OS instance initialization code here.*/ \
+} while (false)
+
+/**
+ * @brief Threads descriptor structure extension.
+ * @details User fields added to the end of the @p thread_t structure.
+ */
+#define CH_CFG_THREAD_EXTRA_FIELDS \
+ /* Add threads custom fields here.*/
+
+/**
+ * @brief Threads initialization hook.
+ * @details User initialization code added to the @p _thread_init() function.
+ *
+ * @note It is invoked from within @p _thread_init() and implicitly from all
+ * the threads creation APIs.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
+ */
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
+ /* Add threads initialization code here.*/ \
+} while (false)
+
+/**
+ * @brief Threads finalization hook.
+ * @details User finalization code added to the @p chThdExit() API.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
+ */
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
+ /* Add threads finalization code here.*/ \
+} while (false)
+
+/**
+ * @brief Context switch hook.
+ * @details This hook is invoked just before switching between threads.
+ *
+ * @param[in] ntp thread being switched in
+ * @param[in] otp thread being switched out
+ */
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
+ /* Context switch code here.*/ \
+} while (false)
+
+/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
+ /* IRQ prologue code here.*/ \
+} while (false)
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
+ /* IRQ epilogue code here.*/ \
+} while (false)
+
+/**
+ * @brief Idle thread enter hook.
+ * @note This hook is invoked within a critical zone, no OS functions
+ * should be invoked from here.
+ * @note This macro can be used to activate a power saving mode.
+ */
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
+ /* Idle-enter code here.*/ \
+} while (false)
+
+/**
+ * @brief Idle thread leave hook.
+ * @note This hook is invoked within a critical zone, no OS functions
+ * should be invoked from here.
+ * @note This macro can be used to deactivate a power saving mode.
+ */
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
+ /* Idle-leave code here.*/ \
+} while (false)
+
+/**
+ * @brief Idle Loop hook.
+ * @details This hook is continuously invoked by the idle thread loop.
+ */
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
+ /* Idle loop code here.*/ \
+} while (false)
+
+/**
+ * @brief System tick event hook.
+ * @details This hook is invoked in the system tick handler immediately
+ * after processing the virtual timers queue.
+ */
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
+ /* System tick event code here.*/ \
+} while (false)
+
+/**
+ * @brief System halt hook.
+ * @details This hook is invoked in case to a system halting error before
+ * the system is halted.
+ */
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
+ /* System halt code here.*/ \
+} while (false)
+
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) do { \
+ /* Trace code here.*/ \
+} while (false)
+
+/**
+ * @brief Runtime Faults Collection Unit hook.
+ * @details This hook is invoked each time new faults are collected and stored.
+ */
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
+ /* Faults handling code here.*/ \
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
+
+/** @} */
+
+/*===========================================================================*/
+/* Port-specific settings (override port settings defaulted in chcore.h). */
+/*===========================================================================*/
+
+#endif /* CHCONF_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/config.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/config.h
new file mode 100644
index 0000000000..fe19c2eb77
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/config.h
@@ -0,0 +1,39 @@
+/*
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/*
+ * CRC driver system settings.
+ */
+#define AT32_CRC_USE_CRC1 FALSE
+
+#define CRC_USE_DMA FALSE
+#define AT32_CRC_CRC1_DMA_PRIORITY 2
+#define AT32_CRC_CRC1_IRQ_PRIORITY 5
+#define AT32_CRC_CRC1_DMA_STREAM AT32_DMA1_STREAM2
+
+/*
+ * I2C fallback driver system settings.
+ */
+#define SW_I2C_USE_I2C1 FALSE
+#define SW_I2C_USE_I2C2 FALSE
+#define SW_I2C_USE_I2C3 FALSE
+#define SW_I2C_USE_I2C4 FALSE
+
+/*
+ * Other settings.
+ */
+#define BOARD_OTG_VBUSIG
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/halconf.h
new file mode 100644
index 0000000000..cc71e5074d
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/halconf.h
@@ -0,0 +1,588 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file templates/halconf.h
+ * @brief HAL configuration header.
+ * @details HAL configuration file, this file allows to enable or disable the
+ * various device drivers from your application. You may also use
+ * this file in order to override the device drivers default settings.
+ *
+ * @addtogroup HAL_CONF
+ * @{
+ */
+
+#ifndef HALCONF_H
+#define HALCONF_H
+
+#define _CHIBIOS_HAL_CONF_
+#define _CHIBIOS_HAL_CONF_VER_9_1_
+
+#include "mcuconf.h"
+
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
+/**
+ * @brief Enables the PAL subsystem.
+ */
+#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
+#define HAL_USE_PAL TRUE
+#endif
+
+/**
+ * @brief Enables the ADC subsystem.
+ */
+#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
+#define HAL_USE_ADC FALSE
+#endif
+
+/**
+ * @brief Enables the CAN subsystem.
+ */
+#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
+#define HAL_USE_CAN FALSE
+#endif
+
+/**
+ * @brief Enables the cryptographic subsystem.
+ */
+#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
+#define HAL_USE_CRY FALSE
+#endif
+
+/**
+ * @brief Enables the DAC subsystem.
+ */
+#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
+#define HAL_USE_DAC FALSE
+#endif
+
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
+/**
+ * @brief Enables the EFlash subsystem.
+ */
+#if !defined(HAL_USE_EFL) || defined(__DOXYGEN__)
+#define HAL_USE_EFL FALSE
+#endif
+
+/**
+ * @brief Enables the GPT subsystem.
+ */
+#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
+#define HAL_USE_GPT FALSE
+#endif
+
+/**
+ * @brief Enables the I2C subsystem.
+ */
+#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
+#define HAL_USE_I2C TRUE
+#endif
+
+/**
+ * @brief Enables the I2S subsystem.
+ */
+#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
+#define HAL_USE_I2S FALSE
+#endif
+
+/**
+ * @brief Enables the ICU subsystem.
+ */
+#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
+#define HAL_USE_ICU FALSE
+#endif
+
+/**
+ * @brief Enables the MAC subsystem.
+ */
+#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
+#define HAL_USE_MAC FALSE
+#endif
+
+/**
+ * @brief Enables the MMC_SPI subsystem.
+ */
+#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
+#define HAL_USE_MMC_SPI FALSE
+#endif
+
+/**
+ * @brief Enables the PWM subsystem.
+ */
+#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
+#define HAL_USE_PWM FALSE
+#endif
+
+/**
+ * @brief Enables the RTC subsystem.
+ */
+#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
+#define HAL_USE_RTC FALSE
+#endif
+
+/**
+ * @brief Enables the SDC subsystem.
+ */
+#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
+#define HAL_USE_SDC FALSE
+#endif
+
+/**
+ * @brief Enables the SERIAL subsystem.
+ */
+#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
+#define HAL_USE_SERIAL FALSE
+#endif
+
+/**
+ * @brief Enables the SERIAL over USB subsystem.
+ */
+#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
+#define HAL_USE_SERIAL_USB FALSE
+#endif
+
+/**
+ * @brief Enables the SIO subsystem.
+ */
+#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
+#define HAL_USE_SIO FALSE
+#endif
+
+/**
+ * @brief Enables the SPI subsystem.
+ */
+#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
+#define HAL_USE_SPI FALSE
+#endif
+
+/**
+ * @brief Enables the TRNG subsystem.
+ */
+#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
+#define HAL_USE_TRNG FALSE
+#endif
+
+/**
+ * @brief Enables the UART subsystem.
+ */
+#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
+#define HAL_USE_UART FALSE
+#endif
+
+/**
+ * @brief Enables the USB subsystem.
+ */
+#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
+#define HAL_USE_USB FALSE
+#endif
+
+/**
+ * @brief Enables the WDG subsystem.
+ */
+#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
+#define HAL_USE_WDG FALSE
+#endif
+
+/**
+ * @brief Enables the WSPI subsystem.
+ */
+#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
+#define HAL_USE_WSPI FALSE
+#endif
+
+/*===========================================================================*/
+/* PAL driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define PAL_USE_CALLBACKS FALSE
+#endif
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
+#define PAL_USE_WAIT FALSE
+#endif
+
+/*===========================================================================*/
+/* ADC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
+#define ADC_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define ADC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* CAN driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Sleep mode related APIs inclusion switch.
+ */
+#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
+#define CAN_USE_SLEEP_MODE TRUE
+#endif
+
+/**
+ * @brief Enforces the driver to use direct callbacks rather than OSAL events.
+ */
+#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define CAN_ENFORCE_USE_CALLBACKS FALSE
+#endif
+
+/*===========================================================================*/
+/* CRY driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the SW fall-back of the cryptographic driver.
+ * @details When enabled, this option, activates a fall-back software
+ * implementation for algorithms not supported by the underlying
+ * hardware.
+ * @note Fall-back implementations may not be present for all algorithms.
+ */
+#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
+#define HAL_CRY_USE_FALLBACK FALSE
+#endif
+
+/**
+ * @brief Makes the driver forcibly use the fall-back implementations.
+ */
+#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
+#define HAL_CRY_ENFORCE_FALLBACK FALSE
+#endif
+
+/*===========================================================================*/
+/* DAC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
+#define DAC_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define DAC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* I2C driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE TRUE
+#endif
+
+/**
+ * @brief Enables the mutual exclusion APIs on the I2C bus.
+ */
+#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define I2C_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* MAC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the zero-copy API.
+ */
+#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
+#define MAC_USE_ZERO_COPY FALSE
+#endif
+
+/**
+ * @brief Enables an event sources for incoming packets.
+ */
+#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
+#define MAC_USE_EVENTS TRUE
+#endif
+
+/*===========================================================================*/
+/* MMC_SPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Timeout before assuming a failure while waiting for card idle.
+ * @note Time is in milliseconds.
+ */
+#if !defined(MMC_IDLE_TIMEOUT_MS) || defined(__DOXYGEN__)
+#define MMC_IDLE_TIMEOUT_MS 1000
+#endif
+
+/**
+ * @brief Mutual exclusion on the SPI bus.
+ */
+#if !defined(MMC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define MMC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* SDC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Number of initialization attempts before rejecting the card.
+ * @note Attempts are performed at 10mS intervals.
+ */
+#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
+#define SDC_INIT_RETRY 100
+#endif
+
+/**
+ * @brief Include support for MMC cards.
+ * @note MMC support is not yet implemented so this option must be kept
+ * at @p FALSE.
+ */
+#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
+#define SDC_MMC_SUPPORT FALSE
+#endif
+
+/**
+ * @brief Delays insertions.
+ * @details If enabled this options inserts delays into the MMC waiting
+ * routines releasing some extra CPU time for the threads with
+ * lower priority, this may slow down the driver a bit however.
+ */
+#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
+#define SDC_NICE_WAITING TRUE
+#endif
+
+/**
+ * @brief OCR initialization constant for V20 cards.
+ */
+#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR_V20 0x50FF8000U
+#endif
+
+/**
+ * @brief OCR initialization constant for non-V20 cards.
+ */
+#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR 0x80100000U
+#endif
+
+/*===========================================================================*/
+/* SERIAL driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Default bit rate.
+ * @details Configuration parameter, this is the baud rate selected for the
+ * default configuration.
+ */
+#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
+#define SERIAL_DEFAULT_BITRATE 38400
+#endif
+
+/**
+ * @brief Serial buffers size.
+ * @details Configuration parameter, you can change the depth of the queue
+ * buffers depending on the requirements of your application.
+ * @note The default is 16 bytes for both the transmission and receive
+ * buffers.
+ */
+#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
+#define SERIAL_BUFFERS_SIZE 16
+#endif
+
+/*===========================================================================*/
+/* SIO driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Default bit rate.
+ * @details Configuration parameter, this is the baud rate selected for the
+ * default configuration.
+ */
+#if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__)
+#define SIO_DEFAULT_BITRATE 38400
+#endif
+
+/**
+ * @brief Support for thread synchronization API.
+ */
+#if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__)
+#define SIO_USE_SYNCHRONIZATION TRUE
+#endif
+
+/*===========================================================================*/
+/* SERIAL_USB driver related setting. */
+/*===========================================================================*/
+
+/**
+ * @brief Serial over USB buffers size.
+ * @details Configuration parameter, the buffer size must be a multiple of
+ * the USB data endpoint maximum packet size.
+ * @note The default is 256 bytes for both the transmission and receive
+ * buffers.
+ */
+#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
+#define SERIAL_USB_BUFFERS_SIZE 256
+#endif
+
+/**
+ * @brief Serial over USB number of buffers.
+ * @note The default is 2 buffers.
+ */
+#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
+#define SERIAL_USB_BUFFERS_NUMBER 2
+#endif
+
+/*===========================================================================*/
+/* SPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
+#define SPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Inserts an assertion on function errors before returning.
+ */
+#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__)
+#define SPI_USE_ASSERT_ON_ERROR TRUE
+#endif
+
+/**
+ * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define SPI_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/**
+ * @brief Handling method for SPI CS line.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
+#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
+#endif
+
+/*===========================================================================*/
+/* UART driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
+#define UART_USE_WAIT FALSE
+#endif
+
+/**
+ * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define UART_USE_MUTUAL_EXCLUSION FALSE
+#endif
+
+/*===========================================================================*/
+/* USB driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
+#define USB_USE_WAIT FALSE
+#endif
+
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
+/*===========================================================================*/
+/* WSPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
+#define WSPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define WSPI_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+#include "halconf_community.h"
+
+#endif /* HALCONF_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/halconf_community.h
new file mode 100644
index 0000000000..e21bd723b7
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/halconf_community.h
@@ -0,0 +1,182 @@
+/*
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef HALCONF_COMMUNITY_H
+#define HALCONF_COMMUNITY_H
+
+/**
+ * @brief Enables the community overlay.
+ */
+#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
+#define HAL_USE_COMMUNITY TRUE
+#endif
+
+/**
+ * @brief Enables the FSMC subsystem.
+ */
+#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__)
+#define HAL_USE_FSMC FALSE
+#endif
+
+/**
+ * @brief Enables the NAND subsystem.
+ */
+#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__)
+#define HAL_USE_NAND FALSE
+#endif
+
+/**
+ * @brief Enables the 1-wire subsystem.
+ */
+#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__)
+#define HAL_USE_ONEWIRE FALSE
+#endif
+
+/**
+ * @brief Enables the EICU subsystem.
+ */
+#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__)
+#define HAL_USE_EICU FALSE
+#endif
+
+/**
+ * @brief Enables the CRC subsystem.
+ */
+#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__)
+#define HAL_USE_CRC FALSE
+#endif
+
+/**
+ * @brief Enables the RNG subsystem.
+ */
+#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__)
+#define HAL_USE_RNG FALSE
+#endif
+
+/**
+ * @brief Enables the EEPROM subsystem.
+ */
+#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__)
+#define HAL_USE_EEPROM FALSE
+#endif
+
+/**
+ * @brief Enables the TIMCAP subsystem.
+ */
+#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__)
+#define HAL_USE_TIMCAP FALSE
+#endif
+
+/**
+ * @brief Enables the COMP subsystem.
+ */
+#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__)
+#define HAL_USE_COMP FALSE
+#endif
+
+/**
+ * @brief Enables the OPAMP subsystem.
+ */
+#if !defined(HAL_USE_OPAMP) || defined(__DOXYGEN__)
+#define HAL_USE_OPAMP FALSE
+#endif
+
+/**
+ * @brief Enables the QEI subsystem.
+ */
+#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__)
+#define HAL_USE_QEI FALSE
+#endif
+
+/**
+ * @brief Enables the USBH subsystem.
+ */
+#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__)
+#define HAL_USE_USBH FALSE
+#endif
+
+/**
+ * @brief Enables the USB_MSD subsystem.
+ */
+#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__)
+#define HAL_USE_USB_MSD FALSE
+#endif
+
+/*===========================================================================*/
+/* FSMCNAND driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define NAND_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* 1-wire driver related settings. */
+/*===========================================================================*/
+/**
+ * @brief Enables strong pull up feature.
+ * @note Disabling this option saves both code and data space.
+ */
+#define ONEWIRE_USE_STRONG_PULLUP FALSE
+
+/**
+ * @brief Enables search ROM feature.
+ * @note Disabling this option saves both code and data space.
+ */
+#define ONEWIRE_USE_SEARCH_ROM TRUE
+
+/*===========================================================================*/
+/* QEI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables discard of overlow
+ */
+#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__)
+#define QEI_USE_OVERFLOW_DISCARD FALSE
+#endif
+
+/**
+ * @brief Enables min max of overlow
+ */
+#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__)
+#define QEI_USE_OVERFLOW_MINMAX FALSE
+#endif
+
+/*===========================================================================*/
+/* EEProm driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables 24xx series I2C eeprom device driver.
+ * @note Disabling this option saves both code and data space.
+ */
+#define EEPROM_USE_EE24XX FALSE
+ /**
+ * @brief Enables 25xx series SPI eeprom device driver.
+ * @note Disabling this option saves both code and data space.
+ */
+#define EEPROM_USE_EE25XX FALSE
+
+#endif /* HALCONF_COMMUNITY_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/mcuconf.h
new file mode 100644
index 0000000000..da74485563
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/mcuconf.h
@@ -0,0 +1,242 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef MCUCONF_H
+#define MCUCONF_H
+
+/*
+ * AT32F415 drivers configuration.
+ * The following settings override the default settings present in
+ * the various device driver implementation headers.
+ * Note that the settings for each driver only have effect if the whole
+ * driver is enabled in halconf.h.
+ *
+ * IRQ priorities:
+ * 15...0 Lowest...Highest.
+ *
+ * DMA priorities:
+ * 0...3 Lowest...Highest.
+ */
+
+#define AT32F415_MCUCONF
+
+/*
+ * General settings.
+ */
+#define AT32_NO_INIT FALSE
+
+/*
+ * HAL driver system settings.
+ */
+#define AT32_HICK_ENABLED TRUE
+#define AT32_LICK_ENABLED FALSE
+#define AT32_HEXT_ENABLED TRUE
+#define AT32_LEXT_ENABLED FALSE
+#define AT32_SCLKSEL AT32_SCLKSEL_PLL
+#define AT32_PLLRCS AT32_PLLRCS_HEXT
+#define AT32_PLLHEXTDIV AT32_PLLHEXTDIV_DIV1
+#define AT32_PLLCFGEN AT32_PLLCFGEN_SOLID
+#define AT32_PLLMULT_VALUE 18
+#define AT32_PLL_FR_VALUE 4
+#define AT32_PLL_MS_VALUE 1
+#define AT32_PLL_NS_VALUE 72
+#define AT32_AHBDIV AT32_AHBDIV_DIV1
+#define AT32_APB1DIV AT32_APB1DIV_DIV2
+#define AT32_APB2DIV AT32_APB2DIV_DIV2
+#define AT32_ADCDIV AT32_ADCDIV_DIV4
+#define AT32_USB_CLOCK_REQUIRED TRUE
+#define AT32_USBDIV AT32_USBDIV_DIV3
+#define AT32_CLKOUT_SEL AT32_CLKOUT_SEL_NOCLOCK
+#define AT32_CLKOUTDIV AT32_CLKOUTDIV_DIV1
+#define AT32_ERTCSEL AT32_ERTCSEL_NOCLOCK
+#define AT32_PVM_ENABLE FALSE
+#define AT32_PVMSEL AT32_PVMSEL_LEV1
+
+/*
+ * IRQ system settings.
+ */
+#define AT32_IRQ_EXINT0_PRIORITY 6
+#define AT32_IRQ_EXINT1_PRIORITY 6
+#define AT32_IRQ_EXINT2_PRIORITY 6
+#define AT32_IRQ_EXINT3_PRIORITY 6
+#define AT32_IRQ_EXINT4_PRIORITY 6
+#define AT32_IRQ_EXINT5_9_PRIORITY 6
+#define AT32_IRQ_EXINT10_15_PRIORITY 6
+#define AT32_IRQ_EXINT16_PRIORITY 6
+#define AT32_IRQ_EXINT17_PRIORITY 15
+#define AT32_IRQ_EXINT18_PRIORITY 6
+#define AT32_IRQ_EXINT19_PRIORITY 6
+#define AT32_IRQ_EXINT20_PRIORITY 6
+#define AT32_IRQ_EXINT21_PRIORITY 15
+#define AT32_IRQ_EXINT22_PRIORITY 15
+
+#define AT32_IRQ_TMR1_BRK_TMR9_PRIORITY 7
+#define AT32_IRQ_TMR1_OVF_TMR10_PRIORITY 7
+#define AT32_IRQ_TMR1_HALL_TMR11_PRIORITY 7
+#define AT32_IRQ_TMR1_CH_PRIORITY 7
+#define AT32_IRQ_TMR2_PRIORITY 7
+#define AT32_IRQ_TMR3_PRIORITY 7
+#define AT32_IRQ_TMR4_PRIORITY 7
+#define AT32_IRQ_TMR5_PRIORITY 7
+
+#define AT32_IRQ_USART1_PRIORITY 12
+#define AT32_IRQ_USART2_PRIORITY 12
+#define AT32_IRQ_USART3_PRIORITY 12
+#define AT32_IRQ_UART4_PRIORITY 12
+#define AT32_IRQ_UART5_PRIORITY 12
+
+/*
+ * ADC driver system settings.
+ */
+#define AT32_ADC_USE_ADC1 FALSE
+#define AT32_ADC_ADC1_DMA_PRIORITY 2
+#define AT32_ADC_ADC1_IRQ_PRIORITY 6
+#define AT32_ADC_ADC1_DMA_IRQ_PRIORITY 6
+
+/*
+ * CAN driver system settings.
+ */
+#define AT32_CAN_USE_CAN1 FALSE
+#define AT32_CAN_CAN1_IRQ_PRIORITY 11
+
+/*
+ * DMA driver system settings.
+ */
+#define AT32_DMA_USE_DMAMUX FALSE
+
+/*
+ * GPT driver system settings.
+ */
+#define AT32_GPT_USE_TMR1 FALSE
+#define AT32_GPT_USE_TMR2 FALSE
+#define AT32_GPT_USE_TMR3 FALSE
+#define AT32_GPT_USE_TMR4 FALSE
+#define AT32_GPT_USE_TMR5 FALSE
+#define AT32_GPT_USE_TMR9 FALSE
+#define AT32_GPT_USE_TMR10 FALSE
+#define AT32_GPT_USE_TMR11 FALSE
+
+/*
+ * I2C driver system settings.
+ */
+#define AT32_I2C_USE_I2C1 TRUE
+#define AT32_I2C_USE_I2C2 TRUE
+#define AT32_I2C_BUSY_TIMEOUT 50
+#define AT32_I2C_I2C1_DMA_PRIORITY 3
+#define AT32_I2C_I2C2_DMA_PRIORITY 3
+#define AT32_I2C_I2C1_IRQ_PRIORITY 5
+#define AT32_I2C_I2C2_IRQ_PRIORITY 5
+#define AT32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
+
+/*
+ * ICU driver system settings.
+ */
+#define AT32_ICU_USE_TMR1 FALSE
+#define AT32_ICU_USE_TMR2 FALSE
+#define AT32_ICU_USE_TMR3 FALSE
+#define AT32_ICU_USE_TMR4 FALSE
+#define AT32_ICU_USE_TMR5 FALSE
+#define AT32_ICU_USE_TMR9 FALSE
+
+/*
+ * PWM driver system settings.
+ */
+#define AT32_PWM_USE_TMR1 FALSE
+#define AT32_PWM_USE_TMR2 FALSE
+#define AT32_PWM_USE_TMR3 FALSE
+#define AT32_PWM_USE_TMR4 FALSE
+#define AT32_PWM_USE_TMR5 FALSE
+#define AT32_PWM_USE_TMR9 FALSE
+#define AT32_PWM_USE_TMR10 FALSE
+#define AT32_PWM_USE_TMR11 FALSE
+
+/*
+ * RTC driver system settings.
+ */
+#define AT32_ERTC_DIVA_VALUE 32
+#define AT32_ERTC_DIVB_VALUE 1024
+#define AT32_ERTC_CTRL_INIT 0
+#define AT32_ERTC_TAMP_INIT 0
+
+/*
+ * SDC driver system settings.
+ */
+#define AT32_SDC_SDIO_DMA_PRIORITY 3
+#define AT32_SDC_SDIO_IRQ_PRIORITY 9
+#define AT32_SDC_WRITE_TIMEOUT_MS 1000
+#define AT32_SDC_READ_TIMEOUT_MS 1000
+#define AT32_SDC_CLOCK_ACTIVATION_DELAY 10
+#define AT32_SDC_SDIO_UNALIGNED_SUPPORT TRUE
+
+/*
+ * SERIAL driver system settings.
+ */
+#define AT32_SERIAL_USE_USART1 FALSE
+#define AT32_SERIAL_USE_USART2 FALSE
+#define AT32_SERIAL_USE_USART3 FALSE
+#define AT32_SERIAL_USE_UART4 FALSE
+#define AT32_SERIAL_USE_UART5 FALSE
+
+/*
+ * SPI driver system settings.
+ */
+#define AT32_SPI_USE_SPI1 FALSE
+#define AT32_SPI_USE_SPI2 FALSE
+#define AT32_SPI_SPI1_DMA_PRIORITY 1
+#define AT32_SPI_SPI2_DMA_PRIORITY 1
+#define AT32_SPI_SPI1_IRQ_PRIORITY 10
+#define AT32_SPI_SPI2_IRQ_PRIORITY 10
+#define AT32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
+
+/*
+ * ST driver system settings.
+ */
+#define AT32_ST_IRQ_PRIORITY 8
+#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
+
+/*
+ * UART driver system settings.
+ */
+#define AT32_UART_USE_USART1 FALSE
+#define AT32_UART_USE_USART2 FALSE
+#define AT32_UART_USE_USART3 FALSE
+#define AT32_UART_USE_UART4 FALSE
+#define AT32_UART_USE_UART5 FALSE
+#define AT32_UART_USART1_DMA_PRIORITY 0
+#define AT32_UART_USART2_DMA_PRIORITY 0
+#define AT32_UART_USART3_DMA_PRIORITY 0
+#define AT32_UART_UART4_DMA_PRIORITY 0
+#define AT32_UART_UART5_DMA_PRIORITY 0
+#define AT32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
+
+/*
+ * USB driver system settings.
+ */
+#define AT32_USB_USE_OTG1 FALSE
+#define AT32_USB_OTG1_IRQ_PRIORITY 14
+#define AT32_USB_OTG1_RX_FIFO_SIZE 512
+
+/*
+ * WDG driver system settings.
+ */
+#define AT32_WDG_USE_WDT FALSE
+
+#include "config.h"
+
+#endif /* MCUCONF_H */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/portab.c b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/portab.c
new file mode 100644
index 0000000000..3710c2dd9c
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/portab.c
@@ -0,0 +1,75 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file portab.c
+ * @brief Application portability module code.
+ *
+ * @addtogroup application_portability
+ * @{
+ */
+
+#include "hal.h"
+
+#include "portab.h"
+
+/*===========================================================================*/
+/* Module local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported variables. */
+/*===========================================================================*/
+
+/*
+ * I2C driver configuration structure.
+ */
+I2CConfig i2ccfg = {
+ OPMODE_I2C,
+ 100000,
+ STD_DUTY_CYCLE
+};
+
+/*===========================================================================*/
+/* Module local types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported functions. */
+/*===========================================================================*/
+
+void portab_setup(void) {
+
+ /* Master I2C1 SCL on PB6, SDA on PB7 */
+ palSetPadMode(GPIOB, 6, PAL_MODE_AT32_MUX_OPENDRAIN);
+ palSetPadMode(GPIOB, 7, PAL_MODE_AT32_MUX_OPENDRAIN);
+
+ /* Slave I2C2 SCL on PB10, SDA on PB11 */
+ palSetPadMode(GPIOB, 10, PAL_MODE_AT32_MUX_OPENDRAIN);
+ palSetPadMode(GPIOB, 11, PAL_MODE_AT32_MUX_OPENDRAIN);
+}
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/portab.h b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/portab.h
new file mode 100644
index 0000000000..89faf985cc
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/cfg/at-start-f415/portab.h
@@ -0,0 +1,81 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file portab.h
+ * @brief Application portability macros and structures.
+ *
+ * @addtogroup application_portability
+ * @{
+ */
+
+#ifndef PORTAB_H
+#define PORTAB_H
+
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+#define PORTAB_LINE_BUTTON LINE_BUTTON
+
+#define PORTAB_I2C_MASTER I2CD1
+#define PORTAB_I2C_SLAVE I2CD2
+
+#define PORTAB_BLINK_LED1 LINE_LED_RED
+#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
+#define PORTAB_BLINK_LED3 LINE_LED_GREEN
+
+#define PORTAB_SECTION
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+extern I2CConfig i2ccfg;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void portab_setup(void);
+#ifdef __cplusplus
+}
+#endif
+
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
+#endif /* PORTAB_H */
+
+/** @} */
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/main.c b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/main.c
new file mode 100644
index 0000000000..b328a1b3cb
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/main.c
@@ -0,0 +1,197 @@
+/*
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#include "ch.h"
+#include "hal.h"
+#include
+
+#include "portab.h"
+
+/*
+ * I2C address
+ */
+#define I2C_ADDR 0x18
+
+/*
+ * BUFFER SIZE
+ */
+#define BUFFER_SIZE 32
+
+/*
+ * Master operations
+ */
+#define MASTER_TRAS_RECV 0x00
+#define MASTER_TRAS 0x01
+#define MASTER_RECV 0x02
+
+/* Master buffer */
+#if CACHE_LINE_SIZE > 0
+CC_ALIGN_DATA(CACHE_LINE_SIZE)
+#endif
+uint8_t master_rx[CACHE_SIZE_ALIGN(uint8_t, BUFFER_SIZE)];
+
+#if CACHE_LINE_SIZE > 0
+CC_ALIGN_DATA(CACHE_LINE_SIZE)
+#endif
+uint8_t master_tx[CACHE_SIZE_ALIGN(uint8_t, BUFFER_SIZE)];
+
+/* Slave buffer */
+#if CACHE_LINE_SIZE > 0
+CC_ALIGN_DATA(CACHE_LINE_SIZE)
+#endif
+PORTAB_SECTION
+uint8_t slave_rx[CACHE_SIZE_ALIGN(uint8_t, BUFFER_SIZE)];
+
+#if CACHE_LINE_SIZE > 0
+CC_ALIGN_DATA(CACHE_LINE_SIZE)
+#endif
+PORTAB_SECTION
+uint8_t slave_tx[CACHE_SIZE_ALIGN(uint8_t, BUFFER_SIZE)];
+
+/*
+ * LED blinker thread, times are in milliseconds.
+ */
+static THD_WORKING_AREA(waThread1, 256);
+static THD_FUNCTION(Thread1, arg) {
+
+ (void)arg;
+ chRegSetThreadName("blinker");
+ while (true) {
+ palToggleLine(PORTAB_BLINK_LED3);
+ chThdSleepMilliseconds(500);
+ palToggleLine(PORTAB_BLINK_LED3);
+ chThdSleepMilliseconds(500);
+ }
+}
+
+/*
+ * This is a periodic thread waiting for master transmission.
+ */
+static THD_WORKING_AREA(waThread2, 512);
+static THD_FUNCTION(Thread2, arg) {
+
+ (void)arg;
+ chRegSetThreadName("i2cslave");
+
+ while (true) {
+ /* Wait for a master transmission */
+ i2cSlaveReceiveTimeout(&PORTAB_I2C_SLAVE, slave_rx, sizeof slave_rx, TIME_INFINITE);
+ cacheBufferInvalidate(slave_rx, sizeof slave_rx);
+
+ /* If the master needs a reply */
+ if (i2cSlaveIsAnswerRequired(&PORTAB_I2C_SLAVE)) {
+ cacheBufferFlush(slave_tx, sizeof slave_tx);
+ i2cSlaveTransmitTimeout(&PORTAB_I2C_SLAVE, slave_tx, sizeof slave_tx, TIME_INFINITE);
+ }
+ memset(slave_rx, 0, sizeof slave_rx);
+ }
+}
+
+/*
+ * This is a periodic thread testing all I2C Master operation.
+ */
+static THD_WORKING_AREA(waThread3, 512);
+static THD_FUNCTION(Thread3, arg) {
+
+ (void)arg;
+ chRegSetThreadName("i2cmaster");
+ uint8_t op = MASTER_TRAS_RECV;
+
+ while (true) {
+ if (palReadLine(PORTAB_LINE_BUTTON)) {
+
+ cacheBufferFlush(master_tx, sizeof master_tx);
+
+ if (op == MASTER_TRAS_RECV) {
+ i2cMasterTransmitTimeout(&PORTAB_I2C_MASTER, I2C_ADDR, master_tx, sizeof master_tx,
+ master_rx, BUFFER_SIZE, TIME_INFINITE);
+ cacheBufferInvalidate(master_rx, sizeof master_rx);
+ }
+ else if (op == MASTER_TRAS) {
+ i2cMasterTransmitTimeout(&PORTAB_I2C_MASTER, I2C_ADDR, master_tx, sizeof master_tx,
+ NULL, 0, TIME_INFINITE);
+ }
+ else {
+ i2cMasterReceiveTimeout(&PORTAB_I2C_MASTER, I2C_ADDR, master_rx, BUFFER_SIZE, TIME_INFINITE);
+ cacheBufferInvalidate(master_rx, sizeof master_rx);
+ }
+
+
+
+ /* Next operation */
+ if (op == MASTER_RECV) {
+ op = MASTER_TRAS_RECV;
+ }
+ else {
+ op++;
+ }
+
+ /* Reset buffer */
+ memset(master_rx, 0, sizeof master_rx);
+ }
+ chThdSleepMilliseconds(500);
+ }
+}
+
+/*
+ * Application entry point.
+ */
+int main(void) {
+
+ /*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ chSysInit();
+
+ /* Board-dependent setup code.*/
+ portab_setup();
+
+ /* Slave init */
+ memset(slave_rx, 0, sizeof slave_rx);
+ memcpy(slave_tx, "ChibiOS I2C Slave: reply phrase", sizeof slave_tx);
+
+ /* Master init */
+ memset(master_rx, 0, sizeof master_rx);
+ memcpy(master_tx, "ChibiOS I2C Master: test phrase", sizeof master_tx);
+
+ /* Start I2C Master */
+ i2cStart(&PORTAB_I2C_MASTER, &i2ccfg);
+
+ /* Start I2C Slave */
+ i2cStart(&PORTAB_I2C_SLAVE, &i2ccfg);
+ i2cSlaveMatchAddress(&PORTAB_I2C_SLAVE, I2C_ADDR);
+
+ /* Creates the blinker thread.*/
+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+
+ /* Creates the I2C slave thread.*/
+ chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);
+
+ /* Creates the I2C master thread.*/
+ chThdCreateStatic(waThread3, sizeof(waThread3), NORMALPRIO, Thread3, NULL);
+
+ /* Normal main() thread activity, in this demo it does nothing.*/
+ while (true) {
+ chThdSleepMilliseconds(500);
+ }
+}
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/make/at-start-f402.make b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/make/at-start-f402.make
new file mode 100644
index 0000000000..c2d5988d83
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/make/at-start-f402.make
@@ -0,0 +1,196 @@
+##############################################################################
+# Build global options
+# NOTE: Can be overridden externally.
+#
+
+# Compiler options here.
+ifeq ($(USE_OPT),)
+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
+endif
+
+# C specific options here (added to USE_OPT).
+ifeq ($(USE_COPT),)
+ USE_COPT =
+endif
+
+# C++ specific options here (added to USE_OPT).
+ifeq ($(USE_CPPOPT),)
+ USE_CPPOPT = -fno-rtti
+endif
+
+# Enable this if you want the linker to remove unused code and data.
+ifeq ($(USE_LINK_GC),)
+ USE_LINK_GC = yes
+endif
+
+# Linker extra options here.
+ifeq ($(USE_LDOPT),)
+ USE_LDOPT =
+endif
+
+# Enable this if you want link time optimizations (LTO).
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
+# Enable this if you want to see the full log while compiling.
+ifeq ($(USE_VERBOSE_COMPILE),)
+ USE_VERBOSE_COMPILE = no
+endif
+
+# If enabled, this option makes the build process faster by not compiling
+# modules not used in the current configuration.
+ifeq ($(USE_SMART_BUILD),)
+ USE_SMART_BUILD = yes
+endif
+
+# Enable this if you want to use bitbang I2C.
+ifeq ($(USE_HAL_I2C_FALLBACK),)
+ USE_HAL_I2C_FALLBACK = no
+endif
+
+#
+# Build global options
+##############################################################################
+
+##############################################################################
+# Architecture or project specific options
+#
+
+# Stack size to be allocated to the Cortex-M process stack. This stack is
+# the stack used by the main() thread.
+ifeq ($(USE_PROCESS_STACKSIZE),)
+ USE_PROCESS_STACKSIZE = 0x400
+endif
+
+# Stack size to the allocated to the Cortex-M main/exceptions stack. This
+# stack is used for processing interrupts and exceptions.
+ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
+ USE_EXCEPTIONS_STACKSIZE = 0x400
+endif
+
+# Enables the use of FPU (no, softfp, hard).
+ifeq ($(USE_FPU),)
+ USE_FPU = no
+endif
+
+# FPU-related options.
+ifeq ($(USE_FPU_OPT),)
+ USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
+endif
+
+#
+# Architecture or project specific options
+##############################################################################
+
+##############################################################################
+# Project, target, sources and paths
+#
+
+# Define project name here
+PROJECT = ch
+
+# Target settings.
+MCU = cortex-m4
+
+# Imported source files and paths.
+CHIBIOS := ../../../../../ChibiOS
+CHIBIOS_CONTRIB := ../../../..
+CONFDIR := ./cfg/at-start-f402
+BUILDDIR := ./build/at-start-f402
+DEPDIR := ./.dep/at-start-f402
+
+# Licensing files.
+include $(CHIBIOS)/os/license/license.mk
+# Startup files.
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_at32f402.mk
+# HAL-OSAL files (optional).
+include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
+include $(CHIBIOS_CONTRIB)/os/hal/ports/AT32/AT32F402_405/platform.mk
+include $(CHIBIOS_CONTRIB)/os/hal/boards/AT_START_F402/board.mk
+include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
+# RTOS files (optional).
+include $(CHIBIOS)/os/rt/rt.mk
+include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
+# Auto-build files in ./source recursively.
+include $(CHIBIOS)/tools/mk/autobuild.mk
+# Other files (optional).
+#include $(CHIBIOS)/os/test/test.mk
+#include $(CHIBIOS)/test/rt/rt_test.mk
+#include $(CHIBIOS)/test/oslib/oslib_test.mk
+
+# Define linker script file here.
+LDSCRIPT= $(STARTUPLD_CONTRIB)/AT32F402xC.ld
+
+# C sources that can be compiled in ARM or THUMB mode depending on the global
+# setting.
+CSRC = $(ALLCSRC) \
+ $(TESTSRC) \
+ $(CONFDIR)/portab.c \
+ main.c
+
+# C++ sources that can be compiled in ARM or THUMB mode depending on the global
+# setting.
+CPPSRC = $(ALLCPPSRC)
+
+# List ASM source files here.
+ASMSRC = $(ALLASMSRC)
+
+# List ASM with preprocessor source files here.
+ASMXSRC = $(ALLXASMSRC)
+
+# Inclusion directories.
+INCDIR = $(CONFDIR) $(ALLINC)
+
+# Define C warning options here.
+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
+
+# Define C++ warning options here.
+CPPWARN = -Wall -Wextra -Wundef
+
+#
+# Project, target, sources and paths
+##############################################################################
+
+##############################################################################
+# Start of user section
+#
+
+# List all user C define here, like -D_DEBUG=1
+UDEFS =
+
+# Define ASM defines here
+UADEFS =
+
+# List all user directories here
+UINCDIR =
+
+# List the user directory to look for the libraries here
+ULIBDIR =
+
+# List all user libraries here
+ULIBS =
+
+#
+# End of user section
+##############################################################################
+
+##############################################################################
+# Common rules
+#
+
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
+include $(RULESPATH)/arm-none-eabi.mk
+include $(RULESPATH)/rules.mk
+
+#
+# Common rules
+##############################################################################
+
+##############################################################################
+# Custom rules
+#
+
+#
+# Custom rules
+##############################################################################
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/make/at-start-f405.make b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/make/at-start-f405.make
new file mode 100644
index 0000000000..d3cc3ac36c
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/make/at-start-f405.make
@@ -0,0 +1,196 @@
+##############################################################################
+# Build global options
+# NOTE: Can be overridden externally.
+#
+
+# Compiler options here.
+ifeq ($(USE_OPT),)
+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
+endif
+
+# C specific options here (added to USE_OPT).
+ifeq ($(USE_COPT),)
+ USE_COPT =
+endif
+
+# C++ specific options here (added to USE_OPT).
+ifeq ($(USE_CPPOPT),)
+ USE_CPPOPT = -fno-rtti
+endif
+
+# Enable this if you want the linker to remove unused code and data.
+ifeq ($(USE_LINK_GC),)
+ USE_LINK_GC = yes
+endif
+
+# Linker extra options here.
+ifeq ($(USE_LDOPT),)
+ USE_LDOPT =
+endif
+
+# Enable this if you want link time optimizations (LTO).
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
+# Enable this if you want to see the full log while compiling.
+ifeq ($(USE_VERBOSE_COMPILE),)
+ USE_VERBOSE_COMPILE = no
+endif
+
+# If enabled, this option makes the build process faster by not compiling
+# modules not used in the current configuration.
+ifeq ($(USE_SMART_BUILD),)
+ USE_SMART_BUILD = yes
+endif
+
+# Enable this if you want to use bitbang I2C.
+ifeq ($(USE_HAL_I2C_FALLBACK),)
+ USE_HAL_I2C_FALLBACK = no
+endif
+
+#
+# Build global options
+##############################################################################
+
+##############################################################################
+# Architecture or project specific options
+#
+
+# Stack size to be allocated to the Cortex-M process stack. This stack is
+# the stack used by the main() thread.
+ifeq ($(USE_PROCESS_STACKSIZE),)
+ USE_PROCESS_STACKSIZE = 0x400
+endif
+
+# Stack size to the allocated to the Cortex-M main/exceptions stack. This
+# stack is used for processing interrupts and exceptions.
+ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
+ USE_EXCEPTIONS_STACKSIZE = 0x400
+endif
+
+# Enables the use of FPU (no, softfp, hard).
+ifeq ($(USE_FPU),)
+ USE_FPU = no
+endif
+
+# FPU-related options.
+ifeq ($(USE_FPU_OPT),)
+ USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
+endif
+
+#
+# Architecture or project specific options
+##############################################################################
+
+##############################################################################
+# Project, target, sources and paths
+#
+
+# Define project name here
+PROJECT = ch
+
+# Target settings.
+MCU = cortex-m4
+
+# Imported source files and paths.
+CHIBIOS := ../../../../../ChibiOS
+CHIBIOS_CONTRIB := ../../../..
+CONFDIR := ./cfg/at-start-f405
+BUILDDIR := ./build/at-start-f405
+DEPDIR := ./.dep/at-start-f405
+
+# Licensing files.
+include $(CHIBIOS)/os/license/license.mk
+# Startup files.
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_at32f405.mk
+# HAL-OSAL files (optional).
+include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
+include $(CHIBIOS_CONTRIB)/os/hal/ports/AT32/AT32F402_405/platform.mk
+include $(CHIBIOS_CONTRIB)/os/hal/boards/AT_START_F405/board.mk
+include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
+# RTOS files (optional).
+include $(CHIBIOS)/os/rt/rt.mk
+include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
+# Auto-build files in ./source recursively.
+include $(CHIBIOS)/tools/mk/autobuild.mk
+# Other files (optional).
+#include $(CHIBIOS)/os/test/test.mk
+#include $(CHIBIOS)/test/rt/rt_test.mk
+#include $(CHIBIOS)/test/oslib/oslib_test.mk
+
+# Define linker script file here.
+LDSCRIPT= $(STARTUPLD_CONTRIB)/AT32F405xC.ld
+
+# C sources that can be compiled in ARM or THUMB mode depending on the global
+# setting.
+CSRC = $(ALLCSRC) \
+ $(TESTSRC) \
+ $(CONFDIR)/portab.c \
+ main.c
+
+# C++ sources that can be compiled in ARM or THUMB mode depending on the global
+# setting.
+CPPSRC = $(ALLCPPSRC)
+
+# List ASM source files here.
+ASMSRC = $(ALLASMSRC)
+
+# List ASM with preprocessor source files here.
+ASMXSRC = $(ALLXASMSRC)
+
+# Inclusion directories.
+INCDIR = $(CONFDIR) $(ALLINC)
+
+# Define C warning options here.
+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
+
+# Define C++ warning options here.
+CPPWARN = -Wall -Wextra -Wundef
+
+#
+# Project, target, sources and paths
+##############################################################################
+
+##############################################################################
+# Start of user section
+#
+
+# List all user C define here, like -D_DEBUG=1
+UDEFS =
+
+# Define ASM defines here
+UADEFS =
+
+# List all user directories here
+UINCDIR =
+
+# List the user directory to look for the libraries here
+ULIBDIR =
+
+# List all user libraries here
+ULIBS =
+
+#
+# End of user section
+##############################################################################
+
+##############################################################################
+# Common rules
+#
+
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
+include $(RULESPATH)/arm-none-eabi.mk
+include $(RULESPATH)/rules.mk
+
+#
+# Common rules
+##############################################################################
+
+##############################################################################
+# Custom rules
+#
+
+#
+# Custom rules
+##############################################################################
diff --git a/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/make/at-start-f415.make b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/make/at-start-f415.make
new file mode 100644
index 0000000000..ae14ade555
--- /dev/null
+++ b/testhal/AT32/multi/I2C_HW-MASTER_SLAVE/make/at-start-f415.make
@@ -0,0 +1,196 @@
+##############################################################################
+# Build global options
+# NOTE: Can be overridden externally.
+#
+
+# Compiler options here.
+ifeq ($(USE_OPT),)
+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
+endif
+
+# C specific options here (added to USE_OPT).
+ifeq ($(USE_COPT),)
+ USE_COPT =
+endif
+
+# C++ specific options here (added to USE_OPT).
+ifeq ($(USE_CPPOPT),)
+ USE_CPPOPT = -fno-rtti
+endif
+
+# Enable this if you want the linker to remove unused code and data.
+ifeq ($(USE_LINK_GC),)
+ USE_LINK_GC = yes
+endif
+
+# Linker extra options here.
+ifeq ($(USE_LDOPT),)
+ USE_LDOPT =
+endif
+
+# Enable this if you want link time optimizations (LTO).
+ifeq ($(USE_LTO),)
+ USE_LTO = yes
+endif
+
+# Enable this if you want to see the full log while compiling.
+ifeq ($(USE_VERBOSE_COMPILE),)
+ USE_VERBOSE_COMPILE = no
+endif
+
+# If enabled, this option makes the build process faster by not compiling
+# modules not used in the current configuration.
+ifeq ($(USE_SMART_BUILD),)
+ USE_SMART_BUILD = yes
+endif
+
+# Enable this if you want to use bitbang I2C.
+ifeq ($(USE_HAL_I2C_FALLBACK),)
+ USE_HAL_I2C_FALLBACK = no
+endif
+
+#
+# Build global options
+##############################################################################
+
+##############################################################################
+# Architecture or project specific options
+#
+
+# Stack size to be allocated to the Cortex-M process stack. This stack is
+# the stack used by the main() thread.
+ifeq ($(USE_PROCESS_STACKSIZE),)
+ USE_PROCESS_STACKSIZE = 0x400
+endif
+
+# Stack size to the allocated to the Cortex-M main/exceptions stack. This
+# stack is used for processing interrupts and exceptions.
+ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
+ USE_EXCEPTIONS_STACKSIZE = 0x400
+endif
+
+# Enables the use of FPU (no, softfp, hard).
+ifeq ($(USE_FPU),)
+ USE_FPU = no
+endif
+
+# FPU-related options.
+ifeq ($(USE_FPU_OPT),)
+ USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
+endif
+
+#
+# Architecture or project specific options
+##############################################################################
+
+##############################################################################
+# Project, target, sources and paths
+#
+
+# Define project name here
+PROJECT = ch
+
+# Target settings.
+MCU = cortex-m4
+
+# Imported source files and paths.
+CHIBIOS := ../../../../../ChibiOS
+CHIBIOS_CONTRIB := ../../../..
+CONFDIR := ./cfg/at-start-f415
+BUILDDIR := ./build/at-start-f415
+DEPDIR := ./.dep/at-start-f415
+
+# Licensing files.
+include $(CHIBIOS)/os/license/license.mk
+# Startup files.
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_at32f415.mk
+# HAL-OSAL files (optional).
+include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
+include $(CHIBIOS_CONTRIB)/os/hal/ports/AT32/AT32F415/platform.mk
+include $(CHIBIOS_CONTRIB)/os/hal/boards/AT_START_F415/board.mk
+include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
+# RTOS files (optional).
+include $(CHIBIOS)/os/rt/rt.mk
+include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
+# Auto-build files in ./source recursively.
+include $(CHIBIOS)/tools/mk/autobuild.mk
+# Other files (optional).
+#include $(CHIBIOS)/os/test/test.mk
+#include $(CHIBIOS)/test/rt/rt_test.mk
+#include $(CHIBIOS)/test/oslib/oslib_test.mk
+
+# Define linker script file here.
+LDSCRIPT= $(STARTUPLD_CONTRIB)/AT32F415xC.ld
+
+# C sources that can be compiled in ARM or THUMB mode depending on the global
+# setting.
+CSRC = $(ALLCSRC) \
+ $(TESTSRC) \
+ $(CONFDIR)/portab.c \
+ main.c
+
+# C++ sources that can be compiled in ARM or THUMB mode depending on the global
+# setting.
+CPPSRC = $(ALLCPPSRC)
+
+# List ASM source files here.
+ASMSRC = $(ALLASMSRC)
+
+# List ASM with preprocessor source files here.
+ASMXSRC = $(ALLXASMSRC)
+
+# Inclusion directories.
+INCDIR = $(CONFDIR) $(ALLINC)
+
+# Define C warning options here.
+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
+
+# Define C++ warning options here.
+CPPWARN = -Wall -Wextra -Wundef
+
+#
+# Project, target, sources and paths
+##############################################################################
+
+##############################################################################
+# Start of user section
+#
+
+# List all user C define here, like -D_DEBUG=1
+UDEFS =
+
+# Define ASM defines here
+UADEFS =
+
+# List all user directories here
+UINCDIR =
+
+# List the user directory to look for the libraries here
+ULIBDIR =
+
+# List all user libraries here
+ULIBS =
+
+#
+# End of user section
+##############################################################################
+
+##############################################################################
+# Common rules
+#
+
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
+include $(RULESPATH)/arm-none-eabi.mk
+include $(RULESPATH)/rules.mk
+
+#
+# Common rules
+##############################################################################
+
+##############################################################################
+# Custom rules
+#
+
+#
+# Custom rules
+##############################################################################
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/chconf.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/chconf.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/config.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/config.h
index 1e7c044f47..74e0f4980d 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/config.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/halconf.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/halconf.h
index 7c7964f295..d734d0fd19 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/halconf.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/halconf_community.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/halconf_community.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/mcuconf.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/mcuconf.h
index de5ef83e35..bb55cb5259 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/mcuconf.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +229,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/portab.c b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/portab.c
index 95d45183f7..d57b5a3730 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/portab.c
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/portab.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/portab.h
index c714e7e8f1..d2dc838f91 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/portab.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f402/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@
#define PORTAB_I2C1 I2CD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/chconf.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/chconf.h
index 56fe06776a..e87d2f17e6 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/chconf.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/config.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/config.h
index 1e7c044f47..4eec5f91bc 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/config.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/halconf.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/halconf.h
index 7c7964f295..7fa13effa3 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/halconf.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/halconf_community.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/halconf_community.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/mcuconf.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/mcuconf.h
index ae59b7a87b..a13d5b18d9 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/mcuconf.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/portab.c b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/portab.c
index 95d45183f7..d57b5a3730 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/portab.c
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/portab.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/portab.h
index c714e7e8f1..d2dc838f91 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/portab.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f405/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@
#define PORTAB_I2C1 I2CD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/chconf.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/config.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/config.h
index 056a8f39ff..fe19c2eb77 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/config.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/halconf.h
index 7c7964f295..d734d0fd19 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/halconf.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/halconf_community.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/mcuconf.h
index 1e76232a99..5e41a5aca6 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/mcuconf.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/portab.c b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/portab.c
index ac59375175..4364cea63e 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/portab.c
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/portab.h b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/portab.h
index c714e7e8f1..d2dc838f91 100644
--- a/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/portab.h
+++ b/testhal/AT32/multi/I2C_HW/cfg/at-start-f415/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@
#define PORTAB_I2C1 I2CD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_HW/main.c b/testhal/AT32/multi/I2C_HW/main.c
index 9e741b0ce0..6a8aec1e08 100644
--- a/testhal/AT32/multi/I2C_HW/main.c
+++ b/testhal/AT32/multi/I2C_HW/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/chconf.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/chconf.h
index 5988b2b4b9..dcf0556de4 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/chconf.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/config.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/config.h
index 109de45450..2b896cc0ff 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/config.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/halconf.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/halconf.h
index 7c7964f295..d734d0fd19 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/halconf.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/halconf_community.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/halconf_community.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/mcuconf.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/mcuconf.h
index 09806daf4b..19db3510e8 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/mcuconf.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +229,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/portab.c b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/portab.c
index d9f0b8a099..987954f3a5 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/portab.c
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/portab.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/portab.h
index e01c42ed43..cdc8adc75d 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/portab.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f402/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,13 +34,10 @@
#define PORTAB_I2C1 I2CD1
#define PORTAB_SCL_PIN PAL_LINE(GPIOB, 6U)
-
#define PORTAB_SDA_PIN PAL_LINE(GPIOB, 7U)
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/chconf.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/chconf.h
index 5988b2b4b9..44f86ded13 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/chconf.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/config.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/config.h
index 109de45450..60a7a9f9bb 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/config.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/halconf.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/halconf.h
index 7c7964f295..7fa13effa3 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/halconf.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/halconf_community.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/halconf_community.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/mcuconf.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/mcuconf.h
index 760c5a94c2..eacbe07f78 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/mcuconf.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/portab.c b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/portab.c
index d9f0b8a099..987954f3a5 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/portab.c
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/portab.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/portab.h
index e01c42ed43..cdc8adc75d 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/portab.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f405/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,13 +34,10 @@
#define PORTAB_I2C1 I2CD1
#define PORTAB_SCL_PIN PAL_LINE(GPIOB, 6U)
-
#define PORTAB_SDA_PIN PAL_LINE(GPIOB, 7U)
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/chconf.h
index 5988b2b4b9..dcf0556de4 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/chconf.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/config.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/config.h
index acc9892f31..daefaa3b9f 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/config.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/halconf.h
index 7c7964f295..d734d0fd19 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/halconf.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/halconf_community.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/mcuconf.h
index eeeaecc624..1f1709b160 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/mcuconf.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/portab.c b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/portab.c
index d9f0b8a099..987954f3a5 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/portab.c
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/portab.h b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/portab.h
index e01c42ed43..cdc8adc75d 100644
--- a/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/portab.h
+++ b/testhal/AT32/multi/I2C_SW/cfg/at-start-f415/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,13 +34,10 @@
#define PORTAB_I2C1 I2CD1
#define PORTAB_SCL_PIN PAL_LINE(GPIOB, 6U)
-
#define PORTAB_SDA_PIN PAL_LINE(GPIOB, 7U)
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/I2C_SW/main.c b/testhal/AT32/multi/I2C_SW/main.c
index 9e741b0ce0..6a8aec1e08 100644
--- a/testhal/AT32/multi/I2C_SW/main.c
+++ b/testhal/AT32/multi/I2C_SW/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/chconf.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/chconf.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/config.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/config.h
index 1e7c044f47..74e0f4980d 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/config.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/halconf.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/halconf.h
index 5e60756d28..121c8f4889 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/halconf.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/halconf_community.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/halconf_community.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/mcuconf.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/mcuconf.h
index 5e7c25e015..b205c60934 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/mcuconf.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +229,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/portab.c b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/portab.c
index b1bd7ba902..3339ef6658 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/portab.c
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/portab.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/portab.h
index b470c57707..77c030ec88 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/portab.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f402/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_ICU1 ICUD3
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/chconf.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/chconf.h
index 56fe06776a..e87d2f17e6 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/chconf.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/config.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/config.h
index 1e7c044f47..4eec5f91bc 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/config.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/halconf.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/halconf.h
index 5e60756d28..577d79fba3 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/halconf.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/halconf_community.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/halconf_community.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/mcuconf.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/mcuconf.h
index 39864f3d0b..7c5321a791 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/mcuconf.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/portab.c b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/portab.c
index b1bd7ba902..3339ef6658 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/portab.c
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/portab.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/portab.h
index b470c57707..77c030ec88 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/portab.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f405/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_ICU1 ICUD3
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/chconf.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/config.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/config.h
index 056a8f39ff..fe19c2eb77 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/config.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/halconf.h
index 5e60756d28..121c8f4889 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/halconf.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/halconf_community.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/mcuconf.h
index 4ae2652a32..a11c65bcec 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/mcuconf.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/portab.c b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/portab.c
index 571be5beba..bf0144bf8a 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/portab.c
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/portab.h b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/portab.h
index b470c57707..77c030ec88 100644
--- a/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/portab.h
+++ b/testhal/AT32/multi/PWM_ICU/cfg/at-start-f415/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_ICU1 ICUD3
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/PWM_ICU/main.c b/testhal/AT32/multi/PWM_ICU/main.c
index af9a6c7b1b..7f7b0e00a8 100644
--- a/testhal/AT32/multi/PWM_ICU/main.c
+++ b/testhal/AT32/multi/PWM_ICU/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/chconf.h
+++ b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/config.h b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/config.h
index 056a8f39ff..fe19c2eb77 100644
--- a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/config.h
+++ b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/halconf.h
index bb8b75d312..1798a46755 100644
--- a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/halconf.h
+++ b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/halconf_community.h
+++ b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/mcuconf.h
index 61aa7ec5fd..ff845606fa 100644
--- a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/mcuconf.h
+++ b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/portab.c b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/portab.c
+++ b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/portab.h b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/portab.h
index acf5bef758..50a2fcecff 100644
--- a/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/portab.h
+++ b/testhal/AT32/multi/SDC-FATFS/cfg/at-start-f415/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SD1 SD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/SDC-FATFS/main.c b/testhal/AT32/multi/SDC-FATFS/main.c
index 34ff5f2c6e..63e3412060 100644
--- a/testhal/AT32/multi/SDC-FATFS/main.c
+++ b/testhal/AT32/multi/SDC-FATFS/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SDC/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/SDC/cfg/at-start-f415/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/SDC/cfg/at-start-f415/chconf.h
+++ b/testhal/AT32/multi/SDC/cfg/at-start-f415/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/SDC/cfg/at-start-f415/config.h b/testhal/AT32/multi/SDC/cfg/at-start-f415/config.h
index 056a8f39ff..fe19c2eb77 100644
--- a/testhal/AT32/multi/SDC/cfg/at-start-f415/config.h
+++ b/testhal/AT32/multi/SDC/cfg/at-start-f415/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SDC/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/SDC/cfg/at-start-f415/halconf.h
index bb8b75d312..1798a46755 100644
--- a/testhal/AT32/multi/SDC/cfg/at-start-f415/halconf.h
+++ b/testhal/AT32/multi/SDC/cfg/at-start-f415/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/SDC/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/SDC/cfg/at-start-f415/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/SDC/cfg/at-start-f415/halconf_community.h
+++ b/testhal/AT32/multi/SDC/cfg/at-start-f415/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SDC/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/SDC/cfg/at-start-f415/mcuconf.h
index 61aa7ec5fd..ff845606fa 100644
--- a/testhal/AT32/multi/SDC/cfg/at-start-f415/mcuconf.h
+++ b/testhal/AT32/multi/SDC/cfg/at-start-f415/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/SDC/cfg/at-start-f415/portab.c b/testhal/AT32/multi/SDC/cfg/at-start-f415/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/SDC/cfg/at-start-f415/portab.c
+++ b/testhal/AT32/multi/SDC/cfg/at-start-f415/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SDC/cfg/at-start-f415/portab.h b/testhal/AT32/multi/SDC/cfg/at-start-f415/portab.h
index acf5bef758..50a2fcecff 100644
--- a/testhal/AT32/multi/SDC/cfg/at-start-f415/portab.h
+++ b/testhal/AT32/multi/SDC/cfg/at-start-f415/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SD1 SD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/SDC/main.c b/testhal/AT32/multi/SDC/main.c
index 30b1d7f473..ed790cc125 100644
--- a/testhal/AT32/multi/SDC/main.c
+++ b/testhal/AT32/multi/SDC/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f402/chconf.h b/testhal/AT32/multi/SIO/cfg/at-start-f402/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f402/chconf.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f402/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f402/config.h b/testhal/AT32/multi/SIO/cfg/at-start-f402/config.h
index 1e7c044f47..74e0f4980d 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f402/config.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f402/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f402/halconf.h b/testhal/AT32/multi/SIO/cfg/at-start-f402/halconf.h
index 21eed8aaf1..b53a656dc3 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f402/halconf.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f402/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f402/halconf_community.h b/testhal/AT32/multi/SIO/cfg/at-start-f402/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f402/halconf_community.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f402/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f402/mcuconf.h b/testhal/AT32/multi/SIO/cfg/at-start-f402/mcuconf.h
index 93644549c9..5d6e780f1e 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f402/mcuconf.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f402/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +229,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f402/portab.c b/testhal/AT32/multi/SIO/cfg/at-start-f402/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f402/portab.c
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f402/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f402/portab.h b/testhal/AT32/multi/SIO/cfg/at-start-f402/portab.h
index 6c48277ad0..9fa9d962bd 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f402/portab.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f402/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -32,7 +32,6 @@
/*===========================================================================*/
#define PORTAB_SIO1 SIOD1
-
#define PORTAB_SIO2 SIOD2
#define PORTAB_LINE_BUTTON LINE_BUTTON
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f405/chconf.h b/testhal/AT32/multi/SIO/cfg/at-start-f405/chconf.h
index 56fe06776a..e87d2f17e6 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f405/chconf.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f405/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f405/config.h b/testhal/AT32/multi/SIO/cfg/at-start-f405/config.h
index 1e7c044f47..4eec5f91bc 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f405/config.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f405/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f405/halconf.h b/testhal/AT32/multi/SIO/cfg/at-start-f405/halconf.h
index 21eed8aaf1..957a047a38 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f405/halconf.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f405/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f405/halconf_community.h b/testhal/AT32/multi/SIO/cfg/at-start-f405/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f405/halconf_community.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f405/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f405/mcuconf.h b/testhal/AT32/multi/SIO/cfg/at-start-f405/mcuconf.h
index 9d8b29ed8f..36d4a8cbd1 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f405/mcuconf.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f405/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f405/portab.c b/testhal/AT32/multi/SIO/cfg/at-start-f405/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f405/portab.c
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f405/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/SIO/cfg/at-start-f405/portab.h b/testhal/AT32/multi/SIO/cfg/at-start-f405/portab.h
index 6c48277ad0..9fa9d962bd 100644
--- a/testhal/AT32/multi/SIO/cfg/at-start-f405/portab.h
+++ b/testhal/AT32/multi/SIO/cfg/at-start-f405/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -32,7 +32,6 @@
/*===========================================================================*/
#define PORTAB_SIO1 SIOD1
-
#define PORTAB_SIO2 SIOD2
#define PORTAB_LINE_BUTTON LINE_BUTTON
diff --git a/testhal/AT32/multi/SIO/main.c b/testhal/AT32/multi/SIO/main.c
index c2a35c7afc..c7513d7e82 100644
--- a/testhal/AT32/multi/SIO/main.c
+++ b/testhal/AT32/multi/SIO/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f402/chconf.h b/testhal/AT32/multi/UART/cfg/at-start-f402/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f402/chconf.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f402/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f402/config.h b/testhal/AT32/multi/UART/cfg/at-start-f402/config.h
index 1e7c044f47..74e0f4980d 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f402/config.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f402/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f402/halconf.h b/testhal/AT32/multi/UART/cfg/at-start-f402/halconf.h
index 0b4bc04482..c685f447d7 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f402/halconf.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f402/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f402/halconf_community.h b/testhal/AT32/multi/UART/cfg/at-start-f402/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f402/halconf_community.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f402/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f402/mcuconf.h b/testhal/AT32/multi/UART/cfg/at-start-f402/mcuconf.h
index c4787f773c..217077955f 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f402/mcuconf.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f402/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +229,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f402/portab.c b/testhal/AT32/multi/UART/cfg/at-start-f402/portab.c
index c61b6ed4be..d449d2ea4b 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f402/portab.c
+++ b/testhal/AT32/multi/UART/cfg/at-start-f402/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f402/portab.h b/testhal/AT32/multi/UART/cfg/at-start-f402/portab.h
index 35724bce27..a2e7d9ff4c 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f402/portab.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f402/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@
#define PORTAB_UART1 UARTD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f405/chconf.h b/testhal/AT32/multi/UART/cfg/at-start-f405/chconf.h
index 56fe06776a..e87d2f17e6 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f405/chconf.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f405/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f405/config.h b/testhal/AT32/multi/UART/cfg/at-start-f405/config.h
index 1e7c044f47..4eec5f91bc 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f405/config.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f405/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f405/halconf.h b/testhal/AT32/multi/UART/cfg/at-start-f405/halconf.h
index 0b4bc04482..0aea1f6798 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f405/halconf.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f405/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f405/halconf_community.h b/testhal/AT32/multi/UART/cfg/at-start-f405/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f405/halconf_community.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f405/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f405/mcuconf.h b/testhal/AT32/multi/UART/cfg/at-start-f405/mcuconf.h
index 3ad2801e5f..612861ead0 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f405/mcuconf.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f405/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f405/portab.c b/testhal/AT32/multi/UART/cfg/at-start-f405/portab.c
index c61b6ed4be..d449d2ea4b 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f405/portab.c
+++ b/testhal/AT32/multi/UART/cfg/at-start-f405/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f405/portab.h b/testhal/AT32/multi/UART/cfg/at-start-f405/portab.h
index 35724bce27..a2e7d9ff4c 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f405/portab.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f405/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@
#define PORTAB_UART1 UARTD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/UART/cfg/at-start-f415/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f415/chconf.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f415/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f415/config.h b/testhal/AT32/multi/UART/cfg/at-start-f415/config.h
index 056a8f39ff..fe19c2eb77 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f415/config.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f415/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/UART/cfg/at-start-f415/halconf.h
index 0b4bc04482..c685f447d7 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f415/halconf.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f415/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/UART/cfg/at-start-f415/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f415/halconf_community.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f415/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/UART/cfg/at-start-f415/mcuconf.h
index 072eb17843..bd484bac3d 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f415/mcuconf.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f415/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f415/portab.c b/testhal/AT32/multi/UART/cfg/at-start-f415/portab.c
index a88c37c50e..c2454ef957 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f415/portab.c
+++ b/testhal/AT32/multi/UART/cfg/at-start-f415/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/UART/cfg/at-start-f415/portab.h b/testhal/AT32/multi/UART/cfg/at-start-f415/portab.h
index 35724bce27..a2e7d9ff4c 100644
--- a/testhal/AT32/multi/UART/cfg/at-start-f415/portab.h
+++ b/testhal/AT32/multi/UART/cfg/at-start-f415/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@
#define PORTAB_UART1 UARTD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/UART/main.c b/testhal/AT32/multi/UART/main.c
index 0c7e047a2d..aecd3946cf 100644
--- a/testhal/AT32/multi/UART/main.c
+++ b/testhal/AT32/multi/UART/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/chconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/chconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/config.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/config.h
index 1e7c044f47..74e0f4980d 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/config.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/halconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/halconf.h
index 46b022f93d..ee34a3316e 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/halconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/halconf_community.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/halconf_community.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/mcuconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/mcuconf.h
index 98f48374a0..f58c6e328e 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/mcuconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +229,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/portab.c b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/portab.c
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/portab.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/portab.h
index 42ddef6c9e..028459fe50 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/portab.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f402/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SDU1 SDU1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/chconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/chconf.h
index 56fe06776a..e87d2f17e6 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/chconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/config.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/config.h
index 1e7c044f47..4eec5f91bc 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/config.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/halconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/halconf.h
index 46b022f93d..4e7f5ff1ae 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/halconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/halconf_community.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/halconf_community.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/mcuconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/mcuconf.h
index e91d34e63f..541b772b45 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/mcuconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
@@ -260,6 +262,7 @@
#define AT32_USB_OTG2_IRQ_PRIORITY 14
#define AT32_USB_OTG1_RX_FIFO_SIZE 512
#define AT32_USB_OTG2_RX_FIFO_SIZE 1024
+#define AT32_USE_USB_OTG2_HS_DMA FALSE
/*
* WDG driver system settings.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/portab.c b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/portab.c
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/portab.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/portab.h
index 42ddef6c9e..028459fe50 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/portab.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbfs/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SDU1 SDU1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/chconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/chconf.h
index 56fe06776a..e87d2f17e6 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/chconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/config.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/config.h
index 1e7c044f47..4eec5f91bc 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/config.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/halconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/halconf.h
index 46b022f93d..4e7f5ff1ae 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/halconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/halconf_community.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/halconf_community.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/mcuconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/mcuconf.h
index c83fc95efc..a02aea1c73 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/mcuconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/portab.c b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/portab.c
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/portab.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/portab.h
index 23c10a93cb..5f171861eb 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/portab.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs-dma/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SDU1 SDU1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/chconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/chconf.h
index 56fe06776a..e87d2f17e6 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/chconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/config.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/config.h
index 1e7c044f47..4eec5f91bc 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/config.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/halconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/halconf.h
index 46b022f93d..4e7f5ff1ae 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/halconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/halconf_community.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/halconf_community.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/mcuconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/mcuconf.h
index 6202e39c0f..677bc9a715 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/mcuconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/portab.c b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/portab.c
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/portab.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/portab.h
index 23c10a93cb..5f171861eb 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/portab.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f405_usbhs/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SDU1 SDU1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/chconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/config.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/config.h
index 056a8f39ff..fe19c2eb77 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/config.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/halconf.h
index 46b022f93d..ee34a3316e 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/halconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/halconf_community.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/mcuconf.h
index caae00def9..f8d4e2d229 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/mcuconf.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/portab.c b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/portab.c
index ceaf0ff400..821e045d3a 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/portab.c
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/portab.h b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/portab.h
index 42ddef6c9e..028459fe50 100644
--- a/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/portab.h
+++ b/testhal/AT32/multi/USB_CDC/cfg/at-start-f415/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@
#define PORTAB_SDU1 SDU1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/USB_CDC/main.c b/testhal/AT32/multi/USB_CDC/main.c
index 98a52fa02f..7c69aa293d 100644
--- a/testhal/AT32/multi/USB_CDC/main.c
+++ b/testhal/AT32/multi/USB_CDC/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/source/usbcfg.c b/testhal/AT32/multi/USB_CDC/source/usbcfg.c
index f5415c1839..0fabd0ee65 100644
--- a/testhal/AT32/multi/USB_CDC/source/usbcfg.c
+++ b/testhal/AT32/multi/USB_CDC/source/usbcfg.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/USB_CDC/source/usbcfg.h b/testhal/AT32/multi/USB_CDC/source/usbcfg.h
index b717d357ff..16012b3767 100644
--- a/testhal/AT32/multi/USB_CDC/source/usbcfg.h
+++ b/testhal/AT32/multi/USB_CDC/source/usbcfg.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f402/chconf.h b/testhal/AT32/multi/WDT/cfg/at-start-f402/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f402/chconf.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f402/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f402/config.h b/testhal/AT32/multi/WDT/cfg/at-start-f402/config.h
index 1e7c044f47..74e0f4980d 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f402/config.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f402/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f402/halconf.h b/testhal/AT32/multi/WDT/cfg/at-start-f402/halconf.h
index ba89c66d2c..40291e3e1f 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f402/halconf.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f402/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f402/halconf_community.h b/testhal/AT32/multi/WDT/cfg/at-start-f402/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f402/halconf_community.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f402/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f402/mcuconf.h b/testhal/AT32/multi/WDT/cfg/at-start-f402/mcuconf.h
index ff7cab6b7f..28d17aa751 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f402/mcuconf.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f402/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +229,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f402/portab.c b/testhal/AT32/multi/WDT/cfg/at-start-f402/portab.c
index bd71ff0084..fbfdf082be 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f402/portab.c
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f402/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f402/portab.h b/testhal/AT32/multi/WDT/cfg/at-start-f402/portab.h
index f81dad3fbe..14ac634945 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f402/portab.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f402/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@
#define PORTAB_WDT1 WDGD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f405/chconf.h b/testhal/AT32/multi/WDT/cfg/at-start-f405/chconf.h
index 56fe06776a..e87d2f17e6 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f405/chconf.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f405/chconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +52,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +77,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +88,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +159,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +626,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +649,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +661,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +698,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +714,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +734,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +744,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +755,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +779,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +789,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f405/config.h b/testhal/AT32/multi/WDT/cfg/at-start-f405/config.h
index 1e7c044f47..4eec5f91bc 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f405/config.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f405/config.h
@@ -1,6 +1,7 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f405/halconf.h b/testhal/AT32/multi/WDT/cfg/at-start-f405/halconf.h
index ba89c66d2c..3bd675f4ec 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f405/halconf.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f405/halconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +36,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +78,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +322,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +553,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f405/halconf_community.h b/testhal/AT32/multi/WDT/cfg/at-start-f405/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f405/halconf_community.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f405/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f405/mcuconf.h b/testhal/AT32/multi/WDT/cfg/at-start-f405/mcuconf.h
index 7959d53aef..27e2acc530 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f405/mcuconf.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f405/mcuconf.h
@@ -1,7 +1,8 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
+ ChibiOS - Copyright (C) 2024-2026 Maxjta.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -229,6 +230,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f405/portab.c b/testhal/AT32/multi/WDT/cfg/at-start-f405/portab.c
index bd71ff0084..fbfdf082be 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f405/portab.c
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f405/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f405/portab.h b/testhal/AT32/multi/WDT/cfg/at-start-f405/portab.h
index f81dad3fbe..14ac634945 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f405/portab.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f405/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@
#define PORTAB_WDT1 WDGD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f415/chconf.h b/testhal/AT32/multi/WDT/cfg/at-start-f415/chconf.h
index 56fe06776a..71a25b9a32 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f415/chconf.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f415/chconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,6 +51,19 @@
#define CH_CFG_SMP_MODE FALSE
#endif
+/**
+ * @brief Kernel hardening level.
+ * @details This option is the level of functional-safety checks enabled
+ * in the kerkel. The meaning is:
+ * - 0: No checks, maximum performance.
+ * - 1: Reasonable checks.
+ * - 2: All checks.
+ * .
+ */
+#if !defined(CH_CFG_HARDENING_LEVEL)
+#define CH_CFG_HARDENING_LEVEL 0
+#endif
+
/** @} */
/*===========================================================================*/
@@ -63,6 +76,8 @@
/**
* @brief System time counter resolution.
* @note Allowed values are 16, 32 or 64 bits.
+ * @note In tick-less mode this value must match the physical system tick
+ * timer counter width.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32
@@ -72,6 +87,8 @@
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
+ * @note This must be a frequency that is obtainable from the system tick
+ * timer frequency.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000
@@ -141,19 +158,6 @@
#define CH_CFG_NO_IDLE_THREAD FALSE
#endif
-/**
- * @brief Kernel hardening level.
- * @details This option is the level of functional-safety checks enabled
- * in the kerkel. The meaning is:
- * - 0: No checks, maximum performance.
- * - 1: Reasonable checks.
- * - 2: All checks.
- * .
- */
-#if !defined(CH_CFG_HARDENING_LEVEL)
-#define CH_CFG_HARDENING_LEVEL 0
-#endif
-
/** @} */
/*===========================================================================*/
@@ -621,7 +625,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -644,7 +648,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -656,7 +660,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
@@ -693,9 +697,9 @@
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
-#define CH_CFG_SYSTEM_INIT_HOOK() { \
+#define CH_CFG_SYSTEM_INIT_HOOK() do { \
/* Add system initialization code here.*/ \
-}
+} while (false)
/**
* @brief OS instance structure extension.
@@ -709,9 +713,9 @@
*
* @param[in] oip pointer to the @p os_instance_t structure
*/
-#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) do { \
/* Add OS instance initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads descriptor structure extension.
@@ -729,9 +733,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_INIT_HOOK(tp) { \
+#define CH_CFG_THREAD_INIT_HOOK(tp) do { \
/* Add threads initialization code here.*/ \
-}
+} while (false)
/**
* @brief Threads finalization hook.
@@ -739,9 +743,9 @@
*
* @param[in] tp pointer to the @p thread_t structure
*/
-#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
+#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
-}
+} while (false)
/**
* @brief Context switch hook.
@@ -750,23 +754,23 @@
* @param[in] ntp thread being switched in
* @param[in] otp thread being switched out
*/
-#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) do { \
/* Context switch code here.*/ \
-}
+} while (false)
/**
* @brief ISR enter hook.
*/
-#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+#define CH_CFG_IRQ_PROLOGUE_HOOK() do { \
/* IRQ prologue code here.*/ \
-}
+} while (false)
/**
* @brief ISR exit hook.
*/
-#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+#define CH_CFG_IRQ_EPILOGUE_HOOK() do { \
/* IRQ epilogue code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread enter hook.
@@ -774,9 +778,9 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define CH_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() do { \
/* Idle-enter code here.*/ \
-}
+} while (false)
/**
* @brief Idle thread leave hook.
@@ -784,52 +788,62 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define CH_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() do { \
/* Idle-leave code here.*/ \
-}
+} while (false)
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
-#define CH_CFG_IDLE_LOOP_HOOK() { \
+#define CH_CFG_IDLE_LOOP_HOOK() do { \
/* Idle loop code here.*/ \
-}
+} while (false)
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
-#define CH_CFG_SYSTEM_TICK_HOOK() { \
+#define CH_CFG_SYSTEM_TICK_HOOK() do { \
/* System tick event code here.*/ \
-}
+} while (false)
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
-#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) do { \
/* System halt code here.*/ \
-}
+} while (false)
/**
* @brief Trace hook.
* @details This hook is invoked each time a new record is written in the
* trace buffer.
*/
-#define CH_CFG_TRACE_HOOK(tep) { \
+#define CH_CFG_TRACE_HOOK(tep) do { \
/* Trace code here.*/ \
-}
+} while (false)
/**
* @brief Runtime Faults Collection Unit hook.
* @details This hook is invoked each time new faults are collected and stored.
*/
-#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) do { \
/* Faults handling code here.*/ \
-}
+} while (false)
+
+/**
+ * @brief Safety checks hook.
+ * @details This hook is invoked when there is a safety violation and the
+ * system is going to stop.
+ */
+#define CH_CFG_SAFETY_CHECK_HOOK(l, f) do { \
+ /* Safety handling code here.*/ \
+ chSysHalt(f); \
+} while (false)
/** @} */
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f415/config.h b/testhal/AT32/multi/WDT/cfg/at-start-f415/config.h
index 056a8f39ff..fe19c2eb77 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f415/config.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f415/config.h
@@ -1,6 +1,6 @@
/*
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f415/halconf.h b/testhal/AT32/multi/WDT/cfg/at-start-f415/halconf.h
index ba89c66d2c..40291e3e1f 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f415/halconf.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f415/halconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,6 +35,13 @@
#include "mcuconf.h"
+/**
+ * @brief Enables the HAL safety subsystem.
+ */
+#if !defined(HAL_USE_SAFETY) || defined(__DOXYGEN__)
+#define HAL_USE_SAFETY FALSE
+#endif
+
/**
* @brief Enables the PAL subsystem.
*/
@@ -70,6 +77,13 @@
#define HAL_USE_DAC FALSE
#endif
+/**
+ * @brief Enables the display subsystem.
+ */
+#if !defined(HAL_USE_DSPL) || defined(__DOXYGEN__)
+#define HAL_USE_DSPL FALSE
+#endif
+
/**
* @brief Enables the EFlash subsystem.
*/
@@ -307,6 +321,14 @@
/* I2C driver related settings. */
/*===========================================================================*/
+/**
+ * @brief Slave mode API enable switch.
+ * @note The low level driver must support this capability.
+ */
+#if !defined(I2C_ENABLE_SLAVE_MODE)
+#define I2C_ENABLE_SLAVE_MODE FALSE
+#endif
+
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
@@ -530,6 +552,15 @@
#define USB_USE_WAIT FALSE
#endif
+/**
+ * @brief Moves EP0 request handling to thread context.
+ * @note When enabled the legacy requests hook callback is not available
+ * and the application must provide a dedicated EP0 worker thread.
+ */
+#if !defined(USB_USE_EP0_THREAD) || defined(__DOXYGEN__)
+#define USB_USE_EP0_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f415/halconf_community.h b/testhal/AT32/multi/WDT/cfg/at-start-f415/halconf_community.h
index 5a77290c71..e21bd723b7 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f415/halconf_community.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f415/halconf_community.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f415/mcuconf.h b/testhal/AT32/multi/WDT/cfg/at-start-f415/mcuconf.h
index 98bb2511e2..2a5768a1d8 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f415/mcuconf.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f415/mcuconf.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@
*/
#define AT32_ST_IRQ_PRIORITY 8
#define AT32_ST_USE_TIMER 2
+#define AT32_ST_FREQUENCY_TOLERANCE 0
/*
* UART driver system settings.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f415/portab.c b/testhal/AT32/multi/WDT/cfg/at-start-f415/portab.c
index bd71ff0084..fbfdf082be 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f415/portab.c
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f415/portab.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/AT32/multi/WDT/cfg/at-start-f415/portab.h b/testhal/AT32/multi/WDT/cfg/at-start-f415/portab.h
index f81dad3fbe..14ac634945 100644
--- a/testhal/AT32/multi/WDT/cfg/at-start-f415/portab.h
+++ b/testhal/AT32/multi/WDT/cfg/at-start-f415/portab.h
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@
#define PORTAB_WDT1 WDGD1
#define PORTAB_BLINK_LED1 LINE_LED_RED
-
#define PORTAB_BLINK_LED2 LINE_LED_YELLOW
-
#define PORTAB_BLINK_LED3 LINE_LED_GREEN
/*===========================================================================*/
diff --git a/testhal/AT32/multi/WDT/main.c b/testhal/AT32/multi/WDT/main.c
index 125844742e..1676ab243e 100644
--- a/testhal/AT32/multi/WDT/main.c
+++ b/testhal/AT32/multi/WDT/main.c
@@ -1,7 +1,7 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- ChibiOS - Copyright (C) 2023..2025 HorrorTroll
- ChibiOS - Copyright (C) 2023..2025 Zhaqian
+ ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
+ ChibiOS - Copyright (C) 2023-2026 HorrorTroll.
+ ChibiOS - Copyright (C) 2023-2026 Zhaqian.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.