Skip to content

zephyr: Use cmake ExternalProject to build libmicropython.a. #6392

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

Closed
wants to merge 2 commits into from

Conversation

MaureenHelm
Copy link
Contributor

Rework the zephyr port's build infrastructure to build libmicropython.a
with a cmake ExternalProject, instead of invoking cmake from a Makefile
(which was an awkward thing to do because cmake typically generates
Makefiles).

This change makes it possible to build the zephyr port like most other
zephyr applications using west or cmake directly. It simplifies building
with extra cmake arguments, such as specifying an alternate conf file or
adding an Arduino shield. It also enables building the zephyr port
anywhere in the host file system, which will allow regressing across
multiple boards with the zephyr sanitycheck script.

To build with west:

$ west build -b frdm_k64f ~/micropython/ports/zephyr

To build with cmake:

$ mkdir build && cd build
$ cmake -DBOARD=frdm_k64f ~/micropython/ports/zephyr
$ make

To build the minimal configuration:

$ west build -b frdm_k64f -- -DCONF_FILE=prj_minimal.conf

To build with a zephyr-supported Arduino shield:

$ west build -b frdm_k64f -- -DSHIELD=frdm_kw41z

Signed-off-by: Maureen Helm maureen.helm@nxp.com

@dpgeorge
Copy link
Member

dpgeorge commented Oct 7, 2020

Sorry, I completely missed this.

I didn't look at this PR in detail but in general it sounds like a good idea.

Would it make it even better to use the approach in #6473 where MicroPython provides cmake fragments (py/py.cmake, py/mkrules.cmake, extmod/extmod.cmake) and can build as a cmake target, rather than external project?

@MaureenHelm
Copy link
Contributor Author

Would it make it even better to use the approach in #6473 where MicroPython provides cmake fragments (py/py.cmake, py/mkrules.cmake, extmod/extmod.cmake) and can build as a cmake target, rather than external project?

Yes I think it could, that's what caught my attention in #6473. I'll try to prototype something on top of that PR, although I don't think that exercise needs to gate accepting this PR.

Removes zephyr port build files that aren't being used anymore.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Rework the zephyr port's build infrastructure to build libmicropython.a
with a cmake ExternalProject, instead of invoking cmake from a Makefile
(which was an awkward thing to do because cmake typically generates
Makefiles).

This change makes it possible to build the zephyr port like most other
zephyr applications using west or cmake directly. It simplifies building
with extra cmake arguments, such as specifying an alternate conf file or
adding an Arduino shield. It also enables building the zephyr port
anywhere in the host file system, which will allow regressing across
multiple boards with the zephyr sanitycheck script.

To build with west:

    $ west build -b frdm_k64f ~/micropython/ports/zephyr

To build with cmake:

    $ mkdir build && cd build
    $ cmake -DBOARD=frdm_k64f ~/micropython/ports/zephyr
    $ make

To build the minimal configuration:

    $ west build -b frdm_k64f -- -DCONF_FILE=prj_minimal.conf

To build with a zephyr-supported Arduino shield:

    $ west build -b frdm_k64f -- -DSHIELD=frdm_kw41z

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
@dpgeorge
Copy link
Member

I had a more detailed look at this. It is good and I would merge it but I think #6542 (pure cmake solution) is better.

@MaureenHelm
Copy link
Contributor Author

I agree the pure cmake solution in #6542 is better.

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.

2 participants