8000 No more GENERIC_SPIRAM board? · Issue #12253 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

No more GENERIC_SPIRAM board? #12253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tangerino opened this issue Aug 17, 2023 · 10 comments
Closed

No more GENERIC_SPIRAM board? #12253

Tangerino opened this issue Aug 17, 2023 · 10 comments
Labels

Comments

@Tangerino
Copy link

Where is the GENERIC_SPIRAM board definition (ESP32)?
It was merged into another board type?

ARDUINO_NANO_ESP32   GENERIC_S3           LOLIN_S2_PICO        UM_FEATHERS2         UM_TINYPICO          deploy_c3.md         manifest.py          sdkconfig.base       sdkconfig.spiram_sx
GENERIC              LILYGO_TTGO_LORA32   M5STACK_ATOM         UM_FEATHERS2NEO      UM_TINYS2            deploy_s2.md         manifest_test.py     sdkconfig.ble        sdkconfig.usb
GENERIC_C3           LOLIN_C3_MINI        OLIMEX_ESP32_POE     UM_FEATHERS3         UM_TINYS3            deploy_s3.md         pins_prefix.c        sdkconfig.spiram
GENERIC_S2           LOLIN_S2_MINI        SIL_WESP32           UM_PROS3             deploy.md            make-pins.py         sdkconfig.240mhz     sdkconfig.spiram_oct
@Tangerino Tangerino added the bug label Aug 17, 2023
@Tangerino
Copy link
Author
MicroPython v1.20.0-328-g01c758e26-dirty on 2023-07-31

@DvdGiessen
Copy link
Contributor

They were merged in 2fbf42d; now instead of being a separate board they're a "variant" of the generic board. You can select these with the BOARD_VARIANT parameter.

We should probably update the README section to reflect this.

@sosi-deadeye
Copy link
sosi-deadeye commented Aug 17, 2023

Can you remove the bug label? It is not a bug.

I fixed may build scripts, because of this change.
The variants are stored in ports/$PORT/$BOARD/board.json
There are also shell scripts in tools/autobuild

Code to generate make commands:

#!/usr/bin/env python3
import json
from collections.abc import Generator
from pathlib import Path

# micropyton is in my home directory
MICROPYTHON = Path.home() / "micropython"
PORTS = MICROPYTHON / "ports"


def get_ports() -> Generator[Path, None, None]:
    for port in sorted(PORTS.iterdir()):
        if port.is_dir() and port.joinpath("boards").exists():
            yield port


def get_boards(port: Path) -> Generator[Path, None, None]:
    for board in sorted(port.joinpath("boards").iterdir()):
        if board.is_dir():
            if board.exists() and board.is_dir():
                yield board


def get_variants(board: Path) -> list[str]:
    try:
        with board.joinpath("board.json").open() as fd:
            return json.load(fd).get("variants", [])
    except FileNotFoundError:
        return []


def make_command(port: Path, board: Path, variant: str | None = None) -> None:
    cmd = cmd = f"make -C {port} -j 8 BOARD={board.name}"
    if variant:
        cmd += f" BOARD_VARIANT={variant}"
        output_dir = port.joinpath(f"build_{board.name}_{variant.upper()}")
    else:
        output_dir = port.joinpath(f"build_{board.name}")

    cmd += f" BUILD={output_dir}"
    sub = f"{cmd} submodules"

    print(sub)
    print(cmd)


for port in get_ports():
    for board in get_boards(port):
        make_command(port, board)
        for variant in get_variants(board):
            # skipping idf3
            if variant == "idf3":
                continue
            make_command(port, board, variant)
    print()

Example for esp32 GENERIC with SPIRAM.
(the project is in /home/esp32/micropython)

make -C /home/esp32/micropython/ports/esp32 -j 8 BOARD=GENERIC BOARD_VARIANT=spiram BUILD=/home/esp32/micropython/ports/esp32/build_GENERIC_SPIRAM submodules
make -C /home/esp32/micropython/ports/esp32 -j 8 BOARD=GENERIC BOARD_VARIANT=spiram BUILD=/home/esp32/micropython/ports/esp32/build_GENERIC_SPIRAM

@Tangerino
Copy link
Author

Sorry but not clear what need to be done to compile for GENERIC_SPIRAM.
This is a kind of change that breaks stuff...

@robert-hh
Copy link
Contributor

make BOARD=GENERIC BOARD_VARIANT=spiram

@Tangerino
Copy link
Author

That's what I get. The board has 2MB of RAM

MicroPython v1.20.0-379-ga18d62e06 on 2023-08-18; Generic ESP32 module with SPIRAM with ESP32
Type "help()" for more information.
>>> gc.mem_free()
51520
>>> gc.mem_alloc()
14368
>>> 

@Tangerino
Copy link
Author

Thanks for the make tip anyway!

@robert-hh
Copy link
Contributor
robert-hh commented Aug 18, 2023

That's the confusing result of the recent PR #12141. gc.mem_free() does not show all memory. micropython.mem_info shows more. And even if mem_free() just shows about 50 k, you can allocate more RAM, up to the physical max. The available RAM will be expanded on request.

@Tangerino
Copy link
Author

Confusing and IMO a regression. I hope it will be fixed. Thank you very much.

@jimmo
Copy link
Member
jimmo commented Aug 21, 2023

We should probably update the README section to reflect this.

@DvdGiessen We did, but it's in the subsequent PR which hasn't been merged yet. #12240

Note that once that PR is merged, it will be

make BOARD=ESP32_GENERIC BOARD_VARIANT=SPIRAM

Confusing and IMO a regression.

This will of course all be in the v1.21 release notes. And #12240 includes a notice when you try and use the old "GENERIC" board name.

We're also trying to make this less confusing for the S2/S3 boards by just not having a spiram variant at all, the one build just works for both types. Unfortunately this isn't possible for the original ESP32.

It wasn't our intention to have a several-day gap between merging the two halves of this work (#12088 and #12240) but life (and a weekend) got in the way.

I hope it will be fixed.

It's not clear what you mean here... what do you need "fixed" ?

We often have to make changes to improve consistency, but unfortunately this by its nature means that we have to break the "inconsistent" part.

That's the confusing result of the recent PR #12141.

@robert-hh This will definitely take some explaining, but this is a very important feature to make ESP32 support SSL and not be unnecessarily slowed down by large PSRAM. Definitely open to suggestions on further improvements we can make to the API...
I'm not sure it makes sense for gc.mem_free() to include un-assigned RAM though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
0