areusch commented on pull request #7392:
URL: https://github.com/apache/tvm/pull/7392#issuecomment-771968417


   @cbalint13 it is a little bit more complicated than just specifying the 
Compiler implementation when cross-compiling. when using DefaultCompiler, there 
is assumption that all of the code needed to run the _platform_ (I.e. SoC 
startup code, peripheral config) lives in a `main.cc` or in a library you 
supply to `build_static_runtime(extra_libs=)`. on POSIX systems, this 
assumption doesn't impose much on the build, but in a bare metal deployment 
situation it's much different.
   
   to increase compatibility with the many dev boards out there, we compile 
against a cross-platform deployment framework (Zephyr). most cross-platform 
bare-metal deployment frameworks include their own build system to determine 
which sources to include and the compiler config e.g. cflags, ldflags. Zephyr 
does this from CMakeLists.txt and prj.conf. making it convention to include 
this config in TVM Python scripts would mean that convention is to replicate 
the build system from the RTOS you're using.
   
   unfortunately we kind of built out this Compiler abstraction without paying 
too much attention to that, so it's kind of the wrong level of abstraction to 
use here. the long-term solution to this problem is to replace Compiler with 
something more "project-level," where "project" roughly refers to the startup 
code, RTOS, and other application specific code you need to run models on a 
bare metal device. See #6 on the [µTVM M2 
roadmap](https://discuss.tvm.apache.org/t/tvm-microtvm-m2-roadmap/8821).
   
   in the short term, I think it would be great to change DefaultCompiler to 
error when you try to compile a file with a cortex-m target. that would be 
adjusting the logic 
[here](https://github.com/apache/tvm/blob/main/python/tvm/micro/compiler.py#L101).
 want to take a shot at that?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to