snikeguo opened a new pull request, #16463:
URL: https://github.com/apache/nuttx/pull/16463

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   1. Added support for STM32H723.
   2. ARM: Added SP register initialization during startup.
   3. Added FDCAN3 support.
   4. Fixed UART compilation issue (removed macro definition restrictions 
related to the "up_restoreusartint undefined" error).
   5. Adjusted interrupt initialization timing: interrupts should be configured 
as soon as the chip starts up to prevent abnormal initialization after the OS 
starts, which could otherwise result in the BootLoader’s interrupt handler 
being triggered.
   6. Updated CMake to add ELF file suffix and fixed a bug in CMake (to be 
investigated).
   7. Added DMA align manager component.
   8. Optimized mmcsd code logic.
   9. Removed FAT layer DMA configuration; DMA logic should reside in the 
device driver layer.
   
   ## Impact
   Regarding point ⑤, I believe that interrupt initialization is too late. We 
should configure interrupts as soon as the chip starts up to prevent abnormal 
initialization after the OS starts, which could cause exceptions to be handled 
by the BootLoader’s interrupt handlers (if a bootloader is present). The 
previous initialization sequence was:
   ```
   Power on;
   Initialize bss and data sections;
   Some hardware initialization, such as clock, FPU, CACHE, etc.;
   tasklist_initialize();
   idle_task_initialize();
   ...
   irq_initialize(); // Interrupts are only set up here.
   ```
   The problem with this approach is that, if an exception occurs before this 
point, it is handled by the BootLoader’s handler (if there is a bootloader).
   I believe the sequence should be:
   ```
   Power on();
   Disable interrupts();
   Initialize bss and data sections();
   Configure interrupts();
   ...
   ...
   Enable interrupts();
   Start scheduler();
   ```
   Regarding point ⑥, some debuggers only recognize files with the .elf suffix. 
Also, sometimes the check if(NOT EXISTS "${NUTTX_APPS_DIR}") incorrectly 
determines that the APPDIR folder does not exist.
   
   Regarding point ⑦, I believe DMA management should be handled by device 
drivers, not by the FAT layer. For more details, see: @apache/nuttx/issues/16415
   
   Regarding point ⑧, during MMC/TF card enumeration, DMA should not be used 
because the data volume is only a few bytes. Linux is also designed this way.
   
   Regarding point ⑨, the file system should not have to consider DMA issues.
   
   
   ## Testing
   
   
   MMC Write Logic:
   
   mmcsd_writemultiple() { .... mmcsd_transferready(); ... SDIO_DMASENDSETUP(); 
}
   
   In the current code 
(https://github.com/apache/nuttx/commit/b05ec7729d9b7fe85a6f11bfbb2da979255f44b7),
 I found that after writing multiple sectors, when sending ACMD51 and then 
querying R1, the error rate is very high. 
   test code:
   ```
    int r1_error_cnt=0;
   mmcsd_transferready()
   {
     ...
      ret = mmcsd_get_r1(priv, &r1);
          if (ret != OK)
            {
              ferr("ERROR: mmcsd_get_r1 failed: %d\n", ret);
              return ret;
            }
          /* Now check if the card is in the expected transfer state. */
    
          if (IS_STATE(r1, MMCSD_R1_STATE_TRAN))
            {
              /* Yes.. return Success */
    
              priv->wrbusy = false;
              return OK;
            }
            extern int wm_called;
            if(wm_called)
            {
              r1_error_cnt++;
            }
   }
   ```
   
   
   
   
![60d9ed481ccfbfc2c7b149be4be9e99](https://github.com/user-attachments/assets/37c7b0fc-afc2-4ebf-84cd-7c3df71639b7)
   
   With my code, the test results show no errors.
   
![image](https://github.com/user-attachments/assets/ca81de6c-f897-48be-8db2-5fe36047065e)
   
   
   STM32H7


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to