170 lines
8.9 KiB
HTML
170 lines
8.9 KiB
HTML
<!DOCTYPE html>
|
|
<html class="writer-html5" lang="en" >
|
|
<head>
|
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Emulation — Amlogic documentation</title>
|
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
|
<link rel="stylesheet" href="../_static/drawio.css" type="text/css" />
|
|
<!--[if lt IE 9]>
|
|
<script src="../_static/js/html5shiv.min.js"></script>
|
|
<![endif]-->
|
|
|
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
|
<script src="../_static/doctools.js"></script>
|
|
<script src="../_static/sphinx_highlight.js"></script>
|
|
<script src="../_static/js/theme.js"></script>
|
|
<link rel="index" title="Index" href="../genindex.html" />
|
|
<link rel="search" title="Search" href="../search.html" />
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav">
|
|
<div class="wy-grid-for-nav">
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
<div class="wy-side-scroll">
|
|
<div class="wy-side-nav-search" >
|
|
<a href="../index.html" class="icon icon-home"> Amlogic
|
|
</a>
|
|
<div role="search">
|
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
|
<input type="text" name="q" placeholder="Search docs" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
</div>
|
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
|
<!-- Local TOC -->
|
|
<div class="local-toc"><ul>
|
|
<li><a class="reference internal" href="#">Emulation</a><ul>
|
|
<li><a class="reference internal" href="#devices">Devices</a><ul>
|
|
<li><a class="reference internal" href="#uart-device">UART Device</a></li>
|
|
<li><a class="reference internal" href="#timer-device">Timer Device</a></li>
|
|
<li><a class="reference internal" href="#todo">TODO</a></li>
|
|
<li><a class="reference internal" href="#i2c-device">I2C Device</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="../index.html">Amlogic</a>
|
|
</nav>
|
|
|
|
<div class="wy-nav-content">
|
|
<div class="rst-content">
|
|
<div role="navigation" aria-label="Page navigation">
|
|
<ul class="wy-breadcrumbs">
|
|
<li><a href="../index.html" class="icon icon-home"></a></li>
|
|
<li class="breadcrumb-item active">Emulation</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
<a href="../_sources/s905x3/emulation.rst.txt" rel="nofollow"> View page source</a>
|
|
</li>
|
|
</ul>
|
|
<hr/>
|
|
</div>
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
<div itemprop="articleBody">
|
|
|
|
<section id="emulation">
|
|
<h1>Emulation<a class="headerlink" href="#emulation" title="Permalink to this heading"></a></h1>
|
|
<p>Figure out where the stack is set:</p>
|
|
<figure class="align-default">
|
|
<img alt="../_images/find_stack_address.png" src="../_images/find_stack_address.png" />
|
|
</figure>
|
|
<p>The stack is set at: <code class="docutils literal notranslate"><span class="pre">0xfffe3800</span></code>.</p>
|
|
<section id="devices">
|
|
<h2>Devices<a class="headerlink" href="#devices" title="Permalink to this heading"></a></h2>
|
|
<p>The goal is to make a fuzzer for the <code class="docutils literal notranslate"><span class="pre">USB</span></code> and <code class="docutils literal notranslate"><span class="pre">I2C</span></code> devices.
|
|
To get insight and help with reverse engineering an emulator is being developed.</p>
|
|
<section id="uart-device">
|
|
<h3>UART Device<a class="headerlink" href="#uart-device" title="Permalink to this heading"></a></h3>
|
|
<p>UART is implemented in software. When the device boots it always sends a message over UART, this can now be printed:</p>
|
|
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>print(bytes(self.get_device("UART").get_rx()))
|
|
b'BL:511f6b:\x00\x00\x00\x00\x00\x00;FEAT:FF800228:0;POC:0;RCY:0;USB:0;'
|
|
</pre></div>
|
|
</div>
|
|
</section>
|
|
<section id="timer-device">
|
|
<h3>Timer Device<a class="headerlink" href="#timer-device" title="Permalink to this heading"></a></h3>
|
|
<p>Timer device is also implemented.</p>
|
|
</section>
|
|
<section id="todo">
|
|
<h3>TODO<a class="headerlink" href="#todo" title="Permalink to this heading"></a></h3>
|
|
<ul class="simple">
|
|
<li><p>Implement USB device</p></li>
|
|
<li><p>Dump Efuses from reference device and use it in the emulator, along with an efuse device</p></li>
|
|
</ul>
|
|
</section>
|
|
<section id="i2c-device">
|
|
<h3>I2C Device<a class="headerlink" href="#i2c-device" title="Permalink to this heading"></a></h3>
|
|
<p>Quickly after boot a string is read from I2C.
|
|
According to several sources on the internet this I2C device is in the HDMI port(TODO check this).</p>
|
|
<p>I2C is a serial protocol, which relies on 2 lines, SCK for clock and SDA for data. For this SoC and using the emulator we can see that GPIO25 is used for SCL and GPIO27 for SDA.</p>
|
|
<p>For Emulating this</p>
|
|
<p>Explanation of I2C according to ChatGPT:</p>
|
|
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>The I2C (Inter-Integrated Circuit) protocol is a popular serial communication protocol used for communication between integrated circuits (ICs) in various electronic devices. It was developed by Philips (now NXP Semiconductors) and is widely adopted due to its simplicity and versatility.
|
|
|
|
Key features of the I2C protocol include:
|
|
|
|
Master-Slave Architecture: The I2C bus typically consists of one or more master devices and multiple slave devices. The master device initiates and controls the communication, while the slave devices respond to commands and provide data or services.
|
|
|
|
Two-Wire Communication: I2C utilizes two lines for communication: a serial data line (SDA) and a serial clock line (SCL). Both lines are bidirectional, allowing data to be transmitted in both directions.
|
|
|
|
Addressing: Each slave device on the I2C bus has a unique address, allowing the master device to communicate with specific slaves. Addressing can be 7-bit or 10-bit, depending on the device and the variant of the I2C protocol.
|
|
|
|
Start and Stop Conditions: Communication on the I2C bus is initiated by the master device by asserting a start condition (a falling edge on SDA while SCL is high). The start condition indicates the beginning of a transmission. The master also sends a stop condition (a rising edge on SDA while SCL is high) to indicate the end of a transmission.
|
|
|
|
Data Transmission: Data is transferred in bytes (8 bits) between the master and slave devices. Each byte is followed by an acknowledgment (ACK) or not-acknowledgment (NACK) bit, indicating whether the receiver successfully received the data.
|
|
|
|
Clock Synchronization: The I2C protocol relies on the synchronized clock signals on the SCL line. Both the master and slave devices operate based on this clock signal.
|
|
|
|
Standard and Fast Modes: The I2C protocol supports two main modes: Standard Mode (up to 100 kbit/s) and Fast Mode (up to 400 kbit/s). Some devices also support High-Speed Mode (up to 3.4 Mbit/s) and Ultra-Fast Mode (up to 5 Mbit/s).
|
|
|
|
Multi-Master Support: I2C supports multi-master communication, allowing multiple master devices to coexist on the same bus. Collision detection and arbitration mechanisms are employed to prevent conflicts and ensure proper communication.
|
|
|
|
The I2C protocol is commonly used for various purposes, including connecting sensors, memory devices, displays, and other peripheral devices to microcontrollers, embedded systems, and other electronic devices. It provides a simple and efficient means of serial communication with minimal wiring requirements.
|
|
|
|
It's important to note that different devices and implementations may have specific variations or additional features built on top of the basic I2C protocol. Therefore, it's always recommended to refer to the device datasheet or the specific implementation documentation for detailed information on the usage and configuration of I2C in a particular system.
|
|
</pre></div>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
</section>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<footer>
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<p>© Copyright 2024, Eljakim.</p>
|
|
</div>
|
|
|
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
|
|
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<script>
|
|
jQuery(function () {
|
|
SphinxRtdTheme.Navigation.enable(true);
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html> |