Skip to content

support for the AT32F45X series#3442

Merged
hathach merged 6 commits into
hathach:masterfrom
zhiqiang-ch:master
Jan 9, 2026
Merged

support for the AT32F45X series#3442
hathach merged 6 commits into
hathach:masterfrom
zhiqiang-ch:master

Conversation

@zhiqiang-ch
Copy link
Copy Markdown
Contributor

Support for the AT32F45X series.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 8, 2026

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

file .text .rodata .bss size % diff
dcd_dwc2.c 4160 ➙ 4101 (-59) 25 ➙ 24 (-1) 263 4447 ➙ 4387 (-60) -1.3%
dwc2_common.c 594 ➙ 582 (-12) 29 0 610 ➙ 597 (-13) -2.1%
TOTAL 4754 ➙ 4683 (-71) 54 ➙ 53 (-1) 263 5057 ➙ 4984 (-73) -1.4%

Changes <1% in size

file .text .rodata .data .bss size % diff
audio_device.c 2855 ➙ 2850 (-5) 0 1248 1679 ➙ 1677 (-2) 4529 ➙ 4522 (-7) -0.2%
cdc_device.c 1331 ➙ 1328 (-3) 16 20 ➙ 19 (-1) 670 ➙ 664 (-6) 2000 ➙ 1991 (-9) -0.4%
dfu_device.c 744 28 712 184 ➙ 183 (-1) 929 ➙ 926 (-3) -0.3%
hid_device.c 1120 ➙ 1118 (-2) 44 997 115 1235 ➙ 1233 (-2) -0.2%
midi_device.c 1129 ➙ 1127 (-2) 0 991 596 ➙ 591 (-5) 1723 ➙ 1716 (-7) -0.4%
msc_device.c 2506 ➙ 2503 (-3) 108 2274 538 3044 ➙ 3041 (-3) -0.1%
mtp_device.c 1622 ➙ 1619 (-3) 22 1385 578 ➙ 579 (+1) 2208 ➙ 2205 (-3) -0.1%
ncm_device.c 1517 ➙ 1514 (-3) 28 1408 5824 ➙ 5830 (+6) 7354 ➙ 7358 (+4) +0.1%
tusb.c 418 ➙ 417 (-1) 0 359 3 420 ➙ 419 (-1) -0.2%
tusb_fifo.c 844 ➙ 846 (+2) 0 477 0 839 ➙ 840 (+1) +0.1%
usbd.c 3179 ➙ 3177 (-2) 57 90 ➙ 89 (-1) 276 3519 ➙ 3517 (-2) -0.1%
usbd_control.c 524 ➙ 523 (-1) 0 474 78 601 ➙ 600 (-1) -0.2%
usbtmc_device.c 2178 ➙ 2176 (-2) 24 70 ➙ 69 (-1) 294 ➙ 291 (-3) 2504 ➙ 2500 (-4) -0.2%
vendor_device.c 636 ➙ 634 (-2) 0 538 470 ➙ 466 (-4) 1105 ➙ 1099 (-6) -0.5%
video_device.c 4402 ➙ 4391 (-11) 6 ➙ 5 (-1) 1851 471 ➙ 472 (+1) 4865 ➙ 4855 (-10) -0.2%
TOTAL 25005 ➙ 24967 (-38) 333 ➙ 332 (-1) 12894 ➙ 12891 (-3) 11776 ➙ 11763 (-13) 36875 ➙ 36822 (-53) -0.1%
No changes
file .text .rodata .data .bss size % diff
cdc_host.c 6596 487 15 1539 8357 +0.0%
dcd_ch32_usbfs.c 1472 0 0 2444 3916 +0.0%
dcd_ch32_usbhs.c 1648 0 0 448 2096 +0.0%
dcd_ci_fs.c 1925 0 0 1290 3215 +0.0%
dcd_ci_hs.c 1762 0 0 1280 2530 +0.0%
dcd_da146xx.c 3067 0 0 144 3211 +0.0%
dcd_eptri.c 2270 0 0 259 2529 +0.0%
dcd_khci.c 1953 0 0 1290 3243 +0.0%
dcd_lpc17_40.c 1470 0 0 648 1794 +0.0%
dcd_lpc_ip3511.c 1463 0 0 264 1639 +0.0%
dcd_mm32f327x_otg.c 1478 0 0 1290 2768 +0.0%
dcd_msp430x5xx.c 1796 0 0 176 1972 +0.0%
dcd_musb.c 2079 0 0 160 2239 +0.0%
dcd_nrf5x.c 2919 0 0 292 3211 +0.0%
dcd_nuc120.c 1093 0 0 78 1171 +0.0%
dcd_nuc121.c 1167 0 0 101 1268 +0.0%
dcd_nuc505.c 0 0 1529 157 1686 +0.0%
dcd_rp2040.c 736 20 580 1029 2365 +0.0%
dcd_rusb2.c 2917 0 0 156 3073 +0.0%
dcd_samd.c 1032 0 0 266 1298 +0.0%
dcd_samg.c 1319 0 0 72 1391 +0.0%
dcd_stm32_fsdev.c 2556 0 0 291 2847 +0.0%
dfu_rt_device.c 157 ➙ 156 (-1) 0 134 0 156 +0.0%
ecm_rndis_device.c 1037 0 1 2272 3310 +0.0%
ehci.c 2761 0 0 5970 7537 +0.0%
fsdev_common.c 180 0 0 0 180 +0.0%
hcd_ch32_usbfs.c 2484 0 0 498 2982 +0.0%
hcd_ci_hs.c 190 0 0 0 190 +0.0%
hcd_dwc2.c 4893 30 0 512 5434 +0.0%
hcd_khci.c 2442 0 0 449 2891 +0.0%
hcd_musb.c 3073 0 0 157 3230 +0.0%
hcd_pio_usb.c 262 0 240 0 502 +0.0%
hcd_rp2040.c 936 73 420 512 1941 +0.0%
hcd_rusb2.c 2923 0 0 245 3168 +0.0%
hcd_samd.c 2220 0 0 324 2544 +0.0%
hcd_stm32_fsdev.c 3282 0 1 420 3703 +0.0%
hid_host.c 1206 0 0 1250 2456 +0.0%
hub.c 1235 8 8 29 1268 +0.0%
midi_host.c 1353 7 7 3740 5097 +0.0%
msc_host.c 1589 0 0 394 1984 +0.0%
ohci.c 1942 0 0 2414 4356 +0.0%
rp2040_usb.c 124 70 574 4 772 +0.0%
rusb2_common.c 160 0 16 0 176 +0.0%
typec_stm32.c 820 8 2 12 842 +0.0%
usbc.c 420 2 20 166 608 +0.0%
usbh.c 4374 60 63 954 5415 +0.0%
TOTAL 82781 ➙ 82780 (-1) 765 3610 33996 118561 +0.0%

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the AT32F45X series of microcontrollers from ArteryTek. The implementation follows the existing pattern used for other AT32 family members and includes support for three board variants: AT-START-F455, AT-START-F456, and AT-START-F457.

Key changes:

  • Added MCU option definition (OPT_MCU_AT32F45X = 2507) and USB controller configuration using DWC2 driver
  • Included complete BSP implementation with clock configuration, interrupt handlers, and board initialization
  • Added build system support for both Make and CMake

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
tools/get_deps.py Adds dependency entry for AT32F45x firmware library
src/tusb_option.h Defines new MCU option constant for AT32F45X
src/common/tusb_mcu.h Configures DWC2 USB IP and endpoint count for AT32F45X
src/portable/synopsys/dwc2/dwc2_at32.h Adds AT32F45X hardware definitions (FIFO size, IRQ, register base)
hw/bsp/at32f45x/family.mk Make build configuration for the family
hw/bsp/at32f45x/family.cmake CMake build configuration for the family
hw/bsp/at32f45x/family.c Main BSP implementation with board initialization and USB setup
hw/bsp/at32f45x/at32f45x_int.c/h Interrupt service routine handlers
hw/bsp/at32f45x/at32f45x_conf.h Peripheral module configuration header
hw/bsp/at32f45x/at32f45x_clock.c/h System clock configuration (192MHz from 8MHz HEXT)
hw/bsp/at32f45x/boards//board. Board-specific configurations for F455, F456, and F457 variants
hw/bsp/at32f45x/FreeRTOSConfig/FreeRTOSConfig.h FreeRTOS configuration for AT32F45X
docs/reference/dependencies.rst Documents the new firmware library dependency
docs/reference/boards.rst Adds three new board entries to documentation
README.rst Updates CPU support table to include F45x

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hw/bsp/at32f45x/at32f45x_int.c Outdated
Comment thread hw/bsp/at32f45x/at32f45x_clock.c Outdated

/* enable pwc periph clock */
crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);

Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line creates inconsistent spacing - there should be no blank line between line 57 and line 59.

Suggested change

Copilot uses AI. Check for mistakes.
Comment thread hw/bsp/at32f45x/family.c Outdated
Comment thread hw/bsp/at32f45x/FreeRTOSConfig/FreeRTOSConfig.h Outdated
Comment thread hw/bsp/at32f45x/family.c Outdated
Comment thread hw/bsp/at32f45x/at32f45x_clock.c Outdated
Comment thread README.rst
//Vbus
static inline void board_vbus_sense_init(void)
{
*(int*)(0x50000038) |= (1<<21);
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This magic number should be explained with a comment or defined as a named constant. It appears to be manipulating a bit in a USB OTG register to control VBUS sensing, but the purpose is unclear.

Copilot uses AI. Check for mistakes.
Comment thread hw/bsp/at32f45x/boards/at_start_f455/board.h
Comment thread hw/bsp/at32f45x/at32f45x_int.c Outdated
Copy link
Copy Markdown
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, I have to fixed pre-commit and compile issue since it lack define for SystemCoreClock. But all other change is good

@hathach hathach merged commit d5f0260 into hathach:master Jan 9, 2026
116 checks passed
@zhiqiang-ch
Copy link
Copy Markdown
Contributor Author

thank you, I have to fixed pre-commit and compile issue since it lack define for SystemCoreClock. But all other change is good

Thank you very much. The definition of SystemCoreClock was missing in the official support package. I consulted them and they will add the definition later. Therefore, I did not specifically modify it. Of course, it works fine as it is now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants