Skip to content

bsp/stm32f4: enable flash cache#3654

Closed
HiFiPhile wants to merge 1 commit into
masterfrom
f4_cache
Closed

bsp/stm32f4: enable flash cache#3654
HiFiPhile wants to merge 1 commit into
masterfrom
f4_cache

Conversation

@HiFiPhile

Copy link
Copy Markdown
Collaborator

Which increase cdc_msc_throughput speed from 500kB/s to 900kB/s.

Was wondering why dcd_event_xfer_complete takes 4us.

Signed-off-by: HiFiPhile <admin@hifiphile.com>
Copilot AI review requested due to automatic review settings May 27, 2026 18:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables STM32F4 flash instruction cache, data cache, and prefetch buffer in board_init() to improve throughput (cdc_msc_throughput from 500kB/s to 900kB/s).

Changes:

  • Enable flash instruction cache via __HAL_FLASH_INSTRUCTION_CACHE_ENABLE()
  • Enable flash data cache via __HAL_FLASH_DATA_CACHE_ENABLE()
  • Enable flash prefetch buffer via __HAL_FLASH_PREFETCH_BUFFER_ENABLE()

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

@github-actions

Copy link
Copy Markdown

TinyUSB Average Code Size Metrics

File .text .rodata .data .bss size %
ehci.c 2763 0 0 6274 7783 4.4%
midi2_host.c 1802 0 0 5921 7723 4.4%
cdc_host.c 6381 487 15 985 7579 4.3%
ncm_device.c 1757 28 815 4354 6124 3.5%
usbh.c 4662 57 108 1022 5813 3.3%
hcd_dwc2.c 5014 25 1 513 5553 3.1%
midi_host.c 1341 7 7 3635 4979 2.8%
video_device.c 4443 5 1235 479 4914 2.8%
dcd_dwc2.c 4263 19 0 265 4546 2.6%
audio_device.c 2896 0 1259 1625 4515 2.5%
ohci.c 1925 0 0 2503 4428 2.5%
dcd_ch32_usbfs.c 1582 0 0 2444 4026 2.3%
usbd.c 3519 58 91 355 3936 2.2%
ecm_rndis_device.c 1059 0 1 2759 3818 2.2%
hcd_stm32_fsdev.c 3257 0 1 420 3678 2.1%
dcd_ft9xx.c 3284 0 0 172 3456 1.9%
msc_device.c 2517 108 2281 806 3323 1.9%
dcd_khci.c 1952 0 0 1290 3242 1.8%
dcd_nrf5x.c 2939 0 0 292 3231 1.8%
hcd_musb.c 3071 0 0 157 3228 1.8%
midi2_device.c 2634 52 1175 566 3222 1.8%
dcd_ci_fs.c 1924 0 0 1290 3214 1.8%
dcd_da146xx.c 3067 0 0 144 3211 1.8%
hcd_rusb2.c 2923 0 0 245 3168 1.8%
dcd_rusb2.c 2918 0 0 156 3074 1.7%
hcd_ch32_usbfs.c 2489 0 0 502 2991 1.7%
hcd_khci.c 2443 0 0 454 2897 1.6%
dcd_stm32_fsdev.c 2558 0 0 291 2849 1.6%
dcd_mm32f327x_otg.c 1477 0 0 1290 2767 1.6%
usbtmc_device.c 2196 24 68 316 2544 1.4%
hcd_samd.c 2220 0 0 324 2544 1.4%
dcd_ci_hs.c 1756 0 0 1344 2534 1.4%
dcd_eptri.c 2273 0 0 259 2532 1.4%
hid_host.c 1240 0 0 1251 2491 1.4%
dcd_musb.c 2225 0 0 171 2396 1.4%
dcd_ch32_usbhs.c 1892 0 0 481 2373 1.3%
hcd_rp2040.c 1996 17 4 321 2338 1.3%
mtp_device.c 1706 22 739 588 2302 1.3%
dcd_rp2040.c 840 0 764 653 2257 1.3%
msc_host.c 1638 0 0 394 2033 1.1%
dcd_msp430x5xx.c 1801 0 0 176 1977 1.1%
cdc_device.c 1239 16 1092 735 1972 1.1%
dcd_lpc17_40.c 1481 0 0 648 1805 1.0%
midi_device.c 1151 0 1007 624 1773 1.0%
dcd_nuc505.c 0 0 1533 157 1690 1.0%
dcd_lpc_ip3511.c 1463 0 0 264 1683 0.9%
hub.c 1384 8 8 30 1418 0.8%
printer_device.c 830 0 706 566 1394 0.8%
dcd_samg.c 1322 0 0 72 1394 0.8%
dcd_samd.c 1036 0 0 266 1302 0.7%
dcd_nuc121.c 1170 0 0 101 1270 0.7%
hid_device.c 1125 44 997 119 1244 0.7%
vendor_device.c 641 0 534 565 1204 0.7%
dcd_nuc120.c 1096 0 0 78 1174 0.7%
rp2040_usb.c 386 35 619 11 1051 0.6%
dfu_device.c 777 28 712 138 914 0.5%
tusb_fifo.c 852 0 486 0 846 0.5%
typec_stm32.c 820 8 2 12 842 0.5%
dwc2_common.c 603 22 0 0 615 0.3%
usbc.c 420 2 20 166 608 0.3%
hcd_pio_usb.c 262 0 240 0 502 0.3%
tusb.c 455 0 387 3 457 0.3%
hcd_ci_hs.c 181 0 0 0 181 0.1%
fsdev_common.c 180 0 0 0 180 0.1%
rusb2_common.c 160 0 16 0 176 0.1%
dfu_rt_device.c 157 0 134 0 157 0.1%
TOTAL 123834 1072 17057 52042 177461 100.0%
Input files
  • cmake-build/cmake-build-adafruit_clue/metrics.json
  • cmake-build/cmake-build-apard32690/metrics.json
  • cmake-build/cmake-build-at32f403a_weact_blackpill/metrics.json
  • cmake-build/cmake-build-at_start_f402/metrics.json
  • cmake-build/cmake-build-at_start_f413/metrics.json
  • cmake-build/cmake-build-at_start_f415/metrics.json
  • cmake-build/cmake-build-at_start_f423/metrics.json
  • cmake-build/cmake-build-at_start_f425/metrics.json
  • cmake-build/cmake-build-at_start_f435/metrics.json
  • cmake-build/cmake-build-at_start_f455/metrics.json
  • cmake-build/cmake-build-b_g474e_dpow1/metrics.json
  • cmake-build/cmake-build-b_u585i_iot2a/metrics.json
  • cmake-build/cmake-build-ch32f205r-r0/metrics.json
  • cmake-build/cmake-build-ch32v103r_r1_1v0/metrics.json
  • cmake-build/cmake-build-ch32v203c_r0_1v0/metrics.json
  • cmake-build/cmake-build-ch32v307v_r1_1v0/metrics.json
  • cmake-build/cmake-build-cynthion_d11/metrics.json
  • cmake-build/cmake-build-da14695_dk_usb/metrics.json
  • cmake-build/cmake-build-double_m33_express/metrics.json
  • cmake-build/cmake-build-ea4088_quickstart/metrics.json
  • cmake-build/cmake-build-ea4357/metrics.json
  • cmake-build/cmake-build-ek_tm4c123gxl/metrics.json
  • cmake-build/cmake-build-feather_stm32f405/metrics.json
  • cmake-build/cmake-build-fomu/metrics.json
  • cmake-build/cmake-build-frdm_k32l2a4s/metrics.json
  • cmake-build/cmake-build-frdm_k64f/metrics.json
  • cmake-build/cmake-build-frdm_kl25z/metrics.json
  • cmake-build/cmake-build-frdm_mcxa153/metrics.json
  • cmake-build/cmake-build-frdm_rw612/metrics.json
  • cmake-build/cmake-build-hpm6750evk2/metrics.json
  • cmake-build/cmake-build-lpcxpresso11u37/metrics.json
  • cmake-build/cmake-build-lpcxpresso1347/metrics.json
  • cmake-build/cmake-build-lpcxpresso1549/metrics.json
  • cmake-build/cmake-build-lpcxpresso1769/metrics.json
  • cmake-build/cmake-build-lpcxpresso18s37/metrics.json
  • cmake-build/cmake-build-lpcxpresso51u68/metrics.json
  • cmake-build/cmake-build-lpcxpresso54114/metrics.json
  • cmake-build/cmake-build-metro_m0_express/metrics.json
  • cmake-build/cmake-build-metro_m4_express/metrics.json
  • cmake-build/cmake-build-metro_m7_1011/metrics.json
  • cmake-build/cmake-build-mm32f327x_mb39/metrics.json
  • cmake-build/cmake-build-mm900evxb/metrics.json
  • cmake-build/cmake-build-msp_exp430f5529lp/metrics.json
  • cmake-build/cmake-build-msp_exp432e401y/metrics.json
  • cmake-build/cmake-build-nutiny_nuc126v/metrics.json
  • cmake-build/cmake-build-nutiny_sdk_nuc120/metrics.json
  • cmake-build/cmake-build-nutiny_sdk_nuc121/metrics.json
  • cmake-build/cmake-build-nutiny_sdk_nuc505/metrics.json
  • cmake-build/cmake-build-portenta_c33/metrics.json
  • cmake-build/cmake-build-raspberry_pi_pico/metrics.json
  • cmake-build/cmake-build-raspberrypi_cm4/metrics.json
  • cmake-build/cmake-build-raspberrypi_zero/metrics.json
  • cmake-build/cmake-build-samg55_xplained/metrics.json
  • cmake-build/cmake-build-sipeed_longan_nano/metrics.json
  • cmake-build/cmake-build-stlinkv3mini/metrics.json
  • cmake-build/cmake-build-stm32c071nucleo/metrics.json
  • cmake-build/cmake-build-stm32f070rbnucleo/metrics.json
  • cmake-build/cmake-build-stm32f103_bluepill/metrics.json
  • cmake-build/cmake-build-stm32f207nucleo/metrics.json
  • cmake-build/cmake-build-stm32f303disco/metrics.json
  • cmake-build/cmake-build-stm32g0b1nucleo/metrics.json
  • cmake-build/cmake-build-stm32h503nucleo/metrics.json
  • cmake-build/cmake-build-stm32h743eval/metrics.json
  • cmake-build/cmake-build-stm32h7s3nucleo/metrics.json
  • cmake-build/cmake-build-stm32l052dap52/metrics.json
  • cmake-build/cmake-build-stm32l412nucleo/metrics.json
  • cmake-build/cmake-build-stm32n6570dk/metrics.json
  • cmake-build/cmake-build-stm32u083cdk/metrics.json
  • cmake-build/cmake-build-stm32wb55nucleo/metrics.json
  • cmake-build/cmake-build-stm32wba_nucleo/metrics.json
  • cmake-build/cmake-build-xmc4500_relax/metrics.json

@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

Top 10 targets by memory change (%) (out of 2346 targets) View Project Dashboard →

target .text .rodata .data .bss total % diff
feather_stm32f405/board_test 7,360 → 7,388 (+28) 8,092 → 8,120 (+28) +0.3%
feather_stm32f405/dfu_runtime 12,772 → 12,804 (+32) 13,840 → 13,872 (+32) +0.2%
feather_stm32f405/hid_generic_inout 13,836 → 13,868 (+32) 14,732 → 14,764 (+32) +0.2%
feather_stm32f405/hid_multiple_interface 14,528 → 14,560 (+32) 15,596 → 15,628 (+32) +0.2%
feather_stm32f405/hid_boot_interface 14,584 → 14,616 (+32) 15,608 → 15,640 (+32) +0.2%
feather_stm32f405/hid_composite 14,616 → 14,648 (+32) 15,772 → 15,804 (+32) +0.2%
feather_stm32f405/midi_test 14,860 → 14,892 (+32) 15,848 → 15,880 (+32) +0.2%
feather_stm32f405/cdc_dual_ports 15,484 → 15,516 (+32) 16,724 → 16,756 (+32) +0.2%
feather_stm32f405/printer_to_cdc 15,748 → 15,780 (+32) 16,788 → 16,820 (+32) +0.2%
feather_stm32f405/audio_test 15,912 → 15,944 (+32) 16,876 → 16,908 (+32) +0.2%

@HiFiPhile

Copy link
Copy Markdown
Collaborator Author

Included in #3634

@HiFiPhile HiFiPhile closed this May 29, 2026
@HiFiPhile HiFiPhile deleted the f4_cache branch May 29, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants