Table of Contents
In this article, we will demonstrate using the AVH platform to run Arm Fixed Virtual Platforms (FVPs) simulation models.
Model Differences
FVP simulation models are created by Arm using Arm Fast Models and simulate the behavior of the represented IP subsystem. On avh.arm.com, FVP systems execute on Arm cores running Linux.
Third-party hardware models are virtualized representations of development boards and leverage a hypervisor to represent the behavior of the system.
Although the underlying implementation technology for FVPs and Third Party hardware models are different, both types of models on avh.arm.com can be accessed and controlled using the same APIs.
Create an FVP Device on the Web Interface
From the AVH start page, click CREATE DEVICE.
Select any device with a name ending in FVP, in this case, we are creating a device that runs the Corstone-300 FVP.
Choose the default firmware and click SELECT. Do not use this screen to upload your FVP application. For FVPs, the firmware running on the Arm processors is actually the Linux OS which contains the FVP itself. Uploading new firmware will overwrite that image and corrupt the simulation. (This capability will be removed in a future release to prevent the possibility of accidental corruption.)
Optionally name your device, confirm the details, and click CREATE DEVICE.
Open the FVP page in Settings.
Upload your application binary. The application binary must be in
axf
format.$ file hello.axfhello.axf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped
You can use this same window to upload a configuration file or specify the v_path used for Virtual Interfaces. For more information on using these options, see the AVH GitHub page.
Confirm that the files have been uploaded successfully and click CREATE DEVICE.
Wait a few minutes for the virtual device to become ready.
Click on the Console to see the simulation results.
Create an FVP Device using the API
You can also upload the custom binary and configuration file using our APIs.
Python API Example
Here is an example script to create the custom device using our Python Sync API:
mport os
from avh_api import ApiClient as AvhApiClient
from avh_api import Configuration as AvhApiConfiguration
from avh_api.api.arm_api import ArmApi as AvhApi
avh_api_token = os.environ['AVH_API_TOKEN']
avh_api_config = AvhApiConfiguration()
avh_api_client = AvhApiClient(avh_api_config)
avh_api = AvhApi(avh_api_client)
avh_api_config.access_token = avh_api.v1_auth_login(
{"api_token": avh_api_token}
).token
default_project_id = avh_api.v1_get_projects()[0]["id"]
print('default_project_id =', default_project_id)
config_file_id = avh_api.v1_create_image(
'vmfile',
encoding='plain',
name='config-file',
project=default_project_id,
file=open('path/to/config.txt', 'rb')
).id
print('config_file_id = ', config_file_id)
application_id = avh_api.v1_create_image(
'vmfile',
encoding='plain',
name='application',
project=default_project_id,
file=open('path/to/binary.elf', 'rb')
).id
print('application_id = ', application_id)
instance_id = avh_api.v1_create_instance({
"name": "Corstone-300 FVP",
"project": default_project_id,
"flavor": 'corstone-300fvp',
"os": '11.16.14',
"osbuild": 'FastModels',
"boot_options": {
"vmfile": [
{
"id": config_file_id,
"name": "config-file",
},
{
"id": application_id,
"name": "application",
}
]
}
}).id
print('instance_id = ', instance_id)
JavaScript API Example
Here is an example script to create the custom device using our JavaScript API:
const vmfiles = [
{ name: 'config-file', localFilePath: path.join(__dirname, 'path/to/fvp_config.txt') },
{ name: 'application', localFilePath: path.join(__dirname, 'path/to/binary.axf') },
{ name: 'v_path', localFilePath: path.join(__dirname, 'path/to/python.zip') },
{ name: 'data1', localFilePath: path.join(__dirname, 'path/to/data.dat') }
]
const images = await Promise.all(vmfiles.map(vmfile => {
return project.uploadVmfile(vmfile.localFilePath, vmfile.name)
}))
instanceCreateOptions.bootOptions = {
vmfile: images,
fvp: {
cyclelimit: '768000000',
data: [
'/home/ubuntu/data1'
]
}
}
instance = await project.createInstance(instanceCreateOptions)