diff --git a/README.md b/README.md index f9fe593..a61f8bf 100644 --- a/README.md +++ b/README.md @@ -5,47 +5,79 @@ Tool for generating diagrams that show the mapping of regions in memory, specifc || |:-:| -|![](doc/example/example_normal_diagram.png)| -|![](doc/example/example_normal_table.png)| +|![](doc/example/example_two_maps_diagram.png)| +|![](doc/example/example_two_maps_table.png)| + +### Features + +- Regions are plotted onto a diagram. Freespace is measured and put into the accompanying table. +- Region collisions are highlighted on the diagram and in the accompnaying table. The table will detail which regions have collided as well as related measurements. + + ![](doc/example/example_region_collisions_diagram.png) + ![](doc/example/example_region_collisions_table.png) + +- The output is available as: + - separate images for diagram and table. + - markdown table with inline diagram image. +- Command line and JSON input are supported. NOTE: Command line input has a limited subset of features compared to JSON input.. Some extra features available with JSON input are: + - Multi map support with links + - All graphic properties are available + - Max address and diagram size + +- Diagram width and height can be specified using JSON. The contents will be automatically draw to the correct scale within the requested diagram size. If height is not set then the correct height will be calculated from the region data. NOTE: Command line input can ONLY set both the diagram height and max address simulataneously using the 'limit' option. +- Max address can be set using JSON. If this is higher than the diagram height, the contents will be scaled. If regions exceed this max address, the collision will be highlighted both in the diagram and table. + + ![](doc/example/example_end_collision_diagram.png) + ![](doc/example/example_end_collision_table.png) + + If max address is not set then the diagram height will be used. NOTE: Command line input can ONLY set both the diagram height and max address simulataneously using the 'limit' option. + +- Many additional settings are available in the JSON input. Please see the [schema](mm/schema.json) for more information. -As well as the `png` format diagram image, a `markdown` report is also created: -- inline image of the diagram -- collision data table More examples can be found in [doc/example/main.md](doc/example/main.md) ### Usage: ``` -usage: diagram.py [-h] [-o OUT] [-l LIMIT] [-s SCALE] [-v VOIDTHRESHOLD] [regions ...] +python3 -m mm.diagram -h +``` -usage: diagram.py [-h] [-o OUT] [-l LIMIT] [-t THRESHOLD] [-n NAME] [-f FILE] [regions ...] +``` +usage: diagram.py [-h] [-o OUT] [-l LIMIT] [-t THRESHOLD] [-n NAME] [-f FILE] [-v] [--no_whitespace_trim] [regions ...] Generate a diagram showing how binary regions co-exist within memory. positional arguments: - regions command line input for regions should be tuples of name, origin and size. + regions Sequence of region data. Should be tuples of name, origin and size: options: -h, --help show this help message and exit - -o OUT, --out OUT path to the markdown output report file. Default: "out/report.md" + -o OUT, --out OUT The path to the markdown output report file. Diagram and table images will be written using this path and name (using png extension). Default: + 'out/report.md' -l LIMIT, --limit LIMIT - The height for the diagram. Please use hex. Memory regions exceeding this height will be - scaled to fit. Ignored when using JSON file input. + The 'height' in pixels and 'max address' in bytes for the diagram. Please use hex format. Ignored when using JSON file input. Memory regions exceeding + this value will be scaled to fit when drawn but collision measurements will use the original value. If you need to set 'height' and 'max address' to + different values, please use the JSON input file instead. -t THRESHOLD, --threshold THRESHOLD - The threshold for skipping void sections. Please use hex. + The threshold for replacing large empty sections with 'SKIPPED' regions. Any space over this value will be replaced. Please use hex. Default = 0x16 -n NAME, --name NAME Provide a name for the memory map. Ignored when JSON file is provided. - -f FILE, --file FILE JSON input file for multiple memory maps (and links) support. Please see - doc/example/input.json for help. + -f FILE, --file FILE JSON input file for multiple memory maps (and links) support. Please see doc/example for help. + -v Enable debug output. + --no_whitespace_trim Force disable of whitespace trim in diagram images. If this option is set, diagram images may be created larger than requested. ``` -- Generate five regions called `kernel`, `rootfs`, `dtb`, `uboot` and `uboot-scr` where four of the five regions intersect/collide. The default report output path is used. Diagram output is shown at the top of the page. +#### Examples + +- Generate five regions called `kernel`, `rootfs`, `dtb`, `uboot` and `uboot-scr` where four of the five regions intersect/collide. The default report output path is used. ``` - python3 -m mm.diagram kernel 0x10 0x50 rootfs 0x50 0x30 dtb 0x90 0x30 uboot 0xD0 0x50 uboot-scr 0x110 0x30 + python3 -m mm.diagram kernel 0x10 0x50 rootfs 0x50 0x30 dtb 0x90 0x30 uboot 0xD0 0x50 uboot-scr 0x110 0x30 -l 0x3e8 ``` -- Using JSON the same options (plus many others) can be set. See example files in [doc/example](doc/example) folder. - +- Using JSON many other options can be set. See json files in [doc/example](doc/example) folder. + ``` + python3 -m mm.diagram -f doc/example/input.json + ``` diff --git a/doc/example/A3_maxaddress_lower_than_memregions.md b/doc/example/A3_maxaddress_lower_than_memregions.md index b22911e..35583dc 100644 --- a/doc/example/A3_maxaddress_lower_than_memregions.md +++ b/doc/example/A3_maxaddress_lower_than_memregions.md @@ -1,9 +1,9 @@ ![memory map diagram](A3_maxaddress_lower_than_memregions_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|2:1| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0x3b1 (945)|||1:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||1:1| +|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|2:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0x3b1 (945)|||1:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||1:1| --- #### Global System Address Map: diff --git a/doc/example/A3_maxaddress_lower_than_memregions_diagram.png b/doc/example/A3_maxaddress_lower_than_memregions_diagram.png index 23a027c..210dca6 100644 Binary files a/doc/example/A3_maxaddress_lower_than_memregions_diagram.png and b/doc/example/A3_maxaddress_lower_than_memregions_diagram.png differ diff --git a/doc/example/A3_region_exceeds_height-no_maxaddress_set.md b/doc/example/A3_region_exceeds_height-no_maxaddress_set.md index 197f676..fc028e0 100644 --- a/doc/example/A3_region_exceeds_height-no_maxaddress_set.md +++ b/doc/example/A3_region_exceeds_height-no_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A3_region_exceeds_height-no_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0x3b1 (945)|||1:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||1:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xffec9e (-16772254)| end @ 0x1361 ||3382:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0x3b1 (945)|||1:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||1:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xffec9e (-16772254)| end @ 0x1361 ||3382:1| --- #### Global System Address Map: diff --git a/doc/example/A3_region_exceeds_height-no_maxaddress_set_diagram.png b/doc/example/A3_region_exceeds_height-no_maxaddress_set_diagram.png index 65b711f..726a0a0 100644 Binary files a/doc/example/A3_region_exceeds_height-no_maxaddress_set_diagram.png and b/doc/example/A3_region_exceeds_height-no_maxaddress_set_diagram.png differ diff --git a/doc/example/A3_region_freespace_exceeds_height-higher_maxaddress_set.md b/doc/example/A3_region_freespace_exceeds_height-higher_maxaddress_set.md index c0a70c9..e33dca7 100644 --- a/doc/example/A3_region_freespace_exceeds_height-higher_maxaddress_set.md +++ b/doc/example/A3_region_freespace_exceeds_height-higher_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A3_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||1:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||1:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||3544:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||1:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||1:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||3544:1| --- #### Global System Address Map: diff --git a/doc/example/A3_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png b/doc/example/A3_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png index 768f370..e29cd8a 100644 Binary files a/doc/example/A3_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png and b/doc/example/A3_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png differ diff --git a/doc/example/A4_maxaddress_lower_than_memregions.md b/doc/example/A4_maxaddress_lower_than_memregions.md index e8ed0f3..16b3e70 100644 --- a/doc/example/A4_maxaddress_lower_than_memregions.md +++ b/doc/example/A4_maxaddress_lower_than_memregions.md @@ -1,9 +1,9 @@ ![memory map diagram](A4_maxaddress_lower_than_memregions_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|2:1| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x1fc (-508)| end @ 0xdb4 ||2:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| +|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|2:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x1fc (-508)| end @ 0xdb4 ||2:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| --- #### Global System Address Map: diff --git a/doc/example/A4_maxaddress_lower_than_memregions_diagram.png b/doc/example/A4_maxaddress_lower_than_memregions_diagram.png index 978240e..5118979 100644 Binary files a/doc/example/A4_maxaddress_lower_than_memregions_diagram.png and b/doc/example/A4_maxaddress_lower_than_memregions_diagram.png differ diff --git a/doc/example/A4_region_exceeds_height-no_maxaddress_set.md b/doc/example/A4_region_exceeds_height-no_maxaddress_set.md index 51f5c1b..4cf15cb 100644 --- a/doc/example/A4_region_exceeds_height-no_maxaddress_set.md +++ b/doc/example/A4_region_exceeds_height-no_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A4_region_exceeds_height-no_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x1fc (-508)| end @ 0xdb4 ||2:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfff24b (-16773707)| end @ 0xdb4 ||4783:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x1fc (-508)| end @ 0xdb4 ||2:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfff24b (-16773707)| end @ 0xdb4 ||4783:1| --- #### Global System Address Map: diff --git a/doc/example/A4_region_exceeds_height-no_maxaddress_set_diagram.png b/doc/example/A4_region_exceeds_height-no_maxaddress_set_diagram.png index fa26f8b..400c59f 100644 Binary files a/doc/example/A4_region_exceeds_height-no_maxaddress_set_diagram.png and b/doc/example/A4_region_exceeds_height-no_maxaddress_set_diagram.png differ diff --git a/doc/example/A4_region_freespace_exceeds_height-higher_maxaddress_set.md b/doc/example/A4_region_freespace_exceeds_height-higher_maxaddress_set.md index c1d2f41..ddf8c25 100644 --- a/doc/example/A4_region_freespace_exceeds_height-higher_maxaddress_set.md +++ b/doc/example/A4_region_freespace_exceeds_height-higher_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A4_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||2:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||5011:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||2:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||5011:1| --- #### Global System Address Map: diff --git a/doc/example/A4_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png b/doc/example/A4_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png index c9ef6cb..b2f6a1b 100644 Binary files a/doc/example/A4_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png and b/doc/example/A4_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png differ diff --git a/doc/example/A5_maxaddress_lower_than_memregions.md b/doc/example/A5_maxaddress_lower_than_memregions.md index 879096f..73b0369 100644 --- a/doc/example/A5_maxaddress_lower_than_memregions.md +++ b/doc/example/A5_maxaddress_lower_than_memregions.md @@ -1,9 +1,9 @@ ![memory map diagram](A5_maxaddress_lower_than_memregions_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|3:1| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x600 (-1536)| end @ 0x9b0 ||2:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| +|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|3:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x600 (-1536)| end @ 0x9b0 ||2:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| --- #### Global System Address Map: diff --git a/doc/example/A5_maxaddress_lower_than_memregions_diagram.png b/doc/example/A5_maxaddress_lower_than_memregions_diagram.png index 92196dc..2d646e1 100644 Binary files a/doc/example/A5_maxaddress_lower_than_memregions_diagram.png and b/doc/example/A5_maxaddress_lower_than_memregions_diagram.png differ diff --git a/doc/example/A5_region_exceeds_height-no_maxaddress_set.md b/doc/example/A5_region_exceeds_height-no_maxaddress_set.md index d7e848f..624cbb2 100644 --- a/doc/example/A5_region_exceeds_height-no_maxaddress_set.md +++ b/doc/example/A5_region_exceeds_height-no_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A5_region_exceeds_height-no_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x600 (-1536)| end @ 0x9b0 ||2:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfff64f (-16774735)| end @ 0x9b0 ||6766:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x600 (-1536)| end @ 0x9b0 ||2:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfff64f (-16774735)| end @ 0x9b0 ||6766:1| --- #### Global System Address Map: diff --git a/doc/example/A5_region_exceeds_height-no_maxaddress_set_diagram.png b/doc/example/A5_region_exceeds_height-no_maxaddress_set_diagram.png index 1bdfd19..350e383 100644 Binary files a/doc/example/A5_region_exceeds_height-no_maxaddress_set_diagram.png and b/doc/example/A5_region_exceeds_height-no_maxaddress_set_diagram.png differ diff --git a/doc/example/A5_region_freespace_exceeds_height-higher_maxaddress_set.md b/doc/example/A5_region_freespace_exceeds_height-higher_maxaddress_set.md index 1598ebb..4facea5 100644 --- a/doc/example/A5_region_freespace_exceeds_height-higher_maxaddress_set.md +++ b/doc/example/A5_region_freespace_exceeds_height-higher_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A5_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||2:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||7088:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||2:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||2:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||7088:1| --- #### Global System Address Map: diff --git a/doc/example/A5_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png b/doc/example/A5_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png index e8bbcb9..8022c5f 100644 Binary files a/doc/example/A5_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png and b/doc/example/A5_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png differ diff --git a/doc/example/A6_maxaddress_lower_than_memregions.md b/doc/example/A6_maxaddress_lower_than_memregions.md index 04ecbe5..1c37880 100644 --- a/doc/example/A6_maxaddress_lower_than_memregions.md +++ b/doc/example/A6_maxaddress_lower_than_memregions.md @@ -1,9 +1,9 @@ ![memory map diagram](A6_maxaddress_lower_than_memregions_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|3:1| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x8dc (-2268)| end @ 0x6d4 ||3:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||3:1| +|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|3:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x8dc (-2268)| end @ 0x6d4 ||3:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||3:1| --- #### Global System Address Map: diff --git a/doc/example/A6_maxaddress_lower_than_memregions_diagram.png b/doc/example/A6_maxaddress_lower_than_memregions_diagram.png index 97ccd79..85deaaa 100644 Binary files a/doc/example/A6_maxaddress_lower_than_memregions_diagram.png and b/doc/example/A6_maxaddress_lower_than_memregions_diagram.png differ diff --git a/doc/example/A6_region_exceeds_height-no_maxaddress_set.md b/doc/example/A6_region_exceeds_height-no_maxaddress_set.md index b1a990d..1b895ca 100644 --- a/doc/example/A6_region_exceeds_height-no_maxaddress_set.md +++ b/doc/example/A6_region_exceeds_height-no_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A6_region_exceeds_height-no_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x8dc (-2268)| end @ 0x6d4 ||3:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||3:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfff92b (-16775467)| end @ 0x6d4 ||9598:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0x8dc (-2268)| end @ 0x6d4 ||3:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||3:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfff92b (-16775467)| end @ 0x6d4 ||9598:1| --- #### Global System Address Map: diff --git a/doc/example/A6_region_exceeds_height-no_maxaddress_set_diagram.png b/doc/example/A6_region_exceeds_height-no_maxaddress_set_diagram.png index ce51555..bd20433 100644 Binary files a/doc/example/A6_region_exceeds_height-no_maxaddress_set_diagram.png and b/doc/example/A6_region_exceeds_height-no_maxaddress_set_diagram.png differ diff --git a/doc/example/A6_region_freespace_exceeds_height-higher_maxaddress_set.md b/doc/example/A6_region_freespace_exceeds_height-higher_maxaddress_set.md index 7a9bb94..590ed48 100644 --- a/doc/example/A6_region_freespace_exceeds_height-higher_maxaddress_set.md +++ b/doc/example/A6_region_freespace_exceeds_height-higher_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A6_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||3:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||3:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||10056:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||3:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||3:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||10056:1| --- #### Global System Address Map: diff --git a/doc/example/A6_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png b/doc/example/A6_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png index 51b9acf..432fc5f 100644 Binary files a/doc/example/A6_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png and b/doc/example/A6_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png differ diff --git a/doc/example/A7_maxaddress_lower_than_memregions.md b/doc/example/A7_maxaddress_lower_than_memregions.md index fcac7f1..4d557da 100644 --- a/doc/example/A7_maxaddress_lower_than_memregions.md +++ b/doc/example/A7_maxaddress_lower_than_memregions.md @@ -1,9 +1,9 @@ ![memory map diagram](A7_maxaddress_lower_than_memregions_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|5:1| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0xad8 (-2776)| end @ 0x4d8 ||4:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||4:1| +|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|5:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0xad8 (-2776)| end @ 0x4d8 ||4:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||4:1| --- #### Global System Address Map: diff --git a/doc/example/A7_maxaddress_lower_than_memregions_diagram.png b/doc/example/A7_maxaddress_lower_than_memregions_diagram.png index b6cd71d..d9c44c9 100644 Binary files a/doc/example/A7_maxaddress_lower_than_memregions_diagram.png and b/doc/example/A7_maxaddress_lower_than_memregions_diagram.png differ diff --git a/doc/example/A7_region_exceeds_height-no_maxaddress_set.md b/doc/example/A7_region_exceeds_height-no_maxaddress_set.md index 9ea0c10..08301ba 100644 --- a/doc/example/A7_region_exceeds_height-no_maxaddress_set.md +++ b/doc/example/A7_region_exceeds_height-no_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A7_region_exceeds_height-no_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0xad8 (-2776)| end @ 0x4d8 ||4:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||4:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfffb27 (-16775975)| end @ 0x4d8 ||13531:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0xad8 (-2776)| end @ 0x4d8 ||4:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||4:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfffb27 (-16775975)| end @ 0x4d8 ||13531:1| --- #### Global System Address Map: diff --git a/doc/example/A7_region_exceeds_height-no_maxaddress_set_diagram.png b/doc/example/A7_region_exceeds_height-no_maxaddress_set_diagram.png index 70ee08f..cefe0ca 100644 Binary files a/doc/example/A7_region_exceeds_height-no_maxaddress_set_diagram.png and b/doc/example/A7_region_exceeds_height-no_maxaddress_set_diagram.png differ diff --git a/doc/example/A7_region_freespace_exceeds_height-higher_maxaddress_set.md b/doc/example/A7_region_freespace_exceeds_height-higher_maxaddress_set.md index 063f5ed..415fad4 100644 --- a/doc/example/A7_region_freespace_exceeds_height-higher_maxaddress_set.md +++ b/doc/example/A7_region_freespace_exceeds_height-higher_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A7_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||4:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||4:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||14176:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||4:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||4:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||14176:1| --- #### Global System Address Map: diff --git a/doc/example/A7_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png b/doc/example/A7_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png index eb5929f..dd89203 100644 Binary files a/doc/example/A7_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png and b/doc/example/A7_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png differ diff --git a/doc/example/A8_maxaddress_lower_than_memregions.md b/doc/example/A8_maxaddress_lower_than_memregions.md index 736f639..2d9a011 100644 --- a/doc/example/A8_maxaddress_lower_than_memregions.md +++ b/doc/example/A8_maxaddress_lower_than_memregions.md @@ -1,9 +1,9 @@ ![memory map diagram](A8_maxaddress_lower_than_memregions_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|6:1| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0xc46 (-3142)| end @ 0x36a ||5:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|-0x8e (-142)| end @ 0x36a ||5:1| +|Boot Image (Flash)|0xbb8 (3000)|0x7d0 (2000)|-0xbb8 (-3000)| end @ 0x7d0 |('Global System Address Map', 'OCM')|6:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0xc46 (-3142)| end @ 0x36a ||5:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|-0x8e (-142)| end @ 0x36a ||5:1| --- #### Global System Address Map: diff --git a/doc/example/A8_maxaddress_lower_than_memregions_diagram.png b/doc/example/A8_maxaddress_lower_than_memregions_diagram.png index fc38119..f5ed38b 100644 Binary files a/doc/example/A8_maxaddress_lower_than_memregions_diagram.png and b/doc/example/A8_maxaddress_lower_than_memregions_diagram.png differ diff --git a/doc/example/A8_region_exceeds_height-no_maxaddress_set.md b/doc/example/A8_region_exceeds_height-no_maxaddress_set.md index f815a08..d470c46 100644 --- a/doc/example/A8_region_exceeds_height-no_maxaddress_set.md +++ b/doc/example/A8_region_exceeds_height-no_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A8_region_exceeds_height-no_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0xc46 (-3142)| end @ 0x36a ||5:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|-0x8e (-142)| end @ 0x36a ||5:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfffc95 (-16776341)| end @ 0x36a ||19196:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|-0xc46 (-3142)| end @ 0x36a ||5:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|-0x8e (-142)| end @ 0x36a ||5:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|-0xfffc95 (-16776341)| end @ 0x36a ||19196:1| --- #### Global System Address Map: diff --git a/doc/example/A8_region_exceeds_height-no_maxaddress_set_diagram.png b/doc/example/A8_region_exceeds_height-no_maxaddress_set_diagram.png index 123230e..6aebe2a 100644 Binary files a/doc/example/A8_region_exceeds_height-no_maxaddress_set_diagram.png and b/doc/example/A8_region_exceeds_height-no_maxaddress_set_diagram.png differ diff --git a/doc/example/A8_region_freespace_exceeds_height-higher_maxaddress_set.md b/doc/example/A8_region_freespace_exceeds_height-higher_maxaddress_set.md index 83ec2f0..1466c60 100644 --- a/doc/example/A8_region_freespace_exceeds_height-higher_maxaddress_set.md +++ b/doc/example/A8_region_freespace_exceeds_height-higher_maxaddress_set.md @@ -1,9 +1,9 @@ ![memory map diagram](A8_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||5:1| -|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||5:1| -|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||20112:1| +|OCM (Global System Address Map)|0x7e0 (2016)|0x7d0 (2000)|0xfffff04f (4294963279)|||5:1| +|DDR Memory Controller (Global System Address Map)|0x10 (16)|0x3e8 (1000)|0x3e8 (1000)|||5:1| +|Boot Image (Flash)|0x0 (0)|0xffffff (16777215)|0xff000000 (4278190080)|||20112:1| --- #### Global System Address Map: diff --git a/doc/example/A8_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png b/doc/example/A8_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png index fe164b5..0a4215a 100644 Binary files a/doc/example/A8_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png and b/doc/example/A8_region_freespace_exceeds_height-higher_maxaddress_set_diagram.png differ diff --git a/doc/example/example_collisions.md b/doc/example/example_collisions.md deleted file mode 100644 index 65ff36e..0000000 --- a/doc/example/example_collisions.md +++ /dev/null @@ -1,11 +0,0 @@ -![memory map diagram](example_collisions_diagram.png) -|region (parent)|origin|size|free Space|collisions|links|draw scale| -|:-|:-|:-|:-|:-|:-|:-| -|dtb (Untitled)|0x90 (144)|0x30 (48)|0x2aa (682)| rootfs @ 0x90 ||1:1| -|rootfs (Untitled)|0x50 (80)|0x50 (80)|-0x10 (-16)| kernel @ 0x50
dtb @ 0x90 ||1:1| -|kernel (Untitled)|0x10 (16)|0x60 (96)|-0x20 (-32)| rootfs @ 0x50 ||1:1| - ---- -#### Untitled: -- max address = 0x36A (874) -- User-defined input \ No newline at end of file diff --git a/doc/example/example_collisions_diagram.png b/doc/example/example_collisions_diagram.png deleted file mode 100644 index 5e3ab61..0000000 Binary files a/doc/example/example_collisions_diagram.png and /dev/null differ diff --git a/doc/example/example_collisions_table.png b/doc/example/example_collisions_table.png deleted file mode 100644 index 0f58773..0000000 Binary files a/doc/example/example_collisions_table.png and /dev/null differ diff --git a/doc/example/example_end_collision.md b/doc/example/example_end_collision.md new file mode 100644 index 0000000..a51da46 --- /dev/null +++ b/doc/example/example_end_collision.md @@ -0,0 +1,11 @@ +![memory map diagram](example_end_collision_diagram.png) +|region (parent)|origin|size|free Space|collisions|links|draw scale| +|:-|:-|:-|:-|:-|:-|:-| +|dtb (Untitled)|0x190 (400)|0x30 (48)|-0xb (-11)| end @ 0x1b5 ||2:1| +|rootfs (Untitled)|0x50 (80)|0x30 (48)|0x110 (272)|||2:1| +|kernel (Untitled)|0x10 (16)|0x30 (48)|0x10 (16)|||2:1| + +--- +#### Untitled: +- max address = 0x1B5 (437) +- User-defined input \ No newline at end of file diff --git a/doc/example/example_end_collision_diagram.png b/doc/example/example_end_collision_diagram.png new file mode 100644 index 0000000..ca891ab Binary files /dev/null and b/doc/example/example_end_collision_diagram.png differ diff --git a/doc/example/example_end_collision_table.png b/doc/example/example_end_collision_table.png new file mode 100644 index 0000000..fde988c Binary files /dev/null and b/doc/example/example_end_collision_table.png differ diff --git a/doc/example/example_normal.md b/doc/example/example_normal.md deleted file mode 100644 index c61edb7..0000000 --- a/doc/example/example_normal.md +++ /dev/null @@ -1,11 +0,0 @@ -![memory map diagram](example_normal_diagram.png) -|region (parent)|origin|size|free Space|collisions|links|draw scale| -|:-|:-|:-|:-|:-|:-|:-| -|dtb (Untitled)|0x190 (400)|0x30 (48)|0x1aa (426)|||1:1| -|rootfs (Untitled)|0x50 (80)|0x30 (48)|0x110 (272)|||1:1| -|kernel (Untitled)|0x10 (16)|0x30 (48)|0x10 (16)|||1:1| - ---- -#### Untitled: -- max address = 0x36A (874) -- User-defined input \ No newline at end of file diff --git a/doc/example/example_normal_diagram.png b/doc/example/example_normal_diagram.png deleted file mode 100644 index 21c0f98..0000000 Binary files a/doc/example/example_normal_diagram.png and /dev/null differ diff --git a/doc/example/example_normal_table.png b/doc/example/example_normal_table.png deleted file mode 100644 index 68a716b..0000000 Binary files a/doc/example/example_normal_table.png and /dev/null differ diff --git a/doc/example/example_region_collisions.md b/doc/example/example_region_collisions.md new file mode 100644 index 0000000..3c2af54 --- /dev/null +++ b/doc/example/example_region_collisions.md @@ -0,0 +1,11 @@ +![memory map diagram](example_region_collisions_diagram.png) +|region (parent)|origin|size|free Space|collisions|links|draw scale| +|:-|:-|:-|:-|:-|:-|:-| +|dtb (Untitled)|0x90 (144)|0x30 (48)|0xf5 (245)| rootfs @ 0x90 ||1:1| +|rootfs (Untitled)|0x50 (80)|0x50 (80)|-0x10 (-16)| kernel @ 0x50
dtb @ 0x90 ||1:1| +|kernel (Untitled)|0x10 (16)|0x60 (96)|-0x20 (-32)| rootfs @ 0x50 ||1:1| + +--- +#### Untitled: +- max address = 0x1B5 (437) +- User-defined input \ No newline at end of file diff --git a/doc/example/example_region_collisions_diagram.png b/doc/example/example_region_collisions_diagram.png new file mode 100644 index 0000000..1ca0d2a Binary files /dev/null and b/doc/example/example_region_collisions_diagram.png differ diff --git a/doc/example/example_region_collisions_table.png b/doc/example/example_region_collisions_table.png new file mode 100644 index 0000000..0d06108 Binary files /dev/null and b/doc/example/example_region_collisions_table.png differ diff --git a/doc/example/example_three_maps.md b/doc/example/example_three_maps.md index 61bbb3b..a4e0374 100644 --- a/doc/example/example_three_maps.md +++ b/doc/example/example_three_maps.md @@ -1,21 +1,21 @@ ![memory map diagram](example_three_maps_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|Blob5 (DRAM)|0x78 (120)|0x20 (32)|0x2d2 (722)|||1:1| -|Blob3 (DRAM)|0x50 (80)|0x20 (32)|0x8 (8)|||1:1| -|Blob7 (flash)|0x50 (80)|0x20 (32)|0x2fa (762)||('DRAM', 'Blob3')
('DRAM', 'Blob5')|1:1| -|Blob4 (DRAM)|0x28 (40)|0x20 (32)|0x8 (8)|||1:1| -|Blob6 (flash)|0xa (10)|0x3c (60)|0xa (10)|||1:1| -|Blob1 (eMMC)|0x0 (0)|0x20 (32)|0x34a (842)||('DRAM', 'Blob2')
('DRAM', 'Blob4')|1:1| -|Blob2 (DRAM)|0x0 (0)|0x20 (32)|0x8 (8)|||1:1| +|Blob5 (DRAM)|0x78 (120)|0x20 (32)|0x11d (285)|||1:1| +|Blob3 (DRAM)|0x50 (80)|0x20 (32)|0x8 (8)|||1:1| +|Blob7 (flash)|0x50 (80)|0x20 (32)|0x145 (325)||('DRAM', 'Blob3')
('DRAM', 'Blob5')|1:1| +|Blob4 (DRAM)|0x28 (40)|0x20 (32)|0x8 (8)|||1:1| +|Blob6 (flash)|0xa (10)|0x3c (60)|0xa (10)|||1:1| +|Blob1 (eMMC)|0x0 (0)|0x20 (32)|0x195 (405)||('DRAM', 'Blob2')
('DRAM', 'Blob4')|1:1| +|Blob2 (DRAM)|0x0 (0)|0x20 (32)|0x8 (8)|||1:1| --- #### eMMC: -- max address = 0x36A (874) +- max address = 0x1B5 (437) - Calculated from region data #### DRAM: -- max address = 0x36A (874) +- max address = 0x1B5 (437) - Calculated from region data #### flash: -- max address = 0x36A (874) +- max address = 0x1B5 (437) - Calculated from region data \ No newline at end of file diff --git a/doc/example/example_three_maps_diagram.png b/doc/example/example_three_maps_diagram.png index 994c33c..6addf22 100644 Binary files a/doc/example/example_three_maps_diagram.png and b/doc/example/example_three_maps_diagram.png differ diff --git a/doc/example/example_three_maps_table.png b/doc/example/example_three_maps_table.png index 33cba15..2105ec1 100644 Binary files a/doc/example/example_three_maps_table.png and b/doc/example/example_three_maps_table.png differ diff --git a/doc/example/example_two_maps.md b/doc/example/example_two_maps.md index b8fdf14..1452a14 100644 --- a/doc/example/example_two_maps.md +++ b/doc/example/example_two_maps.md @@ -1,16 +1,16 @@ ![memory map diagram](example_two_maps_diagram.png) |region (parent)|origin|size|free Space|collisions|links|draw scale| |:-|:-|:-|:-|:-|:-|:-| -|Blob4 (eMMC)|0x100 (256)|0x10 (16)|0x25a (602)|||1:1| -|Blob3 (DRAM)|0x50 (80)|0x10 (16)|0x30a (778)|||1:1| -|Blob5 (DRAM)|0x30 (48)|0x10 (16)|0x10 (16)|||1:1| -|Blob1 (eMMC)|0x10 (16)|0x10 (16)|0xe0 (224)||('DRAM', 'Blob2')
('DRAM', 'Blob3')|1:1| -|Blob2 (DRAM)|0x10 (16)|0x10 (16)|0x10 (16)|||1:1| +|Blob4 (eMMC)|0x100 (256)|0x30 (48)|0x85 (133)|||1:1| +|Blob3 (DRAM)|0x50 (80)|0x10 (16)|0x155 (341)|||1:1| +|Blob5 (DRAM)|0x30 (48)|0x10 (16)|0x10 (16)|||1:1| +|Blob1 (eMMC)|0x10 (16)|0x10 (16)|0xe0 (224)||('DRAM', 'Blob2')
('DRAM', 'Blob3')|1:1| +|Blob2 (DRAM)|0x10 (16)|0x10 (16)|0x10 (16)|||1:1| --- #### eMMC: -- max address = 0x36A (874) +- max address = 0x1B5 (437) - Calculated from region data #### DRAM: -- max address = 0x36A (874) +- max address = 0x1B5 (437) - Calculated from region data \ No newline at end of file diff --git a/doc/example/example_two_maps_diagram.png b/doc/example/example_two_maps_diagram.png index 21ca394..efcb487 100644 Binary files a/doc/example/example_two_maps_diagram.png and b/doc/example/example_two_maps_diagram.png differ diff --git a/doc/example/example_two_maps_table.png b/doc/example/example_two_maps_table.png index 6f4638f..df72bf5 100644 Binary files a/doc/example/example_two_maps_table.png and b/doc/example/example_two_maps_table.png differ diff --git a/doc/example/input.json b/doc/example/input.json index a8df2b6..715fe11 100644 --- a/doc/example/input.json +++ b/doc/example/input.json @@ -50,7 +50,7 @@ "height": 874, "indent_scheme": "alternate", "region_alpha": 192, - "threshold": 200, + "threshold": 10, "title_fill_colour": [ 224, 224, diff --git a/doc/example/three_maps_input.json b/doc/example/three_maps_input.json index 633db05..a0d7f0c 100644 --- a/doc/example/three_maps_input.json +++ b/doc/example/three_maps_input.json @@ -1,7 +1,7 @@ { "$schema": "../../mm/schema.json", "name": "TestDiagram", - "height": 874, + "height": 437, "width": 614, "memory_maps": { "eMMC": { diff --git a/doc/example/two_maps_input.json b/doc/example/two_maps_input.json index b1e1bb2..c7c1867 100644 --- a/doc/example/two_maps_input.json +++ b/doc/example/two_maps_input.json @@ -1,7 +1,7 @@ { "$schema": "../../mm/schema.json", "name": "TestDiagram", - "height": 874, + "height": 437, "width": 614, "memory_maps": { "eMMC": { @@ -22,7 +22,7 @@ }, "Blob4": { "origin": "0x100", - "size": "0x10" + "size": "0x30" } } }, diff --git a/mm/diagram.py b/mm/diagram.py index 11fa40a..b4d04e3 100644 --- a/mm/diagram.py +++ b/mm/diagram.py @@ -482,13 +482,16 @@ def _parse_args(cls): ) parser.add_argument( "regions", - help="command line input for regions should be tuples of name, origin and size.", + help="""Sequence of region data. Should be tuples of name, origin and size: + """, nargs="*", ) parser.add_argument( "-o", "--out", - help='path to the markdown output report file. Default: "out/report.md"', + help="""The path to the markdown output report file. + Diagram and table images will be written using this path and name (using png extension). + Default: 'out/report.md'""", default="out/report.md", ) parser.add_argument( @@ -497,7 +500,8 @@ def _parse_args(cls): help=""" The 'height' in pixels and 'max address' in bytes for the diagram. Please use hex format. Ignored when using JSON file input. - Memory regions exceeding this value will be scaled to fit. + Memory regions exceeding this value will be scaled to fit when drawn + but collision measurements will use the original value. If you need to set 'height' and 'max address' to different values, please use the JSON input file instead.""", type=str @@ -505,9 +509,10 @@ def _parse_args(cls): parser.add_argument( "-t", "--threshold", - help="The threshold for skipping void sections. Please use hex.", + help="""The threshold for replacing large empty sections with 'SKIPPED' regions. + Any space over this value will be replaced. Please use hex. Default = 0x16""", type=str, - default=hex(200) + default=hex(10) ) parser.add_argument( "-n", @@ -518,7 +523,7 @@ def _parse_args(cls): parser.add_argument( "-f", "--file", - help="JSON input file for multiple memory maps (and links) support. Please see doc/example/input.json for help.", + help="JSON input file for multiple memory maps (and links) support. Please see doc/example for help.", type=str, ) parser.add_argument( @@ -528,7 +533,8 @@ def _parse_args(cls): ) parser.add_argument( "--no_whitespace_trim", - help="Force whitespace trim in diagram images.", + help="""Force disable of whitespace trim in diagram images. + If this option is set, diagram images may be created larger than requested.""", action="store_true" ) diff --git a/mm/metamodel.py b/mm/metamodel.py index 6a5a244..8c87c13 100644 --- a/mm/metamodel.py +++ b/mm/metamodel.py @@ -219,7 +219,7 @@ class Diagram(ConfigParent): threshold: Annotated[ int | str, pydantic.Field( - hex(200), + hex(10), description="The threshold for skipping void sections. Please use hex." ) ] diff --git a/mm/schema.json b/mm/schema.json index b6c893f..6ffcd98 100644 --- a/mm/schema.json +++ b/mm/schema.json @@ -295,7 +295,7 @@ "type": "string" } ], - "default": "0xc8", + "default": "0xa", "description": "The threshold for skipping void sections. Please use hex.", "title": "Threshold" }, diff --git a/tests/test_args.py b/tests/test_args.py index d261166..862e802 100644 --- a/tests/test_args.py +++ b/tests/test_args.py @@ -211,7 +211,7 @@ def test_default_limit_arg_format(file_setup): default_limit = mm.diagram.Diagram.pargs.limit # this test assumes the default 'threshold' is 0x3e8 (1000) - assert mm.diagram.Diagram.pargs.threshold == hex(200) + assert mm.diagram.Diagram.pargs.threshold == hex(10) assert not mm.diagram.Diagram.pargs.threshold == 200 assert file_setup["report"].exists() diff --git a/tests/test_docs.py b/tests/test_docs.py index 2b48009..da187a9 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -10,8 +10,8 @@ -@pytest.mark.parametrize("file_setup", [{"file_path": "doc/example/example_normal"}], indirect=True) -def test_generate_doc_example_normal(file_setup): +@pytest.mark.parametrize("file_setup", [{"file_path": "doc/example/example_end_collision"}], indirect=True) +def test_generate_doc_example_end_collision(file_setup): """ """ @@ -23,7 +23,7 @@ def test_generate_doc_example_normal(file_setup): "rootfs", "0x50", "0x30", "dtb", "0x190", "0x30", "--out", str(file_setup["report"]), - "-l", hex(mm.diagram.A8.height), + "-l", hex(mm.diagram.A9.width), "--threshold", hex(200), ], ): @@ -43,19 +43,19 @@ def test_generate_doc_example_normal(file_setup): if region_image.name == "dtb": assert region_image.origin_as_hex == "0x190" assert region_image.size_as_hex == "0x30" - assert region_image.freespace_as_hex == "0x1aa" + assert region_image.freespace_as_hex == "-0xb" assert file_setup["report"].exists() assert file_setup["diagram_image"].exists() found_size = PIL.Image.open(str(file_setup["diagram_image"])).size - assert found_size == (mm.diagram.A8.width, mm.diagram.A8.height) + assert found_size == (mm.diagram.A8.width, mm.diagram.A9.width) # reduced void threshold, so empty section between rootfs and dtb should be voided, making the file smaller assert file_setup["table_image"].exists() -@pytest.mark.parametrize("file_setup", [{"file_path": "doc/example/example_collisions"}], indirect=True) -def test_generate_doc_example_collisions(file_setup): +@pytest.mark.parametrize("file_setup", [{"file_path": "doc/example/example_region_collisions"}], indirect=True) +def test_generate_doc_example_region_collisions(file_setup): """ """ with unittest.mock.patch( @@ -66,7 +66,7 @@ def test_generate_doc_example_collisions(file_setup): "rootfs", "0x50", "0x50", "dtb", "0x90", "0x30", "--out", str(file_setup["report"]), - "--limit", hex(mm.diagram.A8.height), + "--limit", hex(mm.diagram.A9.width), "--threshold", hex(200), ], ): @@ -86,12 +86,12 @@ def test_generate_doc_example_collisions(file_setup): if region_image.name == "dtb": assert region_image.origin_as_hex == "0x90" assert region_image.size_as_hex == "0x30" - assert region_image.freespace_as_hex == "0x2aa" + assert region_image.freespace_as_hex == "0xf5" assert file_setup["report"].exists() assert file_setup["diagram_image"].exists() - assert PIL.Image.open(str(file_setup["diagram_image"])).size == (mm.diagram.A8.width, mm.diagram.A8.height) + assert PIL.Image.open(str(file_setup["diagram_image"])).size == (mm.diagram.A8.width, mm.diagram.A9.width) assert file_setup["table_image"].exists() @@ -99,9 +99,11 @@ def test_generate_doc_example_collisions(file_setup): def test_generate_doc_example_two_maps(input, file_setup): """ """ + input['height'] = mm.diagram.A9.width + input['width'] = mm.diagram.A9.height input['memory_maps']['eMMC']['memory_regions']['Blob4'] = { "origin": "0x100", - "size": "0x10" + "size": "0x30" } input['memory_maps']['DRAM']['memory_regions']['Blob5'] = { @@ -133,7 +135,7 @@ def test_generate_doc_example_two_maps(input, file_setup): assert file_setup["report"].exists() assert file_setup["diagram_image"].exists() - assert PIL.Image.open(str(file_setup["diagram_image"])).size == (mm.diagram.A8.width, mm.diagram.A8.height) + assert PIL.Image.open(str(file_setup["diagram_image"])).size == (mm.diagram.A9.height, mm.diagram.A9.width) assert file_setup["table_image"].exists() @@ -142,6 +144,9 @@ def test_generate_doc_example_two_maps(input, file_setup): def test_generate_doc_example_three_maps(input, file_setup): """ """ + + input['height'] = mm.diagram.A9.width + input['width'] = mm.diagram.A9.height input["memory_maps"]['eMMC']['memory_regions']['Blob1'] = { "origin": hex(0), "size": hex(32), @@ -206,7 +211,7 @@ def test_generate_doc_example_three_maps(input, file_setup): assert file_setup["report"].exists() assert file_setup["diagram_image"].exists() - assert PIL.Image.open(str(file_setup["diagram_image"])).size == (mm.diagram.A8.width, mm.diagram.A8.height) + assert PIL.Image.open(str(file_setup["diagram_image"])).size == (mm.diagram.A9.height, mm.diagram.A9.width) assert file_setup["table_image"].exists() ###################################### diff --git a/tests/test_void_regions.py b/tests/test_void_regions.py index d8e773e..8131b62 100644 --- a/tests/test_void_regions.py +++ b/tests/test_void_regions.py @@ -29,14 +29,14 @@ def test_void_region_cli_defaults(file_setup): d = mm.diagram.Diagram() - assert len(d.mmd_list[0].mixed_region_dict) == 4 + assert len(d.mmd_list[0].mixed_region_dict) == 6 assert all(isinstance(x, mm.image.MemoryRegionImage) for x in d.mmd_list[0].mixed_region_dict[0]) assert all(isinstance(x, mm.image.VoidRegionImage) for x in d.mmd_list[0].mixed_region_dict[1]) assert all(isinstance(x, mm.image.MemoryRegionImage) for x in d.mmd_list[0].mixed_region_dict[2]) assert all(isinstance(x, mm.image.VoidRegionImage) for x in d.mmd_list[0].mixed_region_dict[3]) # assumes the defaults haven't changed - assert mm.diagram.Diagram.pargs.threshold == hex(200) + assert mm.diagram.Diagram.pargs.threshold == hex(10) for region_image in d.mmd_list[0].image_list: if region_image.name == "kernel":