Samsung_S7/documentation/source/_ignore/draw_boot.ipynb
2024-09-09 17:23:10 +02:00

5016 lines
113 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Using plotly\n",
"import plotly.graph_objects as go\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Define data"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>start</th>\n",
" <th>end</th>\n",
" <th>name</th>\n",
" <th>order</th>\n",
" <th>comment</th>\n",
" <th>X0</th>\n",
" <th>LR</th>\n",
" <th>size</th>\n",
" <th>overlap</th>\n",
" <th>overlap_with</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>131072</td>\n",
" <td>BootROM</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>131072</td>\n",
" <td>True</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>704</td>\n",
" <td>708</td>\n",
" <td>_jump_bl1</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>4</td>\n",
" <td>True</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>25824</td>\n",
" <td>25996</td>\n",
" <td>_boot_usb</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>172</td>\n",
" <td>True</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>75848</td>\n",
" <td>76008</td>\n",
" <td>auth_bl1</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>160</td>\n",
" <td>True</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>33660508</td>\n",
" <td>33689180</td>\n",
" <td>Tried debugger space</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>28672</td>\n",
" <td>False</td>\n",
" <td>4.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>33689440</td>\n",
" <td>33689448</td>\n",
" <td>_boot_usb_ra</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>8</td>\n",
" <td>False</td>\n",
" <td>5.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>33693696</td>\n",
" <td>33701888</td>\n",
" <td>BL1</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>8192</td>\n",
" <td>False</td>\n",
" <td>6.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>33701888</td>\n",
" <td>33849344</td>\n",
" <td>BL31</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>147456</td>\n",
" <td>True</td>\n",
" <td>7.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>33773056</td>\n",
" <td>33773064</td>\n",
" <td>TTBR0_EL3 address ptr</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>8</td>\n",
" <td>True</td>\n",
" <td>7.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>33849344</td>\n",
" <td>34008336</td>\n",
" <td>BL2</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>158992</td>\n",
" <td>True</td>\n",
" <td>9.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>33849344</td>\n",
" <td>33872624</td>\n",
" <td>BL2 empty space?</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>23280</td>\n",
" <td>True</td>\n",
" <td>9.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>33876736</td>\n",
" <td>33876736</td>\n",
" <td>BL2 copy start/source</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>True</td>\n",
" <td>9.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>33984512</td>\n",
" <td>34009088</td>\n",
" <td>Debugger</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>24576</td>\n",
" <td>True</td>\n",
" <td>9.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>34008336</td>\n",
" <td>34013184</td>\n",
" <td>End/Start peripheral space?</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>4848</td>\n",
" <td>True</td>\n",
" <td>12.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>34340864</td>\n",
" <td>34369536</td>\n",
" <td>Debugger relocated</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>28672</td>\n",
" <td>True</td>\n",
" <td>16.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>34340864</td>\n",
" <td>34340868</td>\n",
" <td>_frederic_dest_ptr</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>4</td>\n",
" <td>True</td>\n",
" <td>14.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>34349056</td>\n",
" <td>34508048</td>\n",
" <td>BL2 load address?</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>158992</td>\n",
" <td>True</td>\n",
" <td>16.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>34371584</td>\n",
" <td>34373632</td>\n",
" <td>modem_interface</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2048</td>\n",
" <td>True</td>\n",
" <td>16.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>287338512</td>\n",
" <td>287338512</td>\n",
" <td>memread/write space</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>False</td>\n",
" <td>18.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>346816512</td>\n",
" <td>346836992</td>\n",
" <td>mali@14AC0000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>20480</td>\n",
" <td>False</td>\n",
" <td>19.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" start end name order comment X0 LR \\\n",
"0 0 131072 BootROM NaN NaN NaN NaN \n",
"1 704 708 _jump_bl1 NaN NaN NaN NaN \n",
"2 25824 25996 _boot_usb NaN NaN NaN NaN \n",
"3 75848 76008 auth_bl1 NaN NaN NaN NaN \n",
"4 33660508 33689180 Tried debugger space NaN NaN NaN NaN \n",
"5 33689440 33689448 _boot_usb_ra NaN NaN NaN NaN \n",
"6 33693696 33701888 BL1 NaN NaN NaN NaN \n",
"7 33701888 33849344 BL31 NaN NaN NaN NaN \n",
"8 33773056 33773064 TTBR0_EL3 address ptr NaN NaN NaN NaN \n",
"9 33849344 34008336 BL2 NaN NaN NaN NaN \n",
"10 33849344 33872624 BL2 empty space? NaN NaN NaN NaN \n",
"11 33876736 33876736 BL2 copy start/source NaN NaN NaN NaN \n",
"12 33984512 34009088 Debugger NaN NaN NaN NaN \n",
"13 34008336 34013184 End/Start peripheral space? NaN NaN NaN NaN \n",
"14 34340864 34369536 Debugger relocated NaN NaN NaN NaN \n",
"15 34340864 34340868 _frederic_dest_ptr NaN NaN NaN NaN \n",
"16 34349056 34508048 BL2 load address? NaN NaN NaN NaN \n",
"17 34371584 34373632 modem_interface NaN NaN NaN NaN \n",
"18 287338512 287338512 memread/write space NaN NaN NaN NaN \n",
"19 346816512 346836992 mali@14AC0000 NaN NaN NaN NaN \n",
"\n",
" size overlap overlap_with \n",
"0 131072 True 0.0 \n",
"1 4 True 0.0 \n",
"2 172 True 0.0 \n",
"3 160 True 0.0 \n",
"4 28672 False 4.0 \n",
"5 8 False 5.0 \n",
"6 8192 False 6.0 \n",
"7 147456 True 7.0 \n",
"8 8 True 7.0 \n",
"9 158992 True 9.0 \n",
"10 23280 True 9.0 \n",
"11 0 True 9.0 \n",
"12 24576 True 9.0 \n",
"13 4848 True 12.0 \n",
"14 28672 True 16.0 \n",
"15 4 True 14.0 \n",
"16 158992 True 16.0 \n",
"17 2048 True 16.0 \n",
"18 0 False 18.0 \n",
"19 20480 False 19.0 "
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"data = pd.read_csv('stack_and_functions.csv')\n",
"\n",
"def convert_to_int(value):\n",
" try:\n",
" if isinstance(value, str) and value.startswith('0x'):\n",
" return int(value, 16)\n",
" else:\n",
" return int(value)\n",
" except ValueError:\n",
" return value \n",
"\n",
"data['start'] = data['start'].apply(convert_to_int)\n",
"data['end'] = data['end'].apply(convert_to_int)\n",
"data['size'] = data['end'] - data['start']\n",
"\n",
"data.sort_values(by=['size'], inplace=True, ascending=False)\n",
"data.sort_values(by=['start'], inplace=True)\n",
"\n",
"# Inverse the order of the data\n",
"data.reset_index(drop=True, inplace=True)\n",
"\n",
"data['overlap'] = False\n",
"\n",
"for i, row in data.iterrows():\n",
" for j, row2 in data.iterrows():\n",
" if i == j:\n",
" continue\n",
" if row['start'] <= row2['end'] and row['end'] > row2['start']:\n",
" if row['end'] - row['start'] >= row2['end'] - row2['start']:\n",
" continue\n",
" data.at[i, 'overlap'] = True\n",
" data.at[j, 'overlap'] = True\n",
" data.at[i, 'overlap_with'] = j\n",
"\n",
"data['overlap_with'] = data['overlap_with'].fillna(data.index.to_series())\n",
"data['overlap_with'] = data['overlap_with'].astype(float)\n",
"\n",
"# Send warnings if sizes are negative\n",
"if (data['size'] < 0).any():\n",
" print(f'Warning: Negative sizes detected at indices {data[data[\"size\"] < 0].index}')\n",
"\n",
"data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Inherent stacked block diagram"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"marker": {
"color": "#c5d177"
},
"mode": "text",
"name": "BootROM",
"text": "BootROM",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
0.5
]
},
{
"marker": {
"color": "#c5d177"
},
"mode": "text",
"showlegend": false,
"text": "0x20000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
3.84
]
},
{
"marker": {
"color": "#c5d177"
},
"mode": "text",
"showlegend": false,
"text": "0x0",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
0.14
]
},
{
"marker": {
"color": "#499e5c"
},
"mode": "text",
"name": "_jump_bl1",
"text": "_jump_bl1",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
1.52
]
},
{
"marker": {
"color": "#499e5c"
},
"mode": "text",
"showlegend": false,
"text": "0x2c4",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
1.7100000000000002
]
},
{
"marker": {
"color": "#499e5c"
},
"mode": "text",
"showlegend": false,
"text": "0x2c0",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
1.1600000000000001
]
},
{
"marker": {
"color": "#4099f8"
},
"mode": "text",
"name": "_boot_usb",
"text": "_boot_usb",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
2.52
]
},
{
"marker": {
"color": "#4099f8"
},
"mode": "text",
"showlegend": false,
"text": "0x658c",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
2.71
]
},
{
"marker": {
"color": "#4099f8"
},
"mode": "text",
"showlegend": false,
"text": "0x64e0",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
2.16
]
},
{
"marker": {
"color": "#d9a63f"
},
"mode": "text",
"name": "auth_bl1",
"text": "auth_bl1",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
3.52
]
},
{
"marker": {
"color": "#d9a63f"
},
"mode": "text",
"showlegend": false,
"text": "0x128e8",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
3.71
]
},
{
"marker": {
"color": "#d9a63f"
},
"mode": "text",
"showlegend": false,
"text": "0x12848",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
3.16
]
},
{
"marker": {
"color": "#a072e4"
},
"mode": "text",
"name": "Tried debugger space",
"text": "Tried debugger space",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
4.5
]
},
{
"marker": {
"color": "#a072e4"
},
"mode": "text",
"showlegend": false,
"text": "0x2020e5c",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
4.84
]
},
{
"marker": {
"color": "#a072e4"
},
"mode": "text",
"showlegend": false,
"text": "0x2019e5c",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
4.14
]
},
{
"marker": {
"color": "#c27742"
},
"mode": "text",
"name": "_boot_usb_ra",
"text": "_boot_usb_ra",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
5.5
]
},
{
"marker": {
"color": "#c27742"
},
"mode": "text",
"showlegend": false,
"text": "0x2020f68",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
5.84
]
},
{
"marker": {
"color": "#c27742"
},
"mode": "text",
"showlegend": false,
"text": "0x2020f60",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
5.14
]
},
{
"marker": {
"color": "#562aa3"
},
"mode": "text",
"name": "BL1",
"text": "BL1",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
6.5
]
},
{
"marker": {
"color": "#562aa3"
},
"mode": "text",
"showlegend": false,
"text": "0x2024000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
6.84
]
},
{
"marker": {
"color": "#562aa3"
},
"mode": "text",
"showlegend": false,
"text": "0x2022000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
6.14
]
},
{
"marker": {
"color": "#28fe90"
},
"mode": "text",
"name": "BL31",
"text": "BL31",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
7.5
]
},
{
"marker": {
"color": "#28fe90"
},
"mode": "text",
"showlegend": false,
"text": "0x2048000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
8.84
]
},
{
"marker": {
"color": "#28fe90"
},
"mode": "text",
"showlegend": false,
"text": "0x2024000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
7.14
]
},
{
"marker": {
"color": "#b502ce"
},
"mode": "text",
"name": "TTBR0_EL3 address ptr",
"text": "TTBR0_EL3 address ptr",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
8.52
]
},
{
"marker": {
"color": "#b502ce"
},
"mode": "text",
"showlegend": false,
"text": "0x2035608",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
8.709999999999999
]
},
{
"marker": {
"color": "#b502ce"
},
"mode": "text",
"showlegend": false,
"text": "0x2035600",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
8.16
]
},
{
"marker": {
"color": "#47822e"
},
"mode": "text",
"name": "BL2",
"text": "BL2",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
9.5
]
},
{
"marker": {
"color": "#47822e"
},
"mode": "text",
"showlegend": false,
"text": "0x206ed10",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
12.84
]
},
{
"marker": {
"color": "#47822e"
},
"mode": "text",
"showlegend": false,
"text": "0x2048000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
9.14
]
},
{
"marker": {
"color": "#1cf134"
},
"mode": "text",
"name": "BL2 empty space?",
"text": "BL2 empty space?",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
10.52
]
},
{
"marker": {
"color": "#1cf134"
},
"mode": "text",
"showlegend": false,
"text": "0x204daf0",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
10.709999999999999
]
},
{
"marker": {
"color": "#1cf134"
},
"mode": "text",
"showlegend": false,
"text": "0x2048000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
10.16
]
},
{
"marker": {
"color": "#211b09"
},
"mode": "text",
"name": "BL2 copy start/source",
"text": "BL2 copy start/source",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
11.52
]
},
{
"marker": {
"color": "#211b09"
},
"mode": "text",
"showlegend": false,
"text": "0x204eb00",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
11.709999999999999
]
},
{
"marker": {
"color": "#211b09"
},
"mode": "text",
"showlegend": false,
"text": "0x204eb00",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
11.16
]
},
{
"marker": {
"color": "#5dbcd0"
},
"mode": "text",
"name": "Debugger",
"text": "Debugger",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
12.52
]
},
{
"marker": {
"color": "#5dbcd0"
},
"mode": "text",
"showlegend": false,
"text": "0x206f000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
12.709999999999999
]
},
{
"marker": {
"color": "#5dbcd0"
},
"mode": "text",
"showlegend": false,
"text": "0x2069000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
12.16
]
},
{
"marker": {
"color": "#ce50ce"
},
"mode": "text",
"name": "End/Start peripheral space?",
"text": "End/Start peripheral space?",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
13.52
]
},
{
"marker": {
"color": "#ce50ce"
},
"mode": "text",
"showlegend": false,
"text": "0x2070000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
13.709999999999999
]
},
{
"marker": {
"color": "#ce50ce"
},
"mode": "text",
"showlegend": false,
"text": "0x206ed10",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
13.16
]
},
{
"marker": {
"color": "#08c36b"
},
"mode": "text",
"name": "Debugger relocated",
"text": "Debugger relocated",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
14.52
]
},
{
"marker": {
"color": "#08c36b"
},
"mode": "text",
"showlegend": false,
"text": "0x20c7000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
14.709999999999999
]
},
{
"marker": {
"color": "#08c36b"
},
"mode": "text",
"showlegend": false,
"text": "0x20c0000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
14.16
]
},
{
"marker": {
"color": "#f75c96"
},
"mode": "text",
"name": "_frederic_dest_ptr",
"text": "_frederic_dest_ptr",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
15.52
]
},
{
"marker": {
"color": "#f75c96"
},
"mode": "text",
"showlegend": false,
"text": "0x20c0004",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
15.709999999999999
]
},
{
"marker": {
"color": "#f75c96"
},
"mode": "text",
"showlegend": false,
"text": "0x20c0000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
15.16
]
},
{
"marker": {
"color": "#a6241b"
},
"mode": "text",
"name": "BL2 load address?",
"text": "BL2 load address?",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
16.5
]
},
{
"marker": {
"color": "#a6241b"
},
"mode": "text",
"showlegend": false,
"text": "0x20e8d10",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
18.84
]
},
{
"marker": {
"color": "#a6241b"
},
"mode": "text",
"showlegend": false,
"text": "0x20c2000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
16.14
]
},
{
"marker": {
"color": "#cb3a45"
},
"mode": "text",
"name": "modem_interface",
"text": "modem_interface",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
17.52
]
},
{
"marker": {
"color": "#cb3a45"
},
"mode": "text",
"showlegend": false,
"text": "0x20c8000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
17.71
]
},
{
"marker": {
"color": "#cb3a45"
},
"mode": "text",
"showlegend": false,
"text": "0x20c7800",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
17.16
]
},
{
"marker": {
"color": "#72dd99"
},
"mode": "text",
"name": "memread/write space",
"text": "memread/write space",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
18.5
]
},
{
"marker": {
"color": "#72dd99"
},
"mode": "text",
"showlegend": false,
"text": "0x11207010",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
18.84
]
},
{
"marker": {
"color": "#72dd99"
},
"mode": "text",
"showlegend": false,
"text": "0x11207010",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
18.14
]
},
{
"marker": {
"color": "#82c21a"
},
"mode": "text",
"name": "mali@14AC0000",
"text": "mali@14AC0000",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
19.5
]
},
{
"marker": {
"color": "#82c21a"
},
"mode": "text",
"showlegend": false,
"text": "0x14ac5000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
19.84
]
},
{
"marker": {
"color": "#82c21a"
},
"mode": "text",
"showlegend": false,
"text": "0x14ac0000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
19.14
]
}
],
"layout": {
"autosize": true,
"font": {
"size": 18
},
"height": 1200,
"legend": {
"title": {
"text": "Function/Locations"
}
},
"margin": {
"b": 20,
"l": 200,
"r": 20,
"t": 20
},
"shapes": [
{
"fillcolor": "#c5d177",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 0.9,
"x1": 4.1,
"y0": 0.08,
"y1": 3.92
},
{
"fillcolor": "#499e5c",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 1.1,
"y1": 1.79
},
{
"fillcolor": "#4099f8",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 2.1,
"y1": 2.79
},
{
"fillcolor": "#d9a63f",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 3.1,
"y1": 3.79
},
{
"fillcolor": "#a072e4",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 4.08,
"y1": 4.92
},
{
"fillcolor": "#c27742",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 5.08,
"y1": 5.92
},
{
"fillcolor": "#562aa3",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 6.08,
"y1": 6.92
},
{
"fillcolor": "#28fe90",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 0.9,
"x1": 4.1,
"y0": 7.08,
"y1": 8.92
},
{
"fillcolor": "#b502ce",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 8.1,
"y1": 8.79
},
{
"fillcolor": "#47822e",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 0.9,
"x1": 4.1,
"y0": 9.08,
"y1": 12.92
},
{
"fillcolor": "#1cf134",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 10.1,
"y1": 10.79
},
{
"fillcolor": "#211b09",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 11.1,
"y1": 11.79
},
{
"fillcolor": "#5dbcd0",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 12.1,
"y1": 12.79
},
{
"fillcolor": "#ce50ce",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 13.1,
"y1": 13.79
},
{
"fillcolor": "#08c36b",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 14.1,
"y1": 14.79
},
{
"fillcolor": "#f75c96",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 15.1,
"y1": 15.79
},
{
"fillcolor": "#a6241b",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 0.9,
"x1": 4.1,
"y0": 16.08,
"y1": 18.92
},
{
"fillcolor": "#cb3a45",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 17.099999999999998,
"y1": 17.790000000000003
},
{
"fillcolor": "#72dd99",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 18.08,
"y1": 18.92
},
{
"fillcolor": "#82c21a",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 19.08,
"y1": 19.92
}
],
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"fillpattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"width": 1200,
"xaxis": {
"range": [
0,
5
],
"showgrid": false,
"showticklabels": false,
"tickvals": [
0,
1,
2,
3,
4,
5
]
},
"yaxis": {
"autorange": "reversed",
"gridcolor": "black",
"griddash": "longdashdot",
"gridwidth": 0,
"showgrid": false,
"showticklabels": true,
"tickvals": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
]
}
}
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import plotly.graph_objects as go\n",
"import random\n",
"\n",
"tickpointers = []\n",
"vertical_len = len(data['overlap_with'].unique())\n",
"vertical_gap_percentage = 0.08\n",
"horizontal_gap = 0.1\n",
"labels = pd.DataFrame()\n",
"\n",
"def random_color():\n",
" return f'#{random.randint(0, 0xFFFFFF):06x}'\n",
"\n",
"fig = go.Figure()\n",
"\n",
"for i, d in data.iterrows():\n",
" fillcolor = random_color()\n",
" data.at[i, 'fillcolor'] = fillcolor\n",
" \n",
" x0=1\n",
" x1=4\n",
"\n",
" if d['overlap'] == False:\n",
" y0=d['overlap_with']\n",
" y1=d['overlap_with']+1\n",
" elif d['overlap'] == True:\n",
" overlaps = data.loc[data['overlap_with'] == d['overlap_with']].shape[0]\n",
"\n",
" # Calculate relative size of the overlap\n",
" overlap_sizes = data.loc[data['overlap_with'] == d['overlap_with']].iloc[1:]['size'].sum()\n",
"\n",
" if d['overlap_with'] == i:\n",
" y0=i\n",
" y1=overlaps+i\n",
" if i != data.shape[0]+1:\n",
" if d['end'] > data.iloc[i+1].start and d['end'] < data.iloc[i+1].end:\n",
" y1=overlaps+i-0.5\n",
" x0=x0-horizontal_gap\n",
" x1=x1+horizontal_gap\n",
" else:\n",
" y0=0.02+i\n",
" y1=0.87+i\n",
" else:\n",
" print(f'Something went wrong with {d}. Skipping')\n",
" continue\n",
"\n",
" fig.add_shape(\n",
" type=\"rect\",\n",
" x0=x0,\n",
" x1=x1,\n",
" y0=y0+vertical_gap_percentage,\n",
" y1=y1-vertical_gap_percentage,\n",
" line=dict(width=2),\n",
" fillcolor=fillcolor,\n",
" opacity=0.5,\n",
" layer=\"below\",\n",
" )\n",
"\n",
" # Add middle text\n",
" fig.add_trace(go.Scatter\n",
" (\n",
" x=[(x0+x1)/2],\n",
" y=[y0+0.5],\n",
" text=d['name'],\n",
" mode=\"text\",\n",
" textposition=\"middle center\",\n",
" name=d['name'],\n",
" marker=dict(\n",
" color=fillcolor,\n",
" ),\n",
" ))\n",
"\n",
" # Add top-left text with d['end']\n",
" fig.add_trace(go.Scatter\n",
" (\n",
" x=[(x0+0.14+horizontal_gap)],\n",
" y=[y1-0.16],\n",
" text=hex(d['end']),\n",
" mode=\"text\",\n",
" textposition=\"middle center\",\n",
" marker=dict(\n",
" color=fillcolor,\n",
" ),\n",
" showlegend=False,\n",
" ))\n",
"\n",
" # Add bottom-left text with d['end']\n",
" fig.add_trace(go.Scatter\n",
" (\n",
" x=[(x0+0.14+horizontal_gap)],\n",
" y=[y0+0.14],\n",
" text=hex(d['start']),\n",
" mode=\"text\",\n",
" textposition=\"middle center\",\n",
" marker=dict(\n",
" color=fillcolor,\n",
" ),\n",
" showlegend=False,\n",
" ))\n",
"\n",
"fig.update_xaxes(\n",
" range=[0, 5],\n",
" tickvals=[0, 1, 2, 3, 4, 5],\n",
")\n",
"\n",
"start_values = data['start'].sort_values()\n",
"end_values = data['end'].sort_values()\n",
"\n",
"labels = []\n",
"\n",
"for i, d in data.iterrows():\n",
" if i == 0:\n",
" labels.append(f'{hex(start_values.iloc[i])}')\n",
" elif i == len(data)-1:\n",
" labels.append(f'{hex(end_values.iloc[i])}')\n",
" else:\n",
" labels.append(f'{hex(start_values.iloc[i])}<br>{hex(end_values.iloc[i-1])}')\n",
"\n",
"tickpointers = [i for i in range(len(data))]\n",
"\n",
"fig.update_yaxes(\n",
" # tickvals=[i for i in range(len(data)+1)], \n",
" tickvals = tickpointers,\n",
" # ticktext= labels,\n",
" griddash=\"longdashdot\",\n",
" gridwidth=0,\n",
" gridcolor=\"black\",\n",
" showgrid=False,\n",
" showticklabels=True,\n",
" autorange='reversed',\n",
")\n",
"\n",
"fig.update_xaxes(\n",
" showgrid=False,\n",
" showticklabels=False,\n",
")\n",
"\n",
"fig.update_layout(\n",
" width=1200,\n",
" height=1200,\n",
" autosize=True,\n",
" margin=dict(l=200, r=20, t=20, b=20),\n",
" font=dict(\n",
" size=18,\n",
" ),\n",
" # Legend being the name of the function\n",
" legend_title_text=\"Function/Locations\",\n",
")\n",
"\n",
"fig.show()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Save to html\n",
"fig.write_html(\"../_static/stack_and_functions.html\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Layered blocks"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"marker": {
"color": "#4d799d"
},
"mode": "text",
"name": "BootROM",
"text": "BootROM",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
0.5
]
},
{
"marker": {
"color": "#4d799d"
},
"mode": "text",
"showlegend": false,
"text": "0x20000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
3.84
]
},
{
"marker": {
"color": "#4d799d"
},
"mode": "text",
"showlegend": false,
"text": "0x0",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
0.14
]
},
{
"marker": {
"color": "#6227bb"
},
"mode": "text",
"name": "_jump_bl1",
"text": "_jump_bl1",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
1.52
]
},
{
"marker": {
"color": "#6227bb"
},
"mode": "text",
"showlegend": false,
"text": "0x2c4",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
1.7100000000000002
]
},
{
"marker": {
"color": "#6227bb"
},
"mode": "text",
"showlegend": false,
"text": "0x2c0",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
1.1600000000000001
]
},
{
"marker": {
"color": "#ca9f41"
},
"mode": "text",
"name": "_boot_usb",
"text": "_boot_usb",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
2.52
]
},
{
"marker": {
"color": "#ca9f41"
},
"mode": "text",
"showlegend": false,
"text": "0x658c",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
2.71
]
},
{
"marker": {
"color": "#ca9f41"
},
"mode": "text",
"showlegend": false,
"text": "0x64e0",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
2.16
]
},
{
"marker": {
"color": "#66ee49"
},
"mode": "text",
"name": "auth_bl1",
"text": "auth_bl1",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
3.52
]
},
{
"marker": {
"color": "#66ee49"
},
"mode": "text",
"showlegend": false,
"text": "0x128e8",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
3.71
]
},
{
"marker": {
"color": "#66ee49"
},
"mode": "text",
"showlegend": false,
"text": "0x12848",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
3.16
]
},
{
"marker": {
"color": "#177126"
},
"mode": "text",
"name": "Tried debugger space",
"text": "Tried debugger space",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
4.5
]
},
{
"marker": {
"color": "#177126"
},
"mode": "text",
"showlegend": false,
"text": "0x2020e5c",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
4.84
]
},
{
"marker": {
"color": "#177126"
},
"mode": "text",
"showlegend": false,
"text": "0x2019e5c",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
4.14
]
},
{
"marker": {
"color": "#4825a4"
},
"mode": "text",
"name": "_boot_usb_ra",
"text": "_boot_usb_ra",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
5.5
]
},
{
"marker": {
"color": "#4825a4"
},
"mode": "text",
"showlegend": false,
"text": "0x2020f68",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
5.84
]
},
{
"marker": {
"color": "#4825a4"
},
"mode": "text",
"showlegend": false,
"text": "0x2020f60",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
5.14
]
},
{
"marker": {
"color": "#802d60"
},
"mode": "text",
"name": "BL1",
"text": "BL1",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
6.5
]
},
{
"marker": {
"color": "#802d60"
},
"mode": "text",
"showlegend": false,
"text": "0x2024000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
6.84
]
},
{
"marker": {
"color": "#802d60"
},
"mode": "text",
"showlegend": false,
"text": "0x2022000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
6.14
]
},
{
"marker": {
"color": "#702639"
},
"mode": "text",
"name": "BL31",
"text": "BL31",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
7.5
]
},
{
"marker": {
"color": "#702639"
},
"mode": "text",
"showlegend": false,
"text": "0x2048000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
8.84
]
},
{
"marker": {
"color": "#702639"
},
"mode": "text",
"showlegend": false,
"text": "0x2024000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
7.14
]
},
{
"marker": {
"color": "#17e67e"
},
"mode": "text",
"name": "TTBR0_EL3 address ptr",
"text": "TTBR0_EL3 address ptr",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
8.52
]
},
{
"marker": {
"color": "#17e67e"
},
"mode": "text",
"showlegend": false,
"text": "0x2035608",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
8.709999999999999
]
},
{
"marker": {
"color": "#17e67e"
},
"mode": "text",
"showlegend": false,
"text": "0x2035600",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
8.16
]
},
{
"marker": {
"color": "#15d246"
},
"mode": "text",
"name": "BL2",
"text": "BL2",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
9.5
]
},
{
"marker": {
"color": "#15d246"
},
"mode": "text",
"showlegend": false,
"text": "0x206ed10",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
12.84
]
},
{
"marker": {
"color": "#15d246"
},
"mode": "text",
"showlegend": false,
"text": "0x2048000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
9.14
]
},
{
"marker": {
"color": "#c6bbde"
},
"mode": "text",
"name": "BL2 empty space?",
"text": "BL2 empty space?",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
10.52
]
},
{
"marker": {
"color": "#c6bbde"
},
"mode": "text",
"showlegend": false,
"text": "0x204daf0",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
10.709999999999999
]
},
{
"marker": {
"color": "#c6bbde"
},
"mode": "text",
"showlegend": false,
"text": "0x2048000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
10.16
]
},
{
"marker": {
"color": "#f463a4"
},
"mode": "text",
"name": "BL2 copy start/source",
"text": "BL2 copy start/source",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
11.52
]
},
{
"marker": {
"color": "#f463a4"
},
"mode": "text",
"showlegend": false,
"text": "0x204eb00",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
11.709999999999999
]
},
{
"marker": {
"color": "#f463a4"
},
"mode": "text",
"showlegend": false,
"text": "0x204eb00",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
11.16
]
},
{
"marker": {
"color": "#7b6e6a"
},
"mode": "text",
"name": "Debugger",
"text": "Debugger",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
12.52
]
},
{
"marker": {
"color": "#7b6e6a"
},
"mode": "text",
"showlegend": false,
"text": "0x206f000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
12.709999999999999
]
},
{
"marker": {
"color": "#7b6e6a"
},
"mode": "text",
"showlegend": false,
"text": "0x2069000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
12.16
]
},
{
"marker": {
"color": "#959d59"
},
"mode": "text",
"name": "End/Start peripheral space?",
"text": "End/Start peripheral space?",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
13.52
]
},
{
"marker": {
"color": "#959d59"
},
"mode": "text",
"showlegend": false,
"text": "0x2070000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
13.709999999999999
]
},
{
"marker": {
"color": "#959d59"
},
"mode": "text",
"showlegend": false,
"text": "0x206ed10",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
13.16
]
},
{
"marker": {
"color": "#320cb3"
},
"mode": "text",
"name": "Debugger relocated",
"text": "Debugger relocated",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
14.52
]
},
{
"marker": {
"color": "#320cb3"
},
"mode": "text",
"showlegend": false,
"text": "0x20c7000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
14.709999999999999
]
},
{
"marker": {
"color": "#320cb3"
},
"mode": "text",
"showlegend": false,
"text": "0x20c0000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
14.16
]
},
{
"marker": {
"color": "#34d3c0"
},
"mode": "text",
"name": "_frederic_dest_ptr",
"text": "_frederic_dest_ptr",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
15.52
]
},
{
"marker": {
"color": "#34d3c0"
},
"mode": "text",
"showlegend": false,
"text": "0x20c0004",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
15.709999999999999
]
},
{
"marker": {
"color": "#34d3c0"
},
"mode": "text",
"showlegend": false,
"text": "0x20c0000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
15.16
]
},
{
"marker": {
"color": "#18a77f"
},
"mode": "text",
"name": "BL2 load address?",
"text": "BL2 load address?",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
16.5
]
},
{
"marker": {
"color": "#18a77f"
},
"mode": "text",
"showlegend": false,
"text": "0x20e8d10",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
18.84
]
},
{
"marker": {
"color": "#18a77f"
},
"mode": "text",
"showlegend": false,
"text": "0x20c2000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.1400000000000001
],
"y": [
16.14
]
},
{
"marker": {
"color": "#94e406"
},
"mode": "text",
"name": "modem_interface",
"text": "modem_interface",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
17.52
]
},
{
"marker": {
"color": "#94e406"
},
"mode": "text",
"showlegend": false,
"text": "0x20c8000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
17.71
]
},
{
"marker": {
"color": "#94e406"
},
"mode": "text",
"showlegend": false,
"text": "0x20c7800",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
17.16
]
},
{
"marker": {
"color": "#0d9b21"
},
"mode": "text",
"name": "memread/write space",
"text": "memread/write space",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
18.5
]
},
{
"marker": {
"color": "#0d9b21"
},
"mode": "text",
"showlegend": false,
"text": "0x11207010",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
18.84
]
},
{
"marker": {
"color": "#0d9b21"
},
"mode": "text",
"showlegend": false,
"text": "0x11207010",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
18.14
]
},
{
"marker": {
"color": "#a3a534"
},
"mode": "text",
"name": "mali@14AC0000",
"text": "mali@14AC0000",
"textposition": "middle center",
"type": "scatter",
"x": [
2.5
],
"y": [
19.5
]
},
{
"marker": {
"color": "#a3a534"
},
"mode": "text",
"showlegend": false,
"text": "0x14ac5000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
19.84
]
},
{
"marker": {
"color": "#a3a534"
},
"mode": "text",
"showlegend": false,
"text": "0x14ac0000",
"textposition": "middle center",
"type": "scatter",
"x": [
1.2400000000000002
],
"y": [
19.14
]
}
],
"layout": {
"autosize": true,
"font": {
"size": 18
},
"height": 1200,
"legend": {
"title": {
"text": "Function/Locations"
}
},
"margin": {
"b": 20,
"l": 200,
"r": 20,
"t": 20
},
"shapes": [
{
"fillcolor": "#4d799d",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 0.9,
"x1": 4.1,
"y0": 0.08,
"y1": 3.92
},
{
"fillcolor": "#6227bb",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 1.1,
"y1": 1.79
},
{
"fillcolor": "#ca9f41",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 2.1,
"y1": 2.79
},
{
"fillcolor": "#66ee49",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 3.1,
"y1": 3.79
},
{
"fillcolor": "#177126",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 4.08,
"y1": 4.92
},
{
"fillcolor": "#4825a4",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 5.08,
"y1": 5.92
},
{
"fillcolor": "#802d60",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 6.08,
"y1": 6.92
},
{
"fillcolor": "#702639",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 0.9,
"x1": 4.1,
"y0": 7.08,
"y1": 8.92
},
{
"fillcolor": "#17e67e",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 8.1,
"y1": 8.79
},
{
"fillcolor": "#15d246",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 0.9,
"x1": 4.1,
"y0": 9.08,
"y1": 12.92
},
{
"fillcolor": "#c6bbde",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 10.1,
"y1": 10.79
},
{
"fillcolor": "#f463a4",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 11.1,
"y1": 11.79
},
{
"fillcolor": "#7b6e6a",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 12.1,
"y1": 12.79
},
{
"fillcolor": "#959d59",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 13.1,
"y1": 13.79
},
{
"fillcolor": "#320cb3",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 14.1,
"y1": 14.79
},
{
"fillcolor": "#34d3c0",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 15.1,
"y1": 15.79
},
{
"fillcolor": "#18a77f",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 0.9,
"x1": 4.1,
"y0": 16.08,
"y1": 18.92
},
{
"fillcolor": "#94e406",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 17.099999999999998,
"y1": 17.790000000000003
},
{
"fillcolor": "#0d9b21",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 18.08,
"y1": 18.92
},
{
"fillcolor": "#a3a534",
"layer": "below",
"line": {
"width": 2
},
"opacity": 0.5,
"type": "rect",
"x0": 1,
"x1": 4,
"y0": 19.08,
"y1": 19.92
}
],
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"fillpattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"width": 1200,
"xaxis": {
"range": [
0,
5
],
"showgrid": false,
"showticklabels": false,
"tickvals": [
0,
1,
2,
3,
4,
5
]
},
"yaxis": {
"autorange": "reversed",
"gridcolor": "black",
"griddash": "longdashdot",
"gridwidth": 0,
"showgrid": false,
"showticklabels": true,
"tickvals": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
]
}
}
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import plotly.graph_objects as go\n",
"import random\n",
"\n",
"tickpointers = []\n",
"vertical_len = len(data['overlap_with'].unique())\n",
"vertical_gap_percentage = 0.08\n",
"horizontal_gap = 0.1\n",
"labels = pd.DataFrame()\n",
"\n",
"def random_color():\n",
" return f'#{random.randint(0, 0xFFFFFF):06x}'\n",
"\n",
"fig = go.Figure()\n",
"\n",
"for i, d in data.iterrows():\n",
" fillcolor = random_color()\n",
" data.at[i, 'fillcolor'] = fillcolor\n",
" \n",
" x0=1\n",
" x1=4\n",
"\n",
" if d['overlap'] == False:\n",
" y0=d['overlap_with']\n",
" y1=d['overlap_with']+1\n",
" elif d['overlap'] == True:\n",
" overlaps = data.loc[data['overlap_with'] == d['overlap_with']].shape[0]\n",
"\n",
" # Calculate relative size of the overlap\n",
" overlap_sizes = data.loc[data['overlap_with'] == d['overlap_with']].iloc[1:]['size'].sum()\n",
"\n",
" if d['overlap_with'] == i:\n",
" y0=i\n",
" y1=overlaps+i\n",
" if i != data.shape[0]+1:\n",
" if d['end'] > data.iloc[i+1].start and d['end'] < data.iloc[i+1].end:\n",
" y1=overlaps+i-0.5\n",
" x0=x0-horizontal_gap\n",
" x1=x1+horizontal_gap\n",
" else:\n",
" y0=0.02+i\n",
" y1=0.87+i\n",
" else:\n",
" print(f'Something went wrong with {d}. Skipping')\n",
" continue\n",
"\n",
" fig.add_shape(\n",
" type=\"rect\",\n",
" x0=x0,\n",
" x1=x1,\n",
" y0=y0+vertical_gap_percentage,\n",
" y1=y1-vertical_gap_percentage,\n",
" line=dict(width=2),\n",
" fillcolor=fillcolor,\n",
" opacity=0.5,\n",
" layer=\"below\",\n",
" )\n",
"\n",
" # Add middle text\n",
" fig.add_trace(go.Scatter\n",
" (\n",
" x=[(x0+x1)/2],\n",
" y=[y0+0.5],\n",
" text=d['name'],\n",
" mode=\"text\",\n",
" textposition=\"middle center\",\n",
" name=d['name'],\n",
" marker=dict(\n",
" color=fillcolor,\n",
" ),\n",
" ))\n",
"\n",
" # Add top-left text with d['end']\n",
" fig.add_trace(go.Scatter\n",
" (\n",
" x=[(x0+0.14+horizontal_gap)],\n",
" y=[y1-0.16],\n",
" text=hex(d['end']),\n",
" mode=\"text\",\n",
" textposition=\"middle center\",\n",
" marker=dict(\n",
" color=fillcolor,\n",
" ),\n",
" showlegend=False,\n",
" ))\n",
"\n",
" # Add bottom-left text with d['end']\n",
" fig.add_trace(go.Scatter\n",
" (\n",
" x=[(x0+0.14+horizontal_gap)],\n",
" y=[y0+0.14],\n",
" text=hex(d['start']),\n",
" mode=\"text\",\n",
" textposition=\"middle center\",\n",
" marker=dict(\n",
" color=fillcolor,\n",
" ),\n",
" showlegend=False,\n",
" ))\n",
"\n",
"fig.update_xaxes(\n",
" range=[0, 5],\n",
" tickvals=[0, 1, 2, 3, 4, 5],\n",
")\n",
"\n",
"start_values = data['start'].sort_values()\n",
"end_values = data['end'].sort_values()\n",
"\n",
"labels = []\n",
"\n",
"for i, d in data.iterrows():\n",
" if i == 0:\n",
" labels.append(f'{hex(start_values.iloc[i])}')\n",
" elif i == len(data)-1:\n",
" labels.append(f'{hex(end_values.iloc[i])}')\n",
" else:\n",
" labels.append(f'{hex(start_values.iloc[i])}<br>{hex(end_values.iloc[i-1])}')\n",
"\n",
"tickpointers = [i for i in range(len(data))]\n",
"\n",
"fig.update_yaxes(\n",
" # tickvals=[i for i in range(len(data)+1)], \n",
" tickvals = tickpointers,\n",
" # ticktext= labels,\n",
" griddash=\"longdashdot\",\n",
" gridwidth=0,\n",
" gridcolor=\"black\",\n",
" showgrid=False,\n",
" showticklabels=True,\n",
" autorange='reversed',\n",
")\n",
"\n",
"fig.update_xaxes(\n",
" showgrid=False,\n",
" showticklabels=False,\n",
")\n",
"\n",
"fig.update_layout(\n",
" width=1200,\n",
" height=1200,\n",
" autosize=True,\n",
" margin=dict(l=200, r=20, t=20, b=20),\n",
" font=dict(\n",
" size=18,\n",
" ),\n",
" # Legend being the name of the function\n",
" legend_title_text=\"Function/Locations\",\n",
")\n",
"\n",
"fig.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}