Every time I create a new mbed-os project, (mbed new ...
) I end up with a 1GB folder. This seems a tad bit excessive. How can I reuse the mbed-os folder so that every call to mbed new
just uses the same repo?
1 Answer
\$\begingroup\$
\$\endgroup\$
2
Turns out you can use mbed new --create-only
, and then symbolically link mbed-os
to the project folder.
-
\$\begingroup\$ That's of course an easy solution, +1! \$\endgroup\$ Mar 20, 2021 at 18:53
-
1\$\begingroup\$ @marcus not only that, if you don't want to compile mbed OS itself(it takes a good while for me) every time you make a new project, you can just create a new .h file and rename your main function to mymain() and then in the main.cpp file just include that .h file and call mymain(), kind of like Arduino. At the moment, if you change debug/release mode, it will still recompile and delete the previous build instead of using different folders so I advise creating two such projects. \$\endgroup\$ Jun 18, 2021 at 12:59
mbed new
does, but it sounds like it's intentionally putting a whole SDK and a lot of runtime stuff in a directory, as storage is cheap and time lost to incompatibilities through changes done for one project or through update is not. You can find all read-only components of your folder, run sha1sum on them, compare that to the sums from another mbed directory, and replace copies with so-called hardlinks, if what you're doing is on a POSIX-compatible file system. Honestly, in an age of 512 GB SSDs below 50€, each GB you save is worth < 10 ct. What's the price of your time? \$\endgroup\$