Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dwc2_dcache_clean() missing for STM32H7 build #2927

Open
1 task done
MWP opened this issue Jan 2, 2025 · 2 comments
Open
1 task done

dwc2_dcache_clean() missing for STM32H7 build #2927

MWP opened this issue Jan 2, 2025 · 2 comments
Labels

Comments

@MWP
Copy link

MWP commented Jan 2, 2025

Operating System

Others

Board

Custom

Firmware

Custom STM32H7A3 based device build.

What happened ?

When CFG_TUD_MEM_DCACHE_ENABLE is set, dwc2_dcache_clean() function is missing.

How to reproduce ?

Build a project using TinyUSB for STM32H7xx with CFG_TUD_MEM_DCACHE_ENABLE set.

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

N/A

Screenshots

No response

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.
@MWP MWP added the Bug 🐞 label Jan 2, 2025
@HiFiPhile
Copy link
Collaborator

Please post your build log.

@MWP
Copy link
Author

MWP commented Jan 2, 2025

I cannot :(

It's pretty clear though.
It seems the data cache handling functions were added for the esp32 target, but were not for the stm32.

A quick fix for the problem is adding the following to the end of dwc2_stm32.h

TU_ATTR_ALWAYS_INLINE static inline bool dwc2_dcache_clean(const void* addr, uint32_t data_size) {
  data_size = round_up_to_cache_line_size(data_size);
  SCB_CleanDCache_by_Addr((uint32_t*)addr, data_size);
  return true;
}

TU_ATTR_ALWAYS_INLINE static inline bool dwc2_dcache_invalidate(const void* addr, uint32_t data_size) {
  data_size = round_up_to_cache_line_size(data_size);
  SCB_InvalidateDCache_by_Addr((uint32_t*)addr, data_size);
  return true;
}

TU_ATTR_ALWAYS_INLINE static inline bool dwc2_dcache_clean_invalidate(const void* addr, uint32_t data_size) {
  SCB_CleanInvalidateDCache_by_Addr((uint32_t*)addr, data_size);
  return true;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants