-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ports: mcx: Initial port for MCXN947 series MCU. #13429
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
base: master
Are you sure you want to change the base?
Conversation
It seems updating the submodule itself is causing problems on mimxrt ports. I guess either we need to fix the port using new SDK or find another way of adding the new drivers. |
Code size report:
|
There is an open PR #11516 to add the mcux library as submodule instead of the library of Hatach. I tried this PR and the mimxrt port builds well with it. Only that the mcux lib is huge, and it may have been updated since then. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #13429 +/- ##
=======================================
Coverage 98.39% 98.39%
=======================================
Files 161 161
Lines 21156 21156
=======================================
Hits 20816 20816
Misses 340 340 ☔ View full report in Codecov by Sentry. |
When I include your submodule I get the error message at the build as well. So there is a missing conditional compile in machine_rtc.c, which is required with the new lib. That came with lib v2.11, but MicroPython uses 2.10 atm. |
Thanks @nxp-yilin for the contribution! For my own education, is there any possibility that this could be combined with the Taking on a new port is a big undertaking for the MicroPython project. The PR specifically mentions the That said, this does look like a very well done port, thank you for making it so consistent with the other ports. |
At first glance the answer is no. The source structure is completely different. For instance it adds a drv_xxx.c layer between the machine_xxx.c files and the mcux library. Some modules like PWM, I2S, networking are still t.b.d. Besides that, adding that as a separate port will require updating lib/nxp-driver to v2.11 at least. I prepared it, but it not done yet since no one missed it. And there is PR #11516 to used the official NXP library instead of the clone hosted by Hatach in the tinyusb environment. |
The MCX series uses LPC-style pin naming as well as different PORT/Pin structures than i.MXRT's IOMUXC, this requires different make-pins scripts and object structs, so the thought was ditched some while ago.
That repository contains way more parts than MicroPython project currently supports, however it seems there's approach of selectively initializing certain submodules being used by adding a |
ports/mcx/pendsv.c
Outdated
#if defined(PENDSV_DEBUG) | ||
"str r0, [sp, #8]\n" // store to r0 on stack | ||
#else | ||
"str r0, [sp, #0]\n" // store to r0 on stack | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stacked registers layout doesn't change whether debugging is enabled or not. I've been trying for a while to draw attention to the same issue in the stm32 port with no luck, but it shouldn't propagate to new ports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, as this macro is not controlled by DEBUG flags anyway, so I just removed this.
Thanks @jimmo , here's some answers regarding the previous questions:
This is explained in this comment. It's possible but will add a lot of confusing macro to control which peripheral we are using.
Generally, this port is for the 'MCXNx4x' series with 4 sub variants:
However the MCXN947 will be the MCU for official boards (FRDM_MCXN947, MCXN947EVK), and there's currently no official boards for the N5 series. So technically this port also works for other variants mentioned above but for now only MCXN947 boards are available to use with this port. As for other MCX series, such as A series, there's some basic support in this port for future device features, so they will also supported by this port. |
9cd27d9
to
223f095
Compare
This is an automated heads-up that we've just merged a Pull Request See #13763 A search suggests this PR might apply the STATIC macro to some C code. If it Although this is an automated message, feel free to @-reply to me directly if |
Signed-off-by: Yilin Sun <yilin.sun@nxp.com>
654559a
to
d30da89
Compare
The SDK updates includes a breaking change on devices without valid external tamper support. This is done by adding a macro checking whether the `FSL_FEATURE_SNVS_HAS_MULTIPLE_TAMPER` macro is defined and contains non-zero values in SDK driver. Currently this is only enabled on RT1176, so here we are adding the same check to prevent calling the non-exist function on other devices. Signed-off-by: Yilin Sun <yilin.sun@nxp.com>
Brief changelog since the last rebase:
There's a separate commit (3171c92) to address the build issues on mimxrt port due to the |
As this PR has been hanging around for a some time, I'd like to know whether there's anything we can do to proceed with the next steps, or whether there's any concern which needs to be solved first. For previous discussions on the SDK submodule dependency, we have the following options available:
Please kindly advise the best approach so the code can be updated accordingly. |
About the SDK: Relying on Hatach's version may not be the best option. There is a PR #11516 dangling since a while for switching to the MCUX library as submodule. I tested that with the mimxrt port and it looked doable. Only the size of the SDK is an obstacle. And naturally the MicroPython project would NOT follow each and every update of the SDK. That's too much ongoing test effort. |
Thanks Robert, I personally also prefer using the mcux-sdk repo. I'll try bumping the version of that submodule to somewhere contains the latest MCX parts on that PR and see whether we can make this work. |
I tested this and it seems to work fine, good job! However, I wasn't sure how to deploy the firmware, I eventually just used jlink, so you may want to add deploy instructions to |
This PR adds initial support for NXP MCXN947 MCU series, with the following boards:
FRDM_MCXN947
This port currently using nxp_driver submodule with a on-going PR, since there could be potential testability and repository size issues if we just introduce the whole mcux-sdk repository (#11516), although it could be the preferable way of keeping the SDK updated.