:name: Tegra 3
:description: This script runs Linux on Tegra 3.

using sysbus
$name?="Tegra-3"
mach create $name

machine LoadPlatformDescription @platforms/boards/tegra3.repl

sysbus Redirect 0xC0000000 0x80000000 0x40000000

showAnalyzer sysbus.uart0

$bin?=@https://dl.antmicro.com/projects/renode/vmlinux-tegra3-s_100633360-e6280cbc8b535fbc34c1cf16695deb4bedcaf982
$rootfs?=@https://dl.antmicro.com/projects/renode/tegra_pendrive.img-s_36700160-cadcf9fa3e7306301858a9d949b4cd7d579ba88e

machine PendriveFromFile $rootfs "pendrive" sysbus.usbEhci2.usbHub 3 false

macro reset
"""
    sysbus LoadELF $bin

    cpu SetRegister 0 0x0
    cpu SetRegister 2 0x80000100     # atags

    sysbus LoadAtags "console=ttyS0,115200n8 lp0_vec=0x00002000@0x9C406000 mem=1023M@2048M vmalloc=128M noinitrd usbcore.old_scheme_first=1 core_edp_mv=1300 tegraid=30.1.2.0.0 root=/dev/sda1 ip=:::::eth0:off rw,noatime rootwait rootfstype=ext3" 0x80000000 0x80000100
"""

runMacro $reset
