micropython icon indicating copy to clipboard operation
micropython copied to clipboard

mimxrt: Add MSC support for the mimxrt port.

Open robert-hh opened this issue 3 years ago • 1 comments

Using the good implementation by @iabdalkader for RP2 and some of @alphafred's work for the bootloader. This is a build option. The PR consists of two major parts:

  • Adding basic MSC support in the commits up to 1d7eae802dd33443d74b9f221c7b7edd5e4f86ce.
  • Adding the work of PR #8814 for mimxrt from commit f750fe1dd44caf3409e78966666bca955baab147 on.

MSC support is not possible for device with hyperflash memory. FAT does not match with the 256k sector size of these devices. For all other devices, MSC is enabled by default.

Further work: A boot time config option to enable/disable MSC at boot time, making it possible again to use littlefs for the file system, which is more robust.

robert-hh avatar Jun 25 '22 19:06 robert-hh

Codecov Report

Merging #8820 (db726ec) into master (fb94ae4) will decrease coverage by 0.02%. The diff coverage is 69.23%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #8820      +/-   ##
==========================================
- Coverage   98.50%   98.48%   -0.02%     
==========================================
  Files         155      155              
  Lines       20540    20549       +9     
==========================================
+ Hits        20232    20237       +5     
- Misses        308      312       +4     
Impacted Files Coverage Δ
extmod/vfs_fat_diskio.c 88.23% <69.23%> (-7.01%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Jun 25 '22 19:06 codecov-commenter

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:   +64 +0.008% standard
      stm32:   +28 +0.007% PYBV10
        rp2:   +56 +0.017% PICO

github-actions[bot] avatar Dec 15 '22 07:12 github-actions[bot]

Assuming that with PR #9497 it will be possible to have MSC support using a Python coded driver, which can be the same for all ports using TinyUSB, I close this PR. I will keep the branch in my repository and maintain it.

robert-hh avatar May 04 '23 07:05 robert-hh

Thank you for this, I will cherry-pick it in my fork too until we see if the other PR is merged. @robert-hh I wanted to mention a storage related issue, with the port in general, so the VFS offset is fixed without checking if firmware overflows, if the firmware grows more than 0x100000, it gets overwritten and weird bugs happen, at least for the 1062... I've been debugging this issue for few days, the VFS should be in its own section.

vfs_start           = flash_start + 0x00100000;

iabdalkader avatar May 04 '23 18:05 iabdalkader

Yes I know hat there is no automatic check. When starting 1Mbyte for code seemed huge. And the actual Teensy 4.1 build is as 580k. So you must have added a lot.

robert-hh avatar May 04 '23 19:05 robert-hh

When starting 1Mbyte for code seemed huge

Not really if you add WiFi driver and firmware (which is ~400K alone) LWIP, nimble etc

iabdalkader avatar May 04 '23 19:05 iabdalkader