More docs on the tooling, fixes bug in memory computation.

wch-ch32v003
Felix "xq" Queißner 8 months ago
parent c65088cca6
commit e5b00e1d93

@ -1,8 +1,9 @@
//!
//! Computes some meta information for packages and prints them as JSON.
//! Computes the hash and some meta information for package tar balls and prints them as JSON.
//!
//! Usage: archive-info <file>
//!
//! Is used in `/tools/bundle.sh` to extend the `microzig-package.json` file.
//! Is used in `/tools/bundle.py` to extend the `microzig-package.json` file.
//!
const std = @import("std");

@ -1,8 +1,11 @@
#!/usr/bin/env python3
#
# Prepares a full deployment of MicroZig.
# Creates all packages into /microzig-deploy with the final folder structure.
# Creates all packages into ${repo}/microzig-deploy with the final folder structure.
#
# Just invoke this script to create a deployment structure for MicroZig.
#
import sys, os, subprocess,datetime, re, shutil, json, hashlib
from pathlib import Path, PurePosixPath
@ -22,12 +25,6 @@ ALL_FILES_DIR=".data"
REQUIRED_TOOLS = [
"zig",
"git",
# "date",
# "find",
# "jq",
# "mkdir",
# "dirname",
# "realpath",
]
DEPLOYMENT_BASE="https://download.microzig.tech/packages"

@ -1,42 +0,0 @@
#!/bin/sh
set -eu
# test for all required tools:
which tar gzip jq basename dirname realpath > /dev/null
if [ "$#" -ne 2 ]; then
echo "usage: $(basename "$0") <folder> <output tar ball>" >&2
exit 1
fi
input_folder="$(realpath "$1")"
output_file="$(realpath "$2")"
if [ ! -d "${input_folder}" ]; then
echo "${input_folder} does not exist or is not a directory!" >&2
exit 1
fi
if [ ! -f "${input_folder}/microzig-package.json" ]; then
echo "The input folder does not contain a microzig-package.json!" >&2
exit 1
fi
if [ -e "${output_file}" ]; then
echo "${output_file} already exists, please delete first!" >&2
exit 1
fi
if [ ! -d "$(dirname "${output_file}")" ]; then
echo "${output_file} does not point to a path where a file can be created!" >&2
exit 1
fi
(
cd "${input_folder}"
# explanation on ls-files:
# https://stackoverflow.com/a/53083343
tar -caf "${output_file}" $(git ls-files -- . ':!:microzig-package.json')
)

@ -1,3 +1,17 @@
//!
//! Creates a `build.zig.zon` based on a JSON array of `microzig-package.json` files.
//!
//! Usage: create-pkg-descriptor <package-name> < all-packages.json > build.zig.zon
//!
//! Searches for a package called `<package-name>` in the `microzig-package.json` descriptors
//! passed in on stdin.
//!
//! Those package descriptors must have `version`, `package_name`, `external_dependencies` and `inner_dependencies` set,
//! The inner dependencies must also have `download_url` and `package.hash` available.
//!
//! This program is intended for the use from the `tools/bundly.py` bundler. See this script for more usage information.
//!
const std = @import("std");
const eggzon = @import("eggzon");
@ -56,7 +70,6 @@ fn renderDep(writer: anytype, name: []const u8, url: []const u8, hash: []const u
try writer.writeAll(" },\n");
}
// create-pkg-descriptor <package_name>
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();

@ -1,5 +1,10 @@
#!/usr/bin/env python3
#
# A small web server that can serve the `${root}/microzig-deploy` folder for testing the package infrastructure.
#
# Basically `python -m http.server 8080`, but also hides folders starting with `.data` so the "internals" aren't shown
# to the user in the file listing.
#
from pathlib import Path
from http.server import HTTPServer,SimpleHTTPRequestHandler

@ -1,5 +1,5 @@
//!
//! A tool that extracs which chips and boards are avaiilable from a board support package
//! A tool that extracs which chips and boards are available from a board support package
//! and validates that the declarations conform
//!
@ -62,7 +62,7 @@ fn renderMicroZigTarget(stream: anytype, key: []const u8, target: microzig.Targe
for (target.chip.memory_regions) |reg| {
switch (reg.kind) {
.flash => jtarget.memory.flash += reg.length,
.ram => jtarget.memory.flash += reg.length,
.ram => jtarget.memory.ram += reg.length,
else => {},
}
}

@ -1,3 +1,7 @@
//!
//! Extracted from https://github.com/mattnite/ezpkg.
//!
const std = @import("std");
const builtin = @import("builtin");

Loading…
Cancel
Save