Skip to content

Commit

Permalink
Updates README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix "xq" Queißner committed Feb 16, 2024
1 parent cb45e33 commit be113c7
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 10 deletions.
64 changes: 58 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,66 @@ You can easily get started based on that.

For MicroZig internals please see the [Design Document](docs/design.adoc).

## Developing

Right now, the developer experience is not optimal due to 0.11 not really supporting what we're doing at all.

If you want to test your changes, you gotta to the following:

**Step 1:** Create a deployment for local usage:

```sh-session
[user@host] microzig-monorepo/ $ python3 ./tools/bundle.py --debug
preparing environment...
validating packages...
loaded packages:
* microzig-build
* examples:microchip/avr
* examples:...
* microzig-core
* microchip/avr
* ...
resolving inner dependencies...
creating packages...
bundling microzig-build...
bundling microzig-core...
bundling microchip/avr...
...
[user@host] microzig-monorepo/ $
```

This command yields output in `./microzig-deploy` that is meant to be fetched via `http://localhost:8080/`.

**Step 2:** To serve the files on this port, you can start a pre-bundled web server:

```sh-session
[user@host] microzig-monorepo/ $ python3 ./tools/demo-server.py
...
```

This way, you spawn a local HTTP server that will serve `./microzig-deploy` on port 8080 on your machine, and you can then
start fetching packages from this.

Now you can use curl to fetch the packages, or you can just create a local development project.

**Step 3:** You can use the tool `tools/patch-build-zon.py` to patch/upgrade your development project inplace:

```sh-session
[user@host] microzig-monorepo/ $ python3 ./tools/patch-build-zon.py /tmp/dev-project
Updating hash of http://localhost:8080/packages/microzig-build.tar.gz to 12200040a36bbbb2fe09809861f565fcda9a10ec3064d70357aa40ad0a61596c16fb
Updating hash of http://localhost:8080/packages/microzig-core.tar.gz to 122013a37ce9ac295303f26057c203e722b9ceaefa5b4403fe5a18ab065f03079e7d
Updating hash of http://localhost:8080/packages/board-support/stmicro/stm32.tar.gz to 12207c278b78c5aeb08cd7889647d7d0d9a359cb28fe68105d2e43f85dabb3865981
[user@host] microzig-monorepo/ $
```

## Repository structure

- `build/` contains the build components of MicroZig.
- `core/` contains the shared components of MicroZig.
- `board-support/` contains all official board support package.
- `examples/` contains examples that can be used with the board support packages.
- `tools/` contains tooling to work *on* MicroZig itself, so deployment, testing, ...
- `design/` contains images and logos
* `build/` contains the build components of MicroZig.
* `core/` contains the shared components of MicroZig.
* `board-support/` contains all official board support package.
* `examples/` contains examples that can be used with the board support packages.
* `tools/` contains tooling to work *on* MicroZig itself, so deployment, testing, ...
* `design/` contains images and logos

## Versioning Scheme

Expand Down
10 changes: 6 additions & 4 deletions tools/patch-build-zon.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def main():
elif stripped.startswith(".hash = \""):
try:
pkg_path = PurePosixPath(last_pkg_url.path)
assert pkg_path.suffixes == ['.tar', '.gz']
assert pkg_path.suffixes[-2:] == ['.tar', '.gz']
pkg_json_url = urlunparse(
# scheme, netloc, url, params, query, fragment
(
Expand All @@ -58,12 +58,14 @@ def main():

line_prefix = re.match("^(\s*)", line).group(1)

print(f"Updating hash of {urlunparse(last_pkg_url)} to {pkg_hash}")

output_lines.append(f'{line_prefix}.hash = "{pkg_hash}",')
last_pkg_url = None

except AssertionError:
raise
except BaseException as ex:
print(ex)
print(f"error: {type(ex)} {ex}")
output_lines.append(line)
else:
output_lines.append(line)
Expand Down

0 comments on commit be113c7

Please sign in to comment.