Skip to content
Open
  •  
  •  
  •  
108 changes: 61 additions & 47 deletions demos/AT32/RT-AT-START-F402/cfg/chconf.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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

/** @} */

/*===========================================================================*/
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

/** @} */

/*===========================================================================*/
Expand Down Expand Up @@ -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

/**
Expand All @@ -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

/**
Expand All @@ -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

/**
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -729,19 +733,19 @@
*
* @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.
* @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) { \
#define CH_CFG_THREAD_EXIT_HOOK(tp) do { \
/* Add threads finalization code here.*/ \
}
} while (false)

/**
* @brief Context switch hook.
Expand All @@ -750,86 +754,96 @@
* @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.
* @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() { \
#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() { \
#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)

/** @} */

Expand Down
4 changes: 2 additions & 2 deletions demos/AT32/RT-AT-START-F402/cfg/config.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
37 changes: 34 additions & 3 deletions demos/AT32/RT-AT-START-F402/cfg/halconf.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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. */
/*===========================================================================*/
Expand Down
6 changes: 3 additions & 3 deletions demos/AT32/RT-AT-START-F402/cfg/halconf_community.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
7 changes: 4 additions & 3 deletions demos/AT32/RT-AT-START-F402/cfg/mcuconf.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions demos/AT32/RT-AT-START-F402/main.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Loading
Loading