Running 32 bit application on iMX8

Hi,

I have a legacy 32-bit application written in C that will be hard to migrate to 64-bit and I want to have it running on a Colibri iMX8. I’m currently using the reference images and not the torizon one.

My understanding is that iMX8 CPU (Cortex-A35) support 32 and 64 bit instructions so my question is what are the options to run the application on Colibri iMX8 ?

Here are the option I have in mind today:

  • port my app to be 64-bit compatible
  • build a 32-bit BSP, but how ?
  • run the application in 32-bit is a 64-bit BSP. Is it possible ?

Kind regards

Hello @ykrons ,
In order to have a better understanding of your situation, could you please tell us the board and BSP version that you are using?
We would also like to know the interfaces that you are planning to use.

Best regards,
Josep

Hi,

Our application is currently running on a Colibri-iMX7d eMMC 1G with BSP3 and we want to go with a Colibri-iMX8DX with BSP5.
The application is only using network and an i2C bus.

Regards

Hi @ykrons ,

That’s correct, but there might be some libraries or functions that might not be working with this setup.

I found this link showing more or less the options you were mentioning. To be prepared for long term, I would suggest the best option would be to build your application in 64bit.

Other options might be to try something like multilib that would include all libraries in 64 and 32bit variants. This though is not guaranteed to be working in all circumstances.
Further, you could try to build a BSP for an older target like the iMX6 and then try to make it work from there. That will be quite hard I believe.

Probably the fastest and easiest way to at least try it would be this one here.

Here they build the application with the -static parameter. This seems to look quite easy, you might give this a try.

Hope this helps, and let us know if you were successful.

Best Regards
Kevin

Hi @kevin.tx

Thanks for your feedback. We are following the different options and I’m currently investigating the MULTILIB approach according to link.

I’m currently able to build a multilib image and run some 32bit binaries after a small change in timestamp-service.bb

diff --git a/recipes-core/systemd/timestamp-service.bb b/recipes-core/systemd/timestamp-service.bb
index 24d4a1d..758f5b0 100644
--- a/recipes-core/systemd/timestamp-service.bb
+++ b/recipes-core/systemd/timestamp-service.bb
@@ -13,8 +13,8 @@ do_install () {

        install -m 0755 ${WORKDIR}/load-timestamp.sh ${D}/${bindir}

-       install -d ${D}/${base_libdir}/systemd/system
-       install -m 0644 ${WORKDIR}/timestamp.service ${D}/${base_libdir}/systemd/system/
+       install -d ${D}/${systemd_system_unitdir}/
+       install -m 0644 ${WORKDIR}/timestamp.service ${D}/${systemd_system_unitdir}/
 }

 SYSTEMD_PACKAGES = "${PN}"

however I’m not able to build the SDK anymore. I get errors during nativesdk-glibc do_configure task.
Is there special settings to add to have a multilib sdk ?

Regards

Hi @ykrons, how are you?

Can you please share your full error log?

Best regards,

Hi @kevin.tx,

Find here the logs: https://share.toradex.com/fuxannxpblsj5d0

Regards

Hi @ykrons ,

It seems like something with the configuration is wrong.

Apparently, the process created another logfile on your machine.

Could you share the file located here as well?

/workdir/oe-core/build/tmp/work/x86_64-nativesdk-tdxsdk-linux/nativesdk-glibc/2.31+gitAUTOINC+3ef8be9b89-r0/build-x86_64-tdxsdk-linux/config.log

Best Regards
Kevin

Hi @kevin.tx,

Find the config.log here: config.log (44.8 KB)

It seems gcc is not understanding several command line options and ld is not found.

Kind regards

Hi @ykrons

I tested the build of the multilib SDK as follows:

mkdir multilib && cd multilib
repo init -u git://git.toradex.com/toradex-manifest.git -b dunfell-5.x.y -m tdxref/default.xml
repo sync
. export

Then change the machine in local.conf to colibri-imx8x:

MACHINE ?= "colibri-imx8x"

Then I added the following lines to local.conf:

# multilib arm
require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "armv7athf-neon-vfpv4"

IMAGE_INSTALL_append = " lib32-htop"
ACCEPT_FSL_EULA = "1"

With that I was able to successfully build the multilib sdk for the core-image-minimal:

bitbake core-image-minimal && bitbake core-image-minimal -c populate_sdk

The distro where I build the image and sdk on is Debian Buster.

Can you try to verify if this builds on your PC as well? Make sure you start with a clean build to not have any strange interferences!

Regards,
Stefan

Hi @stefan_e.tx ,

Yesterday I have done a cleanall on nativesdk-glibc and now the SDK build is working properly in multilib or 64 bit mode.
I guess something has gone wrong during development and remains until the clean.
Thanks for your support

Kind regards

Perfect, thanks for the feedback

Hi @kevin.tx ,

Other options might be to try something like multilib that would include all libraries in 64 and 32bit variants. This though is not guaranteed to be working in all circumstances.

You have told me that multilib option may not work in some circumstances. Could you clarify what are those circumstances as I’m currently facing an issue integrating lib32-libusb1 (Not able to build SDK including lib32-libusb1 with MULTILIB support on iMX8)

Kind regards

Hi @ykrons ,

Sorry for the delay.

@stefan_e.tx is currently in vacation. He’ll answer this one, as soon as he’s back.

I’ve seen the other ticket about not being able to build the SDK

We’re having a look and coma back to you ASAP.

Best Regards
Kevin

Hi @ykrons,

We checked internally for this.

There is no clear situation where these errors would arrive and one could be the one that you faced once you added a new package. We also saw that you forwarded a patch to the meta-freescale github. Please tell us if the patch is approved.

Best regards,
Best regards,

Hi @gclaudino.tx ,

For sure, if approved, I plan to backport it to Dunfell branch and share it here.

Kind regards

1 Like

Hi @gclaudino.tx ,

To cross link it, the patch has been accepted in meta-freescale (Not able to build SDK including lib32-libusb1 with MULTILIB support on iMX8 - #5 by ykrons).

Kind regards

Hi @ykrons !

Thanks for the feedback :slight_smile:

Best regards,