From 2a11c73bbe91ca780b52acb56040cb89a196bf14 Mon Sep 17 00:00:00 2001 From: dxl <64101226@qq.com> Date: Sat, 22 Aug 2026 03:04:27 +0800 Subject: [PATCH] To expand crm_ertc_clock_select() in at32_bpr_write_dt1() for reduce code size. --- common_arm/sys/sys_hw_at32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common_arm/sys/sys_hw_at32.c b/common_arm/sys/sys_hw_at32.c index d09bbfed7..316913395 100644 --- a/common_arm/sys/sys_hw_at32.c +++ b/common_arm/sys/sys_hw_at32.c @@ -68,7 +68,8 @@ static void at32_bpr_write_dt1(uint32_t data) { // Select and enable an ERTC clock so the write-protection register is // writable at the full APB frequency. - crm_ertc_clock_select(CRM_ERTC_CLOCK_HEXT_DIV_20); + CRM->cfg_bit.ertcdiv = ((CRM_ERTC_CLOCK_HEXT_DIV_20 & 0x1F0) >> 4); + CRM->bpdc_bit.ertcsel = (CRM_ERTC_CLOCK_HEXT_DIV_20 & 0xF); CRM->bpdc_bit.ertcen = TRUE; ERTC->wp = SYS_SIMPLE_RESET_BPR_UNLOCK_KEY1;