Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings
micropython

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Documentation for MICROPY_* macros#18585

Discussion options

Josverl
Dec 17, 2025
CollaboratorSponsor

One of the things that I find hard to understand is how the various MICROPY_ macros can be used to adjust the capabilities included in the firmware for a particular board or build. More so as I have not been able to find documentation, other than the occasional comment in source.
There is a rather strict naming convention, that does give some context, but also assumes a familiarity with the code base.
In total there are nearly 1_800 unique MICROPY_macros defined and used in the code base and for only 282 of them there is a comment line preceding ( comment number may be off , based on a rather simplistic regex scan)

As there are a lot of macros that may benefit from some level of documentation.
what I normally do is to search for occurrences, scan for comments and try to read the code to glean the intent from that.
This is something where LLM models scale better than humans.

I have built a simple tool to

  • scan the codebase for the macro definitions, comment , and usage
  • store that in a sqlite database
  • for each unique macro
    • collect the surrounding lined for the occurrences
    • run them through a LLM (4o-mini) with the ask to generate a one-line description ( costs , approx 12 cents for this set)
    • save that description back into the db
  • generate some markdown tables from that ( grouped by the 2nd word in the macro name)

the result looks promising :https://gist.github.com/Josverl/9def801af4a80a79de9ae19876efb22f#file-micropy_macros-md
Andmay will need some manual cleanup

now my questions are :

  • is this useful enough for should something like this be part of the documentation
  • if so how / where ( .MD , .RST , single page , multi page etc)
  • what should be improved / changed / omitted
  • how to maintain such documentation as new PRs add relevant macros over time
You must be logged in to vote

Thank you for the feedback, and I already saw some referrals, so it seems useful.

I have made some minor adjustments, added a few more macro classes, and generated and added the following pages to the wiki :

  • MICROPY_** macros
  • MP_** macros
  • MBOOT_** macros
  • MIMXRT_** macros

All can be found via the (new)wiki index page

I have the module to generate them in a private repo, let me know if you would like access.

Replies: 3 comments 3 replies

Comment options

I think this is useful and should be part of the build/modify documentation. The main documentation could have a summary of what these macros can be used for and include a reference link to this index.

The grouping of macros helps a lot.

Thanks

You must be logged in to vote
2 replies
@Josverl
Comment options

JosverlDec 21, 2025
Collaborator AuthorSponsor

If I may ask; Would you search for/expect to find them in the docs, or in the wiki?

@ricksorensen
Comment options

I would put the general information in the doc, with the details in the Wiki.

Comment options

andrewleech
Dec 21, 2025
CollaboratorSponsor

A few months ago I actually parsed the codebase for these and built a kconfig frontend to view/configure the build using them. I got quite an effective description for most of them, though I went through a few rounds of broad code exploration to try to get a more complete picture of what the configs did.

There were a few aspects of the build system I didn't get working back then but that was a couple of llm generations ago so it would probably be much easier to get cleaned up now!

You must be logged in to vote
1 reply
@Josverl
Comment options

JosverlDec 21, 2025
Collaborator AuthorSponsor

My first aim is to document, as there is a lot of whitespace. I can see the use of the same info for a Kconfig, but I think that hinges on the clarity and accuracy of the descriptions.
Having a 1000 switches without clear meaning does not help much.

It would be interesting to compare the descriptions of your efforts, against these to help validate the good ones , and identify which are incorrect or need to be improved.

Comment options

Josverl
Feb 6, 2026
Collaborator AuthorSponsor

Thank you for the feedback, and I already saw some referrals, so it seems useful.

I have made some minor adjustments, added a few more macro classes, and generated and added the following pages to the wiki :

  • MICROPY_** macros
  • MP_** macros
  • MBOOT_** macros
  • MIMXRT_** macros

All can be found via the (new)wiki index page

I have the module to generate them in a private repo, let me know if you would like access.

You must be logged in to vote
0 replies
Answer selected byJosverl
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
3 participants
@Josverl@andrewleech@ricksorensen

[8]ページ先頭

©2009-2026 Movatter.jp