areusch commented on a change in pull request #7537:
URL: https://github.com/apache/tvm/pull/7537#discussion_r596521808
##########
File path: python/tvm/target/target.py
##########
@@ -324,6 +324,31 @@ def arm_cpu(model="unknown", options=None):
return Target(" ".join(["llvm"] + opts))
+def stm32mp1(options=None):
+ """Return stm32mp1 target and the associated cross compiler based on the
SDK.
+
+ Parameters
+ ----------
+ options : str or list of str
+ Additional options
+ """
+
+ from tvm.contrib import cc
+
+ if "TVM_STM32MP_SDK_PATH" not in os.environ or
os.getenv("TVM_STM32MP_SDK_PATH") == "":
+ raise RuntimeError("Require environment variable TVM_STM32MP_SDK_PATH
providing the SDK path directory\n"
+ "example: export TVM_STM32MP_SDK_PATH=<your
path>/STM32MP15-Ecosystem-v2.1.0/Developer-Package/SDK")
+
+ sdk_path = os.environ["TVM_STM32MP_SDK_PATH"]
+ cc = cc.cross_compiler(sdk_path +
'/sysroots/x86_64-ostl_sdk-linux/usr/bin/arm-ostl-linux-gnueabi/arm-ostl-linux-gnueabi-g++',
+ options=['-mthumb',
+ '-mfpu=neon-vfpv4',
+ '-mfloat-abi=hard',
+ '-mcpu=cortex-a7',
+ '--sysroot=' + sdk_path +
'/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi'])
+
+ return arm_cpu("stm32mp1", options), cc
Review comment:
hi @vinceab sorry for the delay here. my main concern with this PR is
how we can test it and document which version of the SDK it works with so we
can ensure it continues to work after it is merged. I think the best we could
do in the TVM CI is assert that the compilation flow works--we don't have any
non-cloud hardware in the loop for the TVM CI, so we couldn't assert against
real hardware. even with this level of testing though, i'm not sure the
approach would scale to arbitrary cross-compiler.
i'm wondering if it might make sense to invert the dependency here--would it
be better to put this kind of convenience function in a separate git repo,
since it depends only on public TVM APIs? It would also be easier to organize
related things such as examples.
I do think if we take this approach, it would be helpful for us to consider
how we could deal with the discoverability problem (I.e. could we index or link
to such repos from a TVM site). it would be helpful to discuss this in the
discuss.tvm.ai forum as well.
----------------------------------------------------------------
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]