Skip to content

examples/mtdpart:Register MTD devices using the mtd_register method #3130

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

Merged
merged 1 commit into from
Jul 30, 2025

Conversation

jingfei195887
Copy link
Contributor

@jingfei195887 jingfei195887 commented Jul 13, 2025

Summary

  1. Due to the automatic wrapping of MTD devices during the open() process, the legacy registration methods ftl_initialize() and bchdev_register() are no longer required for MTD device registration. The new method is now changed to register_mtddriver

  2. Some code for space release and deregistration has been added, and certain error handling methods have been updated.

Test

Run the examples/mtdpart in sim:nsh for test an test is passed

nsh> mtdpart
Flash Geometry:
  blocksize:      512
  erasesize:      4096
  neraseblocks:   32
  No. partitions: 4
  Partition size: 64 Blocks (32768 bytes)
Creating partitions
  Partition 1. Block offset=0, size=64
  Partition 2. Block offset=64, size=64
  Partition 3. Block offset=128, size=64
  Partition 4. Block offset=192, size=64
Initializing media:
Checking partitions:
  Partition 1. Byte offset=0, size=32768
  Partition 2. Byte offset=32768, size=32768
  Partition 3. Byte offset=65536, size=32768
  Partition 4. Byte offset=98304, size=32768
Verifying media:
PASS: Everything looks good

@xiaoxiang781216
Copy link
Contributor

please fix:

Error: /home/runner/work/nuttx-apps/nuttx-apps/apps/examples/mtdpart/mtdpart_main.c:551:1: error: Too many blank lines
/home/runner/work/nuttx-apps/nuttx-apps/apps/examples/mtdpart/mtdpart_main.c:457: verifed ==> verified

@jingfei195887
Copy link
Contributor Author

please fix:

Error: /home/runner/work/nuttx-apps/nuttx-apps/apps/examples/mtdpart/mtdpart_main.c:551:1: error: Too many blank lines
/home/runner/work/nuttx-apps/nuttx-apps/apps/examples/mtdpart/mtdpart_main.c:457: verifed ==> verified

sure, working on this now

@jingfei195887
Copy link
Contributor Author

please fix:

Error: /home/runner/work/nuttx-apps/nuttx-apps/apps/examples/mtdpart/mtdpart_main.c:551:1: error: Too many blank lines
/home/runner/work/nuttx-apps/nuttx-apps/apps/examples/mtdpart/mtdpart_main.c:457: verifed ==> verified

done

@xiaoxiang781216
Copy link
Contributor

still have ci error, please run checkpatch.sh before you update patch. @jingfei195887

@jingfei195887 jingfei195887 force-pushed the mtd_optimize branch 2 times, most recently from babf87b to 27ba699 Compare July 17, 2025 04:00
@xiaoxiang781216
Copy link
Contributor

@jingfei195887 please drop merge patch.

@jingfei195887
Copy link
Contributor Author

@jingfei195887 please drop merge patch.

yes this is done

1. Due to the automatic wrapping of MTD devices during the open() process,
   the legacy registration methods ftl_initialize() and bchdev_register()
   are no longer required for MTD device registration. The new method is
   now changed to register_mtddriver

2. Some code for space release and deregistration has been added,
   and certain error handling methods have been updated.
@Donny9 Donny9 merged commit 4ecdb92 into apache:master Jul 30, 2025
39 checks passed
@cederom
Copy link
Contributor

cederom commented Jul 30, 2025

Thank you @jingfei195887 :-) Great work! :-) Please remember to git commit -s sign the commits :-)

@jingfei195887
Copy link
Contributor Author

jingfei195887 commented Jul 31, 2025

Thank you @jingfei195887 :-) Great work! :-) Please remember to git commit -s sign the commits :-)

Thanks for the remind.

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

Successfully merging this pull request may close these issues.

4 participants