Skip to content

Hypervisor Deployment

Carlos Moratelli edited this page Jan 16, 2017 · 18 revisions

This section shows how to obtain the prplHypervisor and deploy it on a board.

Obtaining the prplHypervisor sources

Clone the git repository of the prplHypervisor and make sure that you are at the master branch:

git clone https://github.com/prplfoundation/prpl-hypervisor

The prpl-hypervisor folder should be created. In that folder, checkout the master branch.

git checkout master

Flashing the bootloader

Use the MPLABX IPE to flash the corresponding bootloader to your board. The bootloader can be found in the prpl-hypervisor/bin directory. The available bootloaders are:

  • Microchip_Curiosity_UART.hex (Microchip PIC32MZ Curiosity board);
  • Microchip_Eth_Starter_Kit_UART.hex (Microchip PIC32MZ Embedded Connectivity Starter Kit);
  • chipKIT-WiFire-EF.hex (Digilent PIC32MZ Chipkit Wi-Fire Board).

These bootloaders were generated from the project https://github.com/chipKIT32/PIC32-avrdude-bootloader.

Connect the board to your host computer using a standard A to mini B cable. Use the mini B debugger connector on the board. After flashed, the LED1 will keep blinking showing the that the bootloader is ready to upload the hypervisor.

Compiling the prplHypervisor

From the folder prpl-hypervisor created on git clone command, go to the platform corresponding of your board. The available platforms (folders) are:

  • platform/pic32mz_starter_kit;
  • platform/pic32mz_chipkit_Wifire, and;
  • platform/pic32mz_curiosity.

On the chosen folder, use the make command to compile the hypervisor with its default configuration using the MIPS-MTI toolchain. This process will generate the firmware.hex file. This file contains the hypervisor and guests. Example:

~/prplHypervisor/platform/pic32mz_starter_kit$: make
gcc -o genconf cfg_reader/genconf.c -lconfig
#execute first and exit in case of errors
./genconf samples_cfg/sample-1VM.cfg || (exit 1)
blink
#execute and export to a makefile variable the ouput of the script
mips-mti-elf-gcc -EL -O2 -mtune=m14k -mips32r2 -Wa,-mvirt -mno-check-zero-division -msoft-float -fshort-double -c -ffreestanding -nostdlib -fomit-frame-pointer -G 0 -DETHERNET_SUPPORT -DUSB_SUPPORT -DCPU_SPEED=200000000 -DHYPVERSION="v0.11.27 (g9100f1a)" -I../../arch/mips/pic32mz_starter_kit/include -I../../arch/mips/common/include -I../../sys/lib/include -I../../sys/kernel/include -I../../platform/pic32mz_starter_kit/include \
               ../../sys/lib/libc.c \
               ../../sys/lib/linkedlist.c \
               ../../sys/lib/malloc.c


...


mips-mti-elf-size blink.elf
  text    data     bss     dec     hex filename
 12248      16    1424   13688    3578 blink.elf
make[1]: Saindo do diretório `/home/moratelli/hyper/prpl-hypervisor/bare-metal-apps/apps/blink'
../../scripts/genhex.sh blink
0+1 registros de entrada
1+0 registros de saída
65536 bytes (66 kB) copiados, 0,000635281 s, 103 MB/s
0+1 registros de entrada
1+0 registros de saída
32768 bytes (33 kB) copiados, 0,000245427 s, 134 MB/s

Note: See the main Makefile in your platform directory. You may want to modify the input configuration file (CFG_FILE), CROSS_COMPILER or the optional features. Example:

#Input CFG file for VMs configuration
CFG_FILE = ../samples_cfg/sample-1VM.cfg

# CROSS Compiler 
CROSS_COMPILER = mips-mti-elf-

# Optional Device Drivers
CONFIG_INTERVMCOMM_DRV = yes
CONFIG_PIC32MZ_USB_DRV = yes
CONFIG_PIC32MZ_ETHERNET_DRV = yes
CONFIG_VIRTUAL_IO_DRV = yes
CONFIG_INTERRUPT_REDIRECT_DRV = yes

Uploading the firmware

Upload the resulting firmware.hex file to the board using the make load command. Make sure that you have a cable connected to the UART port on your board. The following table shows the required cable to the supported boards.

Board Required Cables Connections
Microchip PIC32MZ Connectivity Starter Kit 2 x Standard A to mini B cables. Connect the cables to connectors J3 (power) and J11 (UART).
Digilent PIC32MZ Chiptkit Wi-Fire 1 x Standard A to mini B cables. Connect the cable to connector J1 (power/UART).
Microchip PIC32MZ Curiosity board 1 x Standard A to mini B cables and 1 x Serial to USB adapter. Connect the mini B cable connector to J3 (power). Use the USB adapter on the UART pins on MikroBus 1.

Expected make load command output.

~/prplHypervisor/platform/pic32mz_starter_kit$: make load

stty 115200 raw cs8 -hupcl -parenb -crtscts clocal cread ignpar ignbrk -ixon -ixoff -ixany -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke -F /dev/ttyACM0

./pic32prog -S -d /dev/ttyACM0 firmware.hex

Programmer for Microchip PIC32 microcontrollers, Version 2.0.186
Copyright: (C) 2011-2015 Serge Vakulenko
Adapter: STK500v2 Bootloader
Program area: 1d000000-1d1fffff
Processor: Bootloader
Flash memory: 2048 kbytes
Boot memory: 80 kbytes
Data: 131072 bytes
Erase: done
Program flash: ################################# done
Program rate: 6600 bytes per second

During power on, the bootloader will wait for 3 seconds before automatically loading the application. During this time, it is possible to flash a new firmware. Thus, before try to upload the firmware, press the reset button on your board and wait the blinking led.