Detecting different toradex modules in driver and/or userspace applications?

Hello all.

Let’s say I wanted to develop my stuff (linux not win) so it could support different toradex modules on different carrier boards. But, I do have some conditional code in both drivers and userspace that should be compiled ONLY on specific combinations. Normal process might be some nice ifdeffery using macros. I know the yocto build process has the machine type inside the local.conf file, but I don’t really see if that is exported in some way via CPPFLAGS automatically. I do see some uboot env entries, but I’d really rather know during the compilation stage. I’m guessing I could install some additional stuff in the yocto build using that MACHINE knowledge in local.conf, but was just curious if anything existed already? Seems like that would be a nice thing to know about and might be automatically exported?

Thanks!

Hello @DaveM,

Sorry for the delay to answer.

One way to achieve what you want is using the MACHINE as an override. For more information please check this mailing list.

For your case, one good approach is creating specific tasks for each MACHINE, see the below example:

do_compile_colibri-imx6ull () {
    ${CC} ${WORKDIR}/helloworld.c -o ${WORKDIR}/helloworld
}

Best regards,
Daniel Morais

Thanks for the reply Daniel. I was hoping something was built in to yocto to export MACHINE in some way automagically, but that’s not really something it does (or should for that matter). I can make it happen externally.