@@ -62,9 +62,7 @@ typedef struct {
6262// Only a single dfu state is allowed
6363static dfu_state_ctx_t _dfu_ctx ;
6464
65- CFG_TUD_MEM_SECTION static struct {
66- TUD_EPBUF_DEF (transfer_buf , CFG_TUD_DFU_XFER_BUFSIZE );
67- } _dfu_epbuf ;
65+ CFG_TUD_MEM_ALIGN uint8_t _transfer_buf [CFG_TUD_DFU_XFER_BUFSIZE ];
6866
6967static void reset_state (void ) {
7068 _dfu_ctx .state = DFU_IDLE ;
@@ -283,10 +281,10 @@ bool dfu_moded_control_xfer_cb(uint8_t rhport, uint8_t stage, const tusb_control
283281 TU_VERIFY (_dfu_ctx .attrs & DFU_ATTR_CAN_UPLOAD );
284282 TU_VERIFY (request -> wLength <= CFG_TUD_DFU_XFER_BUFSIZE );
285283
286- const uint16_t xfer_len = tud_dfu_upload_cb (_dfu_ctx .alt , request -> wValue , _dfu_epbuf . transfer_buf ,
284+ const uint16_t xfer_len = tud_dfu_upload_cb (_dfu_ctx .alt , request -> wValue , _transfer_buf ,
287285 request -> wLength );
288286
289- return tud_control_xfer (rhport , request , _dfu_epbuf . transfer_buf , xfer_len );
287+ return tud_control_xfer (rhport , request , _transfer_buf , xfer_len );
290288 }
291289 break ;
292290
@@ -306,7 +304,7 @@ bool dfu_moded_control_xfer_cb(uint8_t rhport, uint8_t stage, const tusb_control
306304 if (request -> wLength ) {
307305 // Download with payload -> transition to DOWNLOAD SYNC
308306 _dfu_ctx .state = DFU_DNLOAD_SYNC ;
309- return tud_control_xfer (rhport , request , _dfu_epbuf . transfer_buf , request -> wLength );
307+ return tud_control_xfer (rhport , request , _transfer_buf , request -> wLength );
310308 } else {
311309 // Download is complete -> transition to MANIFEST SYNC
312310 _dfu_ctx .state = DFU_MANIFEST_SYNC ;
@@ -378,7 +376,7 @@ static bool process_download_get_status(uint8_t rhport, uint8_t stage, const tus
378376 } else if (stage == CONTROL_STAGE_ACK ) {
379377 if (_dfu_ctx .flashing_in_progress ) {
380378 _dfu_ctx .state = DFU_DNBUSY ;
381- tud_dfu_download_cb (_dfu_ctx .alt , _dfu_ctx .block , _dfu_epbuf . transfer_buf , _dfu_ctx .length );
379+ tud_dfu_download_cb (_dfu_ctx .alt , _dfu_ctx .block , _transfer_buf , _dfu_ctx .length );
382380 } else {
383381 _dfu_ctx .state = DFU_DNLOAD_IDLE ;
384382 }
0 commit comments