Archive

Posts Tagged ‘tutorial’

DIY Power Measurement Board

July 23rd, 2014 6 comments

When I review media player or development boards, I’m often asked about power consumption figures. One way to measure power consumption is to use a Kill-a-Watt, but for low power devices it’s not always accurate enough, and it also includes the heat dissipation from the power adapter, which may or may not be useful depending on what you want to measure. For USB powered devices or boards, an easy way to measure power consumption is to use CHARGER Doctor, a small $5 USB dongle that displays both voltage and current alternatively. Unfortunately, most products I’ve received lately use barrel type connectors, so this little tool has not been as useful as I hoped. The only solution is then to measure voltage and current with a multimeter. Voltage is measured in parallel, so you just need to point the multimeter’s leads where you want to perform the measurements. However, the current is measure in series, so you need to insert the multimeter in the circuit somehow. A few possibilities:

  1. Unsoldering a component on the board to place the multimeter in series.
  2. Cut one wire of the power cable to insert the multimeter.
  3. Get and make a board to insert the multimeter.

Solutions 1 and 2 are not really desirable, so I decided to look into solution 1, and since I could not find any board that could match my requirements, I decided to work out a solution by myself allowing various power inputs and outputs.

Click to Enlarge

Click to Enlarge

The board can take power adapter using micro USB, mini USB or 5.5/2.1mm barrel connectors, 32 different output connectors thanks to two cables, and header pins are used to connect the multimeter’s leads.

Here’s the different components required for this solution:

  • 1x perfboard or veroboard
  • Some 2.54mm pin headers (straight and right angle)
  • micro USB breakout board – $1.50 on Adafruit, but shipping + insurance was $12, so instead I purchased 5x micro USB charging board for $4.24 on Ebay (asp_ezone)
  • mini USB breakout board – $1.95 on Sparkfun, but shipping killed it again, so I purchase 2x mini USB charging boards for $2.75 on asp_ezone shop.
  • 5.5/2.1mm DC power socket -  $4.18 for 10 pieces
  • USB Female DIP Socket Connector – $1.73 for 10 pieces
  • 6-in-1 Universal USB charging cable – $3.41
  • Universal 28-in-1 DC power socket / plug converter for laptop – $11.30

If you purchase everything from scratch the cost would be around $35.

In case the introduction is not clear, the board description below may help.

Power_Measurement_Board_Description

Iv’e also included the back of the board with the soldering for reference.

Power_Measurement_Board_BackAfter double checking I had made mistake inverting GND and VCC, which could be fatal, I tried it out by making some power measurements with Tronsmart Vega S89 Elite.

Tronsmart_Vega_S89_Elite_Power_Off_Power_ConsumptionIn power off mode, I get 115 mA (~ 575 mW @ 5V), so I’m confident it’s working just fine… Unfortunately, I quickly realized something is wrong as the boot does not complete most of the time, as it reaches 1A, the boot just simply stops, or I just get a blue screen. Only once or twice did I managed to get to the home screen (about 0.52A after most background tasks are done), but starting an app will hang the system most of the time. So  I’ve tried to replace the multimeter by a breadboard female to female cable, and everything works normally. So I suspect the contact surface with the leads is not large enough, or the multimeter introduces some noise that disturbs the device…. I’ll get some crocodile clips to see if things work out better…

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Categories: Hardware Tags: how-to, power, tutorial

How to Use an Android TV Box as a Wi-Fi Access Point

July 3rd, 2014 3 comments

Today, I’ve come across another potential use case for Android TV boxes with Wi-Fi and Ethernet. Let’s say you are in a room with Ethernet, but there’s no Wi-Fi signal or the signal is too weak, and want to use your smartphone to connect to the Internet via Wi-Fi. If you don’t have one of these small (openWRT) Wi-Fi router with you, but instead brought an Android mini PC, you can configure the “Portable Hotspot” function to transform it into a secure Wi-Fi access point.

Assuming you’ve connect an Ethernet cable, and powered the device, first make sure Ethernet is enabled\, and Wi-Fi is disabled in the Settings menu. To click on Settings->More.. in the Wireless & Networks section, and select “Tethering & portable hotspot” or simply “Portable hotspot” depending on your firmware. In the next menu, click on Portable Wi-Fi hotspot to enabled it, then “Set up Wi-Fi Hospot” to optionally change the Network SSID and Security protocol, and enter a password. Click on Save, and you’re done. Now you can connect with your smartphone to you Android mini PC SSID, by default “AndroidAP”. I’ve tested it with Tronsmart Vega S89 Elite, and it worked nicely.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How to Try Android L Developer Preview in Ubuntu 14.04

June 27th, 2014 No comments

As mentioned yesterday, Android L Developer Preview was about to be released, and this is now done with images for Nexus 5 “Hammerhead” and Nexus 7 “razor” available right now. However, if you don’t have either of these devices, or you’d rather not install a beta version on the phone you use everyday, you can still give a try in the SDK emulator.

I’ve tried Android L myself in Ubuntu 14.04. Here’s what you have to do:

  1. Install Android Studio IDE in Ubuntu, and Create a new Project  or open an existing project (Android Studio Version is now 0.61)
  2. Click on Tools->Android->SDK Manager in the top menu, and select the Android L (API 20, L Preview) packages as shown below, and click on “Install xx Packages” button.
    Android_SDK_Manager_Android_L
    Accept the license as required, and click Install. This step can take countless hours…
  3. Now we’ll need to create a Virtual Device for the emulator. Go to Tools->Android->AVD Manager, select “Device Definitions” tab, and you’ll see some new types of devices like Android TV and Android Wear Round and Square.
    Android_L_Virtual_Device
    But I just scrolled down and selected “Nexus 7″ and clicked on “Create AVD” button…
    Nexus_7_Android_L_Intel_Atom_WXGA720
    …and configured the system to use “Android L (Preview) with the Intel Atom (x86) CPU/ABI, and WXGA720 skin, and clicked OK.
  4. Your Nexus 7 with an Intel Atom processor :), running Android L should now show in the list of devices. Make sure it is selected, click on the Start button, and then Launch.
    Nexus_7_AVD_Android_L
  5. After a little while, you should be able to access Android L!

    Android L Screenshots (Click to Enlarge)

    Android L Screenshots (Click to Enlarge)

The screenshot on the right, is the blue and red rectangles animation that starts when you click 7 times on the Android version… There’s no Google Play in the emulator, so you’ll need to sideload the apps, or install a third party market such as Amazon Market to try out apps.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How to Upgrade Firmware for Rockchip RK3066/RK3188 Devices with the Command Line in Linux

May 25th, 2014 7 comments

Previously I wrote an article entitled “How to Flash Rockchip RK3066 / RK3188 Firmware in Linux” explaining how to use a graphical tool called RkFlashKit to upgrade firmware on Rockchip devices using a Linux computer. This tool had some limitations, and it would just have a subset of features of RkAndroidTool (Windows), and it was not possible to flash “update.img” type of firmware which are often provided and flashed with RkBatchTool in Windows.

Luckily there’s now a command line tool called upgrade_tool that allows you to flash the “update.img” firmware files directly from Linux. I’ve already shown how to use it with Radxa Rock, but it’s buried with other instructions, so I’ve decided to make a separate post. This has been tested in Ubuntu 14.04 with Radxa Rock (RK3188) and Measy U2C (RK3066).

Ready? Let’s start by installing upgrade_tool in a terminal:

wget http://dl.radxa.com/rock/tools/linux/Linux_Upgrade_Tool_v1.16.zip
unzip Linux_Upgrade_Tool_v1.16.zip

Installation is now complete. You could also choose to add it to your PATH.

Now download the firmware for your device, let’s call it “android-5.0_rk3xxx.img”, and enter recovery more in your device. This is usually done by connecting a USB to micro USB cable between the OTG port of your device and your PC, and press a “recovery” or “reset” button on your device with a sharp object (e.g. toothpick) and turning on the device.

Now complete the firmware upgrade with the two command below:

sudo ./upgrade_tool lf
sudo ./upgrade_tool uf android-5.0_rk3xxx.img

Done. It’s that easy. Now just restart your device to boot the new firmware.

The full output during the firmware update procedure should look like:

$ sudo ./upgrade_tool lf
 Lower Format Device,total(2048),current(2044)
 Lower Format Device OK.
 $ sudo ./upgrade_tool uf android-5.0_rk3xxx.img
 Loading firmware...
 Support Type:RK30 FW Ver:5.0.02 FW Time:2014-11-27 17:19:47
 Loader ver:3.23 Loader Time:2014-10-03 18:08:37
 Upgrade firmware ok.

You can also flash individual files (parameter, boot.img, system.img, etc…) with upgrade_tool utility, as well as do some checks with the NAND flash. More details can be found in linux_upgrade_tool_v1.16_help(Chinese).pdf in the zip file used for installation.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How to Boot a Headless Linux Image on Amlogic S802 TV Boxes (Tronsmart Vega S89 Elite)

May 15th, 2014 28 comments

As some of you already know, I’ve been playing around with Tronsmart Vega S89 Elite, an Android TV Box powered by Amlogic S802 quad core ARM Cortex A9r4 processor at 2 GHz. Today, I’ll show how to boot a headless Linux image on any Amlogic based S802 TV Box from the network. The instructions can mainly be used as a starting point for developers, as it requires access to a serial terminal via  UART, but if you’ve never done it before, the instructions should be easy enough to follow. Everything is loaded from the network, the kernel (via boot.img) is loaded via TFTP, and the rootfs (Linaro ALIP image) is mounted via NFS, so it’s nearly impossible to brick your device using the method provided. Linaro ALIP rootfs comes with LXDE, but at this stage the desktop environment is not showing, even through my HDMI TV is properly detected by the drivers. However, Ethernet, USB mass storage, and the micro SD seem to be working just fine.

Linux_Amlogic_S802

If you want to skip the kernel compilation part, ramdisk modification, and just boot your Vega S89 Elite from network you can download vegas89eboot.img (compressed with bzip2), and skip steps 4 to 9 included. Please don’t just flash this image or use it without reading the post, as even if it should not brick your device, Android won’t boot at all if you don’t follow the right instructions.

Let’s get started

  1. Make sure you’ve connected a USB to serial board to your S802 based device.
  2. If not done already, you’ll need to install TFTP and NFS servers, and the get basic development tools in a Linux computer. All instructions here have been performed in a PC running Ubuntu 14.04 64-bit.
    • For the TFTP server, I installed and ran aftfpd as follows:
      sudo apt-get install atftpd
      sudo tftpd --daemon
    • Instructions to install an NFS server on Ubuntu/Debian.
    • You’ll need to install the build-essentials and other tools to successfully build Linux, something like:

      sudo apt-get install git-core build-essential zip curl g++-multilib cpio gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi

  3. Download a rootfs, and extract it to your NFS directory. For example:
    mkdir -p /srv/nfs/alip 
    pushd /srv/nfs/alip
    wget http://releases.linaro.org/14.04/openembedded/vexpress-lsk/linaro-image-alip-genericarmv7a-20140417-248.rootfs.tar.gz
    sudo tar xzvf linaro-image-alip-genericarmv7a-20140417-248.rootfs.tar.gz
    popd
  4. Get the device tree file (DTD) for your device from its firmware image or, if not available, directly from the NAND flash.
  5. Follow the instructions to get S802 kernel source and setup the source tree until after the step where you do
    make ARCH=arm meson8_defconfig
  6. Run “make ARCH=arm menuconfig” to enable NFS client support as shown below.
    Linux_3.10_NFSThen exit and save
  7. You’ll need to edit mk_m8.sh script for your device using the correct DTD file, which you need to copy to ./arch/arm/boot/dts/amlogic/ directory.  I’ve renamed the script to mk_vegas89e.sh, and edited it as follows:
    # Modify these four lines for your board
    DTDFILE=meson8_vegas89e
    DTDFILE_PATH=./arch/arm/boot/dts/amlogic/
    BOOTIMG=vegas89eboot.img
    ROOTFS="rootfs.cpio"
    
    make uImage -j8
    #make modules
    
    make ${DTDFILE}.dtd
    make ${DTDFILE}.dtb
    
    ./mkbootimg --kernel ./arch/arm/boot/uImage --ramdisk ./${ROOTFS} --second ${DTDFILE_PATH}/${DTDFILE}.dtb --output ./${BOOTIMG}
    ls -l ./${BOOTIMG}
    echo "${BOOTIMG} done"
  8. We also need to create and init to switch the root to NFS. Normally, we should be able to do  in the bootloader with “bootargs” but this did not work for me, probably because I missed some steps.
    1. Extract the ramdisk provided with the source code
      mkdir rootfs
      cd rootfs
      sudo cpio -i -F ../rootfs.cpio
    2. Delete sbin/init symlink to busybox, and create a new init file. Be very careful at this stage as if you inadvertently add a leading slash, you’ll mess up with your PC system.
      rm sbin/init
      sudo vi sbin/init
    3. Here’s the content of sbin/init. Replace 192.168.0.104 by the IP address of your PC / NFS server, and /srv/nfs/alip by the path where you extracted your rootfs in the NFS directory.
      #!/bin/busybox sh
      
      echo "CNXSoft init script entered"
      PATH="/bin:/sbin:/usr/bin:/usr/sbin"
      
      echo "DHCP..."
      udhcpc eth0
      
      echo "Mounting NFS rootfs..."
      mount -t nfs -o proto=tcp -o nolock 192.168.0.104:/srv/nfs/alip /mnt
      
      echo "Switching root..."
      exec switch_root /mnt /sbin/init
    4. Recreate the ramdisk
      find .| sudo cpio -o -H newc > ../rootfs.cpio
      cd ..
  9. Now we can finally build the kernel, and boot.img:
    chmod +x mk_vegas89e.sh
    ./mk_vegas89e.sh
  10. It should take between a minute to a few minutes depending on your machine, and if everything works as planned you could get your boot.img, in my case vegas89eboot.img. Copy it to your tftp server directory
    sudo cp vegas89eboot.img /srv/tftp/boot.img
  11. Now start minicom connected to ttyUSB0 (115200 8N1), and power the TV box. Press the space bar, or any other key, during boot up to access U-boot command line. Let’s define IP addresses for the board, the TFTP server, and gateway (router), and save these to the U-boot environment:
    m8_k200_v1# setenv ipaddr 192.168.0.144
    m8_k200_v1# setenv serverip 192.168.0.104
    m8_k200_v1# setenv gatewayip 192.168.0.1
    m8_k200_v1# saveenv
  12. Setup the boot arguments for NFS. I know I should really have used fixed IP instead of dhcp, for consistency, and to shave off two or three seconds to boot time, but…

    m8_k200_v1# setenv bootargs 'root=/dev/nfs rootfstype=nfs nfsroot=192.168.0.104:/srv/nfs/alip,rw,nolock ip=dhcp rootwait init=/sbin/init no_console_suspend storage=4 logo=osd1,loaded,0x15100000,576cvbs,full hdmimode=720p cvbsmode=576cvbs androidboot.firstboot=0 hdmitx=cec0 console=ttyS0,115200n8'

    You could also use saveenv to save these, but then Android won’t boot anymore next time your start the board. Alternatively, you could create a bootargs2 and copy this to bootargs before running Linux.

  13. Load boot.img from the TFTP server
    bootp
  14. Start the system
    bootm

    Once you make sure boot.img loads properly from TFTP server, you could also combine both commands with “bootp; bootm

  15. You should now have access to the command line as root, no password required. An sshd daemon is already running so you can access it via ssh if you want. The board temperature will be outputted every second or so. There must be a way to disable that in the code, but in the meantime you can do:
    echo "3 3 3 3" > /proc/sys/kernel/printk

Let’s have a look at free memory, storage devices and more.

root@genericarmv7a:~# uname -a                                                  
Linux genericarmv7a 3.10.10 #2 SMP PREEMPT Tue May 13 17:14:29 ICT 2014 armv7l x
root@genericarmv7a:~# free -m                                                   
             total         used         free       shared      buffers          
Mem:          1578           91         1487            0            3          
-/+ buffers:                 87         1490                                    
Swap:            0            0            0                                    
root@genericarmv7a:~# df -h                                                     
Filesystem                Size      Used Available Use% Mounted on              
192.168.0.104:/srv/nfs/alip                                                     
                        901.0G    656.3G    199.0G  77% /                       
tmpfs                    40.0K         0     40.0K   0% /mnt/.psplash           
tmpfs                   789.3M    176.0K    789.1M   0% /run                    
tmpfs                   789.3M    128.0K    789.1M   0% /var/volatile           
none                    775.2M      4.0K    775.2M   0% /dev                    
/dev/sda1                 3.4G      2.7G    678.8M  80% /media/sda1             
root@genericarmv7a:~# 

There’s about 1.5GB ram free, I’ve got a lot of storage in the root as it is the 1TB hardware in my PC, and my 4GB USB flash drive was almost mounted automatically.

I’ll also through the CPU information for reference:

root@genericarmv7a:~# cat /proc/cpuinfo                                         
Processor       : ARMv7 Processor rev 1 (v7l)                                   
processor       : 0                                                             
BogoMIPS        : 12.65                                                         
                                                                                
processor       : 1                                                             
BogoMIPS        : 12.65                                                         
                                                                                
processor       : 2                                                             
BogoMIPS        : 12.65                                                         
                                                                                
processor       : 3                                                             
BogoMIPS        : 12.65                                                         
                                                                                
Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls               
CPU implementer : 0x41                                                          
CPU architecture: 7                                                             
CPU variant     : 0x4                                                           
CPU part        : 0xc09                                                         
CPU revision    : 1                                                             
                                                                                
Hardware        : Amlogic Meson8 platform                                       
Revision        : 000b                                                          
Serial          : 1900000000000000

You should easily be able to adapt these instructions to boot from flash, by inserting boot.img into one of the available firmware update packages, and switching root to a USB flash or hard drive with the rootfs. I’m not sure how to access the flash partitions right now, as only the bootloader shows up in the MTD partition, but it;s the same thing in Android.

root@genericarmv7a:~# cat /proc/mtd                                             
dev:    size   erasesize  name                                                  
mtd0: 00060000 00001000 "bootloader"                                            
mtd1: 00010000 00001000 "ubootenv"                                              
root@genericarmv7a:~# ls /dev/block/ -l                                         
total 0                                                                         
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 254:0 -> ../zram0      
lrwxrwxrwx    1 root     root            12 Apr 17 15:21 31:0 -> ../mtdblock0   
lrwxrwxrwx    1 root     root            12 Apr 17 15:21 31:1 -> ../mtdblock1   
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:0 -> ../loop0        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:1 -> ../loop1        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:2 -> ../loop2        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:3 -> ../loop3        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:4 -> ../loop4        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:5 -> ../loop5        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:6 -> ../loop6        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:7 -> ../loop7        
lrwxrwxrwx    1 root     root             6 Apr 17 15:21 8:0 -> ../sda          
lrwxrwxrwx    1 root     root             7 Apr 17 15:21 8:1 -> ../sda1

I’m not sure I’ll go much further myself, but hopefully some people will pick up on this, and we’ll get a fully working easily installable Linux server and desktop images for Amlogic S802 based platforms.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How to Extract a Device Tree File from Android Firmware Files

May 12th, 2014 13 comments

Up to now, all our cheap Android devices were based on older Linux kernel (3.0.x, 3.4.x) that still used board files (arch/arm/board, but we’ve recently seen companies like Amlogic and Rockchip release source code with Linux kernel 3.10.x. One of the key differences between these version are the move from board files to flattened device tree and multi-platform support. If it is fully implemented, a single kernel image should be able to boot multiple hardware platforms, and all low level configuration handled by the device tree file. Since I’ve connected the serial port of Tronsmart Vega S89 for debugging, and it’s a slow news day, I thought I might try to boot the Linux kernel I compiled myself, but one of the challenge was to get the device tree file. I’ll show how to extract it from the firmware. It should also be possible to get it directly from the flash, but “cat /proc/mtd” does not show a complete list of partition as in previous versions.

I’ve performed the steps below in Ubuntu 14.04. The first thing is to install some tools: the device tree compiler that we’ll use to decompile the dtb (binary) file into a dtd (text) file, and split_bootimg.pl a standard PERL script to extract files from boot.img:

sudo apt-get install device-tree-compiler
wget https://gist.githubusercontent.com/jberkel/1087743/raw/5be96af0e1c1346678379b0c0f0330b71df51f25/split_bootimg.pl
sudo cp split_bootimg.pl /usr/local/bin
sudo chmod +x /usr/local/bin/split_bootimg.pl

I’ll use M8 / TM8 firmware (Amlogic S802) as an example. The exact procedure will vary between firmware files, but if you can boot.img, the procedure should be platform independent and work for any ARM SoC. After having downloaded and extracted the firmware file (TM8 ap6330_03102014A_0410_ROOT.rar), let’s create a working directory, and unzip the “OTA” file.

mkdir TM8
cd TM8
unzip ../k200-ota-20140410.zip

We now get a bunch of files, including boot.img. Great! Time to run split_bootimg.pl script to extract its content:

split_bootimg.pl boot.img
Page size: 2048 (0x00000800)
Kernel size: 7209567 (0x006e025f)
Ramdisk size: 2024995 (0x001ee623)
Second size: 17699 (0x00004523)
Board name: 
Command line: 
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.
Writing boot.img-second.gz ... complete.

So we’ve got the kernel, a ramdisk, and a “second file” that happens to be the dtb file. We can now decompile it with dtc (device tree compiler) as follows:

dtc -I dtb boot.img-second.gz -O dts -o meson8_tm8.dtd

That’s it. Here’s M8 device tree file.

I’ve done the same for Tronsmart Vega S89 (Elite). S89 firmware is usually distributed as an IMG file to be used with AML Flash Burning tool, but I haven’t found a way to extract such file yet. however, I’ve found an “OTA” firmware, to be updated via SD Card, on freaktab, and could extract the device tree file for Tronsmart Vega S89 Elite & Vega S89. Both M8 and S89 Elite DTD files are very similar, but the maximum CPU frequency seems to be higher in M8, and there are other apparently minor differences. Vega S89 DTD file appears to be much different however.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Imperas Releases ARM Cortex A53 & A57 Open Source Models for OVPsim

May 8th, 2014 1 comment

Since the end of 2012, it has been possible to use ARM 64-bit Fast models to run code compiled for the new ARMv8 architecture by emulating a 64-bit ARM processor inside an Intel / AMD processor. ARM fast models are not the only “free” option anymore, as Imperas has released OVPsim 20140430 with open source models for ARM Cortex A53 and Cortex A57 cores. OVPsim is a virtual platform that’s available free of charge for personal usage. The simulator itself (OVPsim) is closed source, but processor, peripheral and platform models are released under the Apache License version 2.0.

Open Virtual Platform Architecture with SystemC

Open Virtual Platform using SystemC Environment

OVP models of the ARM Cortex-A53 and Cortex-A57 are fully instruction accurate models, and you can use them for personal with an additional free license key, but if you want to make use of advanced features such as TrustZone and hardware virtualization you’ll need to purchase a commercial version (Imperas Developer or Imperas Advanced Multicore Software Development Kit).

OVPsim is available both for Windows and Linux, and I’ve given it a try in Ubuntu 14.04. The whole process is not as enjoyable as it could be due to registration and licensing requirements. Here’s what I’ve managed to do so far:

  1. Register or login to ovpworld.org
  2. Go to the Download page to download  OVPsim Fast Simulator, the ARM Cortex A models and OVPsim_demo_arm_ARMv8 (single and multi- core demos for Cortex A53 and Cortex A57). You can also find other models, demos, as well as documentation there. You may especially want to download Imperas_Installation_and_Getting_Started.pdf.
  3. Install OVPsim
    chmod +x OVPsim.20140430.0.Linux32.exe
    ./OVPsim.20140430.0.Linux32.exe

    You’ll need a accept the software license to complete the installation. I will create Imperas.20140430 directory by default.

  4. Configure OVPsim
    source Imperas.20140430/bin/setup.sh
    setupImperas -m32 <INSTALLATION_PATH>/Imperas.20140430
    export IMPERAS_RUNTIME=OVPsim
    export PATH=${PATH}:$IMPERAS_HOME/bin/$IMPERAS_ARCH
    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$IMPERAS_HOME/bin/$IMPERAS_ARCH:$IMPERAS_HOME/lib/$IMPERAS_ARCH/External/lib
  5. Get a license key. The hostid & hostname correspond to your  MAC address and hostname that you can retrieve with /sbin/ifconfig and hostname commands. Email to [email protected] to request a license key for ARMv8 models.
  6. Copy the license keys, you’ve received to $IMPERAS_HOME/OVPsim.lic
  7. Install the ARM models (Cortex A, R, and
    chmod +x arm.model.20140430.0.Linux32.exe
    ./arm.model.20140430.0.Linux32.exe

    Accept the license agreement to go ahead with the installation.

  8. Install the Cortex A53 and A57 demos (binary and source code).
    chmod +x OVPsim_demo_arm_ARMv8.20140430.0.Linux32.exe
    ./OVPsim_demo_arm_ARMv8.20140430.0.Linux32.exe

    You’ll need to accept another license agreement…

  9. You should now be able to go to Imperas.20140430/Demo, and go inside OVPsim_arm_Cortex-A53, OVPsim_manycore_arm_Cortex-A53, OVPsim_arm_Cortex-A57, and OVPsim_manycore_arm_Cortex-A57 to try various demos: linpack, dhrystone, peakSpeed2, fibonacci, and more.

At the time of writing, I’ve only received my standard OVPsim license key, and I’m still waiting for my ARMv8 license key, so I haven’t been able to try it successfully yet, and I get the following error:

Fatal (LIC) No such feature exists.
Feature:       IMP_MODEL_ARMv8
License path:  /home/jaufranc/edev/sandbox/Imperas.20140430/OVPsim.lic:
FLEXnet Licensing error:-5,357

If you want to check out the source, it is located in Imperas.20140430/ImperasLib/source/arm.ovpworld.org/ for processors, peripherals, and platforms. It’s a bunch of hpp files written using SystemC TLM 2, a set of C+ classes or macros used for virtual platform modeling.

You can find more information about OVPSim and various models on ovpworld.org.

[Update: I've finally received the IMP_MODEL_ARMv8 license by email, and tried a few tests from a single core Cortex A53 to a 24-core Cortex A57 model.  I've also been told the Linux kernel can't boot on the model right now, but will for next release

Here's the output for Dhrystone test on a single Cortex A53 core:

Imperas.20140430/Demo/OVPsim_arm_Cortex-A53$ ./RUN_dhrystone.sh 
Warning (LIC_EXP) License feature 'IMP_OVPSIM_20140430' will expire in 29 days

OVPsim (32-Bit) v20140430.0 Open Virtual Platform simulator from www.OVPworld.org.
Copyright (c) 2005-2014 Imperas Software Ltd.  Contains Imperas Proprietary Information.
Licensed Software, All Rights Reserved.
Visit www.IMPERAS.com for multicore debug, verification and analysis solutions.

OVPsim started: Sun May 11 10:19:27 2014


Info (ICM_AL) Found attribute symbol 'modelAttrs' in file '/home/jaufranc/edev/sandbox/Imperas.20140430/lib/Linux32/ImperasLib/arm.ovpworld.org/semihosting/armAngel/1.0/model.so'
Info (ICM_AL) Found attribute symbol 'modelAttrs' in file '/home/jaufranc/edev/sandbox/Imperas.20140430/lib/Linux32/ImperasLib/arm.ovpworld.org/processor/arm/1.0/model.so'
Warning (LIC_EXP) License feature 'IMP_MODEL_ARMv8' will expire in 29 days
Info (OR_OF) Target 'cpu0' has object file read from 'dhrystone.AARCH64.elf'
Info (OR_PH) Program Header    size                load addr           file offset
Info (OR_PD)                   000000000001887c  0000000080000000  0000000000010000
Info (OR_PD)                   00000000000037a2  0000000080028880  0000000000028880
Info (OR_PD)                   0000000000000024  0000000080000000  0000000000010000
Info (ARM_ANGEL_HEAP_INFO) ARM Angel heap_base=0xc0000000 heap_limit=0xdfffffffx stack_pointer=0xfffffffcx stack_limit0xe0000000x
 
Dhrystone Benchmark, Version 2.1 (Language: C)
 
Program compiled without 'register' attribute
 
Please give the number of runs through the benchmark:  
Execution starts, 5000000 runs through Dhrystone
Execution ends
 
Final values of the variables used in the benchmark:
 
Int_Glob:            5
        should be:   5
Bool_Glob:           1
        should be:   1
Ch_1_Glob:           A
        should be:   A
Ch_2_Glob:           B
        should be:   B
Arr_1_Glob[8]:       7
        should be:   7
Arr_2_Glob[8][7]:    5000010
        should be:   Number_Of_Runs + 10
Ptr_Glob->
        should be:   (implementation-dependent)
  Discr:             0
        should be:   0
  Enum_Comp:         2
        should be:   2
  Int_Comp:          17
        should be:   17
  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
        should be:   DHRYSTONE PROGRAM, SOME STRING
Next_Ptr_Glob->
        should be:   (implementation-dependent), same as above
  Discr:             0
        should be:   0
  Enum_Comp:         2
        should be:   1
  Int_Comp:          18
        should be:   18
  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
        should be:   DHRYSTONE PROGRAM, SOME STRING
Int_1_Loc:           5
        should be:   5
Int_2_Loc:           13
        should be:   13
Int_3_Loc:           7
        should be:   7
Enum_Loc:            1
        should be:   1
Str_1_Loc:           DHRYSTONE PROGRAM, 1′ST STRING
        should be:   DHRYSTONE PROGRAM, 1′ST STRING
Str_2_Loc:           DHRYSTONE PROGRAM, 2′ND STRING
        should be:   DHRYSTONE PROGRAM, 2′ND STRING
Begin Time = 0
End Time   = 0
Measured time too small to obtain meaningful results
Please increase number of runs
 
Info (ARM_ANGEL_REPORT_EXCEPTION) Process exception (unknown)
*** simulation interrupted
Info 
Info —————————————————
Info CPU ‘cpu0_CPU0′ STATISTICS
Info   Type                  : arm (Cortex-A53MPx1)
Info   Nominal MIPS          : 100
Info   Final program counter : 0x80015c5c
Info   Simulated instructions: 5,755,061,326
Info   Simulated MIPS        : 408.2
Info —————————————————
Info 
Info —————————————————
Info SIMULATION TIME STATISTICS
Info   Simulated time        : 57.55 seconds
Info   User time             : 13.94 seconds
Info   System time           : 0.16 seconds
Info   Elapsed time          : 14.12 seconds
Info   Real time ratio       : 4.08x faster
Info —————————————————

OVPsim finished: Sun May 11 10:19:41 2014


OVPsim (32-Bit) v20140430.0 Open Virtual Platform simulator from www.OVPworld.org.
Visit www.IMPERAS.com for multicore debug, verification and analysis solutions.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter