File Exchange

image thumbnail

Embedded Coder Interface to QEMU Emulator on Linux hosts

version 2.0.0.0 (13 KB) by Mikhail
Embedded Coder Interface to QEMU Emulator on Linux hosts

3 Downloads

Updated 27 May 2019

View License

Embedded Coder Interface to QEMU Emulator on Linux hosts.

Unfortunately, original Embedded Coder Interface to QEMU Emulator (https://www.mathworks.com/matlabcentral/fileexchange/57465-embedded-coder-interface-to-qemu-emulator) doesn't support Linux hosts officially.

Unoficially, it works just fine.

Embedded Coder targets for ARM Cortex-A and ARM Cortex-M can be used with QEMU, but with several modifications.

Basically, this package ships original files for QEMU target and some modified files for ARM Cortex-A and ARM Cortex-M targets.
Search for "QEMULNX" in files to see what has changed.

To make it work:
1) Install ARM Cortex-M and/or ARM Cortex-A target support packages (they support Linux hosts).
2) Add top directory of this submission to MATLAB path. It should be higher on path than ARM Cortex-M and ARM Cortex-A files, because it overrides one of the files from the targets.
3) Make sure qemu-system-arm resides in /usr/bin.

Cite As

Mikhail (2019). Embedded Coder Interface to QEMU Emulator on Linux hosts (https://www.mathworks.com/matlabcentral/fileexchange/64797-embedded-coder-interface-to-qemu-emulator-on-linux-hosts), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

Mikhail

You should install it using your Linux distribution's package manager.

amin ya

How should I install qemu-system-arm that you mentioned in step 3?

Mikhail

Since R2019a QEMU target is not available on Linux (again).

Mikhail

R2019a suffers from the same problem, see below.

Mikhail

Recent qemu has deprecated and then removed the "-redir" option. Therefore, to make it work with ARM Cortex-A, one has to make this change in R2018b:

In SupportPackages/R2018b/toolbox/target/supportpackages/arm_cortex_a/+codertarget/+arm_cortex_a/runQemu.m around line 83:

%redirString = sprintf(' -redir tcp:%d::22 -redir tcp:%d::%d -redir tcp:%d::%d ',sshport,extmodePort,extmodePort,sdiport,sdiport);
redirString = sprintf(' -nic user,hostfwd=tcp::%d-:22,hostfwd=tcp::%d-:%d,hostfwd=tcp::%d-:%d',sshport,extmodePort,extmodePort,sdiport,sdiport);

You can also change the line 72 accordingly:
tempFwd = sprintf(',hostfwd=tcp::%d-:%d ', currentPort,currentPort);

Mikhail

As of R2018b, Embedded Coder Interface to QEMU Emulator works out of the box for ARM Cortex-A.

For ARM Cortex-M, however, manual changes of SupportPackages/R2018b/toolbox/target/supportpackages/arm_cortex_m/+codertarget/+arm_cortex_m/runQemu.m are required. This submission can be served as a reference for these changes.

Mikhail

The ARM Cortex-A target is also available on Linux at least in R2018a. To make it work with QEMU, modify this file:

SupportPackages/R2018a/toolbox/target/supportpackages/arm_cortex_a/+codertarget/+arm_cortex_a/+internal/getBusyboxLinuxDir.m:

%installDir = matlab.internal.get3pInstallLocation('armcortexalinuxbinaries.instrset');
installDir = fullfile(matlab.internal.get3pInstallLocation('armcortexalinuxbinaries.instrset'),'armcortexa9_busybox');

Also, delete the p-coded version of getBusyboxLinuxDir.m from the same location.

Mikhail

Note: Since R2018a, Embedded Coder Interface to QEMU Emulator can be installed on Linux. Unfortunately, the ARM Cortex-M target itself doesn't yet support running in QEMU on Linux. So the runQemu.m from this submission can be used as a reference to modify runQemu.m from ARM Cortex-M target installation.

Updates

2.0.0.0

R2019a

1.0.0.0

Update installation note.

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: Embedded Coder Interface to QEMU Emulator

qemu_ert/+codertarget

qemu_ert/+codertarget/+arm_cortex_a

qemu_ert/+codertarget/+arm_cortex_m

qemu_ert/+codertarget/+qemu/+internal