Commit Graph

6 Commits

Author SHA1 Message Date
Gerard Marull-Paretas e81e92dbb9 boards: convert images to JPEG and reduce image size
The boards folder uses ~142.8 MB, being the largest in the repository.
This is due mostly to board images, which are in most cases not
optimized for web content. This patch tries to address this problem by
converting all pictures to JPEG (quality 75) and by adjusting its size
up to 750 px (the width of the documentation content). Images that
specified a fixed width in rst files are converted down to that value
instead.

With this patch, folder goes down to ~53.5 MB from 142.8 MB (-~63%).
Note that this patch introduces a new set of binary files to git
history, though (bad).

The process has been automated using this quickly crafted Python script:

```python
from pathlib import Path
import re
import subprocess

def process(doc, image, image_jpeg, size):
    subprocess.run(
        (
	     f"convert {image}"
	     "-background white -alpha remove -alpha off -quality 75"
	     f"-resize {size}\> {image_jpeg}"
	),
        shell=True,
        check=True,
        cwd=doc.parent,
    )
    if image != image_jpeg:
        (doc.parent / image).unlink()

for doc in Path(".").glob("boards/**/*.rst"):
    with open(doc) as f:
        content = ""
        image = None
        for line in f:
            m = re.match(r"^(\s*)\.\. (image|figure):: (.*)$", line)
            if m:
                if image:
                    process(doc, image, image_jpeg, size)

                image = Path(m.group(3))
                if image.suffix not in (".jpg", ".jpeg", ".png"):
                    content += line
                    image = None
                    continue

                image_jpeg = image.parent / (image.stem + ".jpg")
                size = 750
                content += (
                    f"{m.group(1)}.. {m.group(2)}:: {image_jpeg}\n"
                )
            elif image:
                m = re.match(r"\s*:height:\s*[0-9]+.*$", line)
                if m:
                    continue

                m = re.match(r"\s*:width:\s*([0-9]+).*$", line)
                if m:
                    size = min(int(m.group(1)), size)
                    continue

                content += line
                if line == "\n":
                    process(doc, image, image_jpeg, size)
                    image = None
            else:
                content += line

    with open(doc, "w") as f:
        f.write(content)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-29 10:18:18 +02:00
Christopher Friedt 6825d84123 boards: riscv: litex_vexriscv: doc: add arty-a7-100t support
Add documentation for the arty-a7-100t variant of the popular
Arty board.

Fixes #49044

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-08-15 08:23:40 +00:00
Fabio Baltieri 43e0a4678f boards: litex_vexriscv: fix duplicate doc title
The document title is repeated for some reason, causing it to be listed
twice in the board list. Drop one of the instances.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-07-20 09:41:32 -05:00
Mateusz Sierszulski 9906db8e64 boards: doc: Update information about generating litex_vexriscv SoC
This commit updates information about running ZephyrOS on litex_vexriscv
SoC. It also add information about generating bitstream with
Zephyr on LiteX VexRiscv and LiteX SoC Builder.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Co-authored-by: Jagoda Szwedyk <jszwedyk@antmicro.com>
2022-05-27 11:56:55 -07:00
Robert Winkler b18309c0d7 boards: doc: Add information about generating litex_vexriscv SoC
This commit adds more information about the litex_vexrscv board
target, including references to related projects and instruction
about generating bitstream for the Digilent Arty A7-35T Board.

Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
2020-12-16 12:49:16 -05:00
Nicolas Pitre 1f4b5ddd0f riscv32: rename to riscv
With the upcoming riscv64 support, it is best to use "riscv" as the
subdirectory name and common symbols as riscv32 and riscv64 support
code is almost identical. Then later decide whether 32-bit or 64-bit
compilation is wanted.

Redirects for the web documentation are also included.

Then zephyrbot complained about this:

"
New files added that are not covered in CODEOWNERS:

dts/riscv/microsemi-miv.dtsi
dts/riscv/riscv32-fe310.dtsi

Please add one or more entries in the CODEOWNERS file to cover
those files
"

So I assigned them to those who created them. Feel free to readjust
as necessary.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-02 13:54:48 -07:00