Compiling firmware, do you have to do, this every time?

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Compiling firmware, do you have to do, this every time?

Post by Jibun no kage » Mon Aug 22, 2022 12:21 am

Compiling firmware, do you have to do, this every time? Meaning, if I compile the Unix port, an initial step is...

$ make -C mpy-cross

If I later want to compile firmware for Pico or maybe ESP8266, to I have to setup the mpy-cross environment each time? Based on the MP directory structure, it seems like a shared resource across any port firmware compile, but maybe I am misunderstanding something?

Of course for each port you have to deal with the requirements, dependencies, refresh the submodules content, then compile the specific firmware. But as i am comparing the various steps in the various sources, everything is documented as a separate silo, pico or esp, but if I am setting up several in the same environment, what is shared versus not, the specific external SDKs withstanding of course.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Compiling firmware, do you have to do, this every time?

Post by jimmo » Mon Aug 22, 2022 12:37 am

Jibun no kage wrote:
Mon Aug 22, 2022 12:21 am
Compiling firmware, do you have to do, this every time? Meaning, if I compile the Unix port, an initial step is...

$ make -C mpy-cross
No. This only needs to be done when the .mpy format changes (which is rare, and less than once per major release).
Jibun no kage wrote:
Mon Aug 22, 2022 12:21 am
If I later want to compile firmware for Pico or maybe ESP8266, to I have to setup the mpy-cross environment each time? Based on the MP directory structure, it seems like a shared resource across any port firmware compile, but maybe I am misunderstanding something?
Are you compiling ESP8266 with docker? In which case the mpy-cross you're building for ESP8266 (in docker) is for a different target than the one you'd be building (not in docker) for everything else. So yes, in this case, switching between esp8266-with-docker and anything-not-docker will require rebuilding.

Simple fix is just to have two different clones of the micropython repo (or a second worktree of your main clone) and have one dedicated to esp8266.

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: Compiling firmware, do you have to do, this every time?

Post by Jibun no kage » Mon Aug 22, 2022 5:24 pm

I am not using docker as yet... on purpose, so I learn the process in detail before I use the 'easier' method. :) I did, once you sent me the links to the ci.sh logic, that answered the question, clearly the ci.sh is doing the entire set of steps for each port as applicable. THe mpy-cross, submodules, make, etc., some ports vary a bit.

Post Reply