Closed haydenridd closed 1 year ago
No problem I see structuring the build that way.
I do tend to keep both variants in my own projects. For example, on my development machine, the non-native
variant might pull in drivers that would talk to sensors/etc through USB debug adapters, while the native
variant would be a pure simulator setup.
(That type of setup is dependent on structuring your code and build in a way that supports it, though.)
Oh very interesting! So in your setup you would have:
Non cross compiled build:
native
is built with the native compiler, but simulates embedded system via USB sensors, etc.native
is pure simulationCross compiled build:
native
is actual MCU targetnative
is still pure simulation (?)Tests build native for all cases
Yep. That's what I aim for.
Nice! That makes sense then why you have both variants for both x-compiling and regular. Appreciate the explanation!
Question
Would it make more sense to only build executable
APP
when cross compiling? Currently the behavior ofmake
without any arguments will build bothAPP
andAPP_native
using thenative
compiler. This is becausemeson.get_compiler('lang', native: false)
will just fetch thenative
compiler since when not cross compilingnative
compiler =host
compiler.Generally speaking once you get into adding custom linker scripts, startup assembly source, etc. to an MCU
host
, this means thatmake
by default will lead to errors when it tries to compile/linkAPP
using the native compiler instead ofarm-none-eabi-...
or what have you.This could be pretty easily gated using:
This would lead to the behavior:
make
only builds native app + testsmake CROSS=...
builds native app + host app + testsTo me this makes more intuitive sense but curious to get yall's thoughts...