Conversation
Signed-off-by: HiFiPhile <admin@hifiphile.com>
Signed-off-by: HiFiPhile <admin@hifiphile.com>
Signed-off-by: HiFiPhile <admin@hifiphile.com>
Signed-off-by: HiFiPhile <admin@hifiphile.com>
Size Difference ReportBecause 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
Changes <1% in size
No changes
|
|
@claude review this |
|
Claude finished @hathach's task in 2m 35s —— View job PR Review: refresh dcd_samx7x
Overall this is a solid cleanup PR. The changes are well-structured. A few issues worth addressing: Issues Found1. Dead code / potential out-of-bounds in const uint8_t epnum = tu_edpt_number(ep_addr);
// ...
if (epnum == 0x80) { // ← NEVER true: tu_edpt_number() already strips dir bit
xfer = &xfer_status[EP_MAX]; // ← out-of-bounds if somehow reached (array is [0..EP_MAX-1])
}
2. Wrong register name in USB_REG->DEVEPTIER[epnum] = HSTPIPIER_RSTDTS; // ← uses Host pipe name in Device codeShould be 3. Cache invalidation may discard adjacent data if address is unaligned ( TU_ATTR_ALWAYS_INLINE static inline bool samx7x_dcache_invalidate(void const* addr, uint32_t data_size) {
const uintptr_t addr32 = (uintptr_t) addr;
if (is_cache_mem(addr32)) {
data_size = round_up_to_cache_line_size(data_size);
SCB_InvalidateDCache_by_Addr((void*) addr32, (int32_t) data_size); // addr may be unaligned
}
Minor Notes
Positive Aspects
|
There was a problem hiding this comment.
Pull request overview
Refreshes the SAMX7X device controller driver and SAME7X BSP configuration to restore board builds and make DMA usage optional (with corresponding cache maintenance helpers), while also removing the prior DMA+FIFO transfer path.
Changes:
- Add
CFG_TUD_SAMX7X_DMA_ENABLE(default off) and gate endpoint DMA support on it. - Introduce SAMX7X D-cache maintenance helpers/regions and default-enable D-cache when SAMX7X DMA is enabled.
- Update SAME7X CMake board configuration (startup/linker file selection and warning handling) and reformat/refactor the DCD.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/tusb_option.h |
Adds SAMX7X-specific DMA config option and FIFO/HWFIFO configuration defaults. |
src/portable/microchip/samx7x/samx7x_common.h |
Gates EP DMA support on new config and adds D-cache maintenance helpers + uncached region list. |
src/portable/microchip/samx7x/dcd_samx7x.c |
Refactors SAMX7X DCD, adds DMA cache maintenance hooks, removes DMA FIFO xfer path, reformats. |
src/common/tusb_mcu.h |
Sets SAMX7X D-cache defaults/line size tied to DMA enable. |
hw/bsp/same7x/family.cmake |
Adjusts warning suppression and startup-file handling for GNU/Clang, uses board-provided startup paths. |
hw/bsp/same7x/boards/same70_xplained/board.cmake |
Defines startup and linker scripts (GNU + IAR) for the Xplained board. |
hw/bsp/same7x/boards/same70_qmtech/board.cmake |
Fixes linker script selection for N19B and defines startup/linker scripts (GNU + IAR). |
Comments suppressed due to low confidence (1)
src/portable/microchip/samx7x/samx7x_common.h:2120
uncached_regionsis never modified, but it is declared non-const. That forces it into RAM (BSS/data) for every translation unit that includes this header. Make the arraystatic constso it can live in flash and reduce RAM usage.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: HiFiPhile <admin@hifiphile.com>
…to samx7x_update
…iles - and add unique ID - add freertos
hathach
left a comment
There was a problem hiding this comment.
perfect, thank you. I add support for uinique ID and also clean up BSP and add freertos build for same7x
CFG_TUD_SAMX7X_DMA_ENABLEand cache maintenance functions