diff --git a/.gitignore b/.gitignore index e47ae7ee..8d8b702b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,10 @@ .zig-cache zig-cache zig-out -.gen -.out -.main-*.zig **/local.ini +.vscode/ +workspace/zigem +workspace/.gen +workspace/.out +workspace/.main-*.zig +workspace/.zigem-main.zig \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..7b14bb46 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# **Zig•EM** +## v25.0.2 +- initial **VS Code** support through `vscode-zigem` extension +- new overall workspace organization +- renamed `em.test` bundle as `examples` +- critical bug-fix in `em.utils/FiberMgr` +- `em.examples.basic/TickerP` not fully operational +- additional information at [blog.zigem.tech/post-003](https://blog.zigem.tech/post-003/) + +## v25.0.1 +- first public release of the **Zig•EM** programming framework +- support for `windows-x86_64`, `linux-x86_64`, and `macos-x86_64` as development hosts +- support for the [TI CC2340R5](https://www.ti.com/product/CC2340R5) wireless MCU as an embedded hardware target +- a suite of basic programming examples, first introduced in EM and now re-written in Zig +- additional information at [blog.zigem.tech/post-002](https://blog.zigem.tech/post-002/) diff --git a/README.md b/README.md index 7af5eb69..b054bb0f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # **Zig•EM** -Visit [blog.zigem.tech](https://blog.zigem.tech/post-001/) to learn more about this novel programming framework targeting resource-constrained embedded systems, where every byte of memory and μJoule of energy matters. \ No newline at end of file +Visit [blog.zigem.tech](https://blog.zigem.tech/post-001/) to learn more about this novel programming framework targeting resource-constrained embedded systems, where every byte of memory and μJoule of energy matters. diff --git a/build.zig b/build.zig index 5246247d..7c777490 100644 --- a/build.zig +++ b/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const target = b.host; const optimize = b.standardOptimizeOption(.{}); const exe = b.addExecutable(.{ - .name = "zig-em", + .name = "zigem", .root_source_file = std.Build.path(b, "src/main.zig"), .target = target, .optimize = optimize, @@ -34,18 +34,24 @@ pub fn build(b: *std.Build) void { } } + b.installDirectory(.{ + .source_dir = b.dependency("vscode-zigem", .{}).path("."), + .install_dir = std.Build.InstallDir{ .custom = "tools" }, + .install_subdir = "", + }); + b.installArtifact(b.dependency("zls-em", .{}).artifact("zls-em")); b.installArtifact(exe); const verify_exe = b.addRunArtifact(exe); verify_exe.setCwd(std.Build.LazyPath{ .src_path = .{ .owner = b, .sub_path = "workspace" } }); - verify_exe.addArgs(&.{ "compile", "-u", "em.test/em.examples.basic/BlinkerP.em.zig" }); - const verify_step = b.step("verify", "Verify zig-em"); + verify_exe.addArgs(&.{ "compile", "-f", "em.core/em.examples.basic/BlinkerP.em.zig" }); + const verify_step = b.step("verify", "Verify ZigEM"); verify_step.dependOn(&verify_exe.step); const zigem_exe = b.addRunArtifact(exe); if (b.args) |args| zigem_exe.addArgs(args); zigem_exe.setCwd(std.Build.LazyPath{ .src_path = .{ .owner = b, .sub_path = "workspace" } }); - const zigem_step = b.step("zig-em", "Execute the ZigEM CLI"); + const zigem_step = b.step("zigem", "Execute the ZigEM CLI"); zigem_step.dependOn(&zigem_exe.step); } diff --git a/build.zig.zon b/build.zig.zon index e8726ced..3a75ab93 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -41,5 +41,13 @@ .hash = "1220e083de87e1aadeb0c0446c301d4214b2eebb2632389eb650556462c80ec9b71d", .lazy = true, }, + .@"zls-em" = .{ + .url = "https://github.com/em-foundation/zls-em/archive/refs/tags/v0.0.1.tar.gz", + .hash = "12201b80d7156dfba486ba255f282e67ee3e84f782b6816d93fcd68466f9193be267", + }, + .@"vscode-zigem" = .{ + .url = "https://github.com/em-foundation/vscode-zigem/releases/download/v0.0.2.202409131250/vscode-zigem.zip", + .hash = "1220291e6f88b53eb17dbd6c47ef8f45eb8bae0a7181e51b1a3158bbe414862c110b", + }, }, } diff --git a/src/Props.zig b/src/Props.zig index 6a210148..ca964d89 100644 --- a/src/Props.zig +++ b/src/Props.zig @@ -9,16 +9,16 @@ const LOCAL_FILE = "local.ini"; const ZIGEM_FILE = "zigem.ini"; const PROP_EXTENDS = "em.lang.SetupExtends"; -const PROP_REQUIRES = "em.lang.BundleRequires"; +const PROP_REQUIRES = "em.lang.PackageRequires"; const SETUP_SEP = "://"; -const BundleList = std.ArrayList([]const u8); +const PkgList = std.ArrayList([]const u8); const PropMap = std.StringHashMap([]const u8); const PropSet = std.StringHashMap(void); -var cur_bundles = BundleList.init(Heap.get()); +var cur_pkgs = PkgList.init(Heap.get()); var cur_props = PropMap.init(Heap.get()); var done_set = PropSet.init(Heap.get()); @@ -27,19 +27,19 @@ var work_set = PropSet.init(Heap.get()); var has_setup: bool = undefined; var root_dir: []const u8 = undefined; -pub fn addBundle(name: []const u8) anyerror!void { - // std.log.info("adding bunding {s}", .{name}); +pub fn addPackage(name: []const u8) anyerror!void { + // std.log.info("adding package {s}", .{name}); if (done_set.contains(name)) return; - if (work_set.contains(name)) std.zig.fatal("bundle cycle in {s}", .{name}); + if (work_set.contains(name)) std.zig.fatal("package cycle in {s}", .{name}); try work_set.put(name, {}); - const path = Fs.join(&.{ root_dir, name, "em-bundle.ini" }); + const path = Fs.join(&.{ root_dir, name, "zigem-package.ini" }); const pm = try readProps(path); try applyRequires(pm); var ent_iter = pm.iterator(); while (ent_iter.next()) |e| try cur_props.put(e.key_ptr.*, e.value_ptr.*); _ = work_set.remove(name); try done_set.put(name, {}); - try cur_bundles.insert(0, Fs.dirname(path)); + try cur_pkgs.insert(0, Fs.dirname(path)); } pub fn addSetup(name: []const u8) anyerror!void { @@ -80,12 +80,12 @@ fn applyRequires(pm: PropMap) anyerror!void { if (pm.contains(PROP_REQUIRES)) { const reqs = std.mem.trim(u8, pm.get(PROP_REQUIRES).?, &std.ascii.whitespace); var tok_iter = std.mem.tokenizeAny(u8, reqs, ", "); - while (tok_iter.next()) |bn| try addBundle(bn); + while (tok_iter.next()) |bn| try addPackage(bn); } } -pub fn getBundles() BundleList { - return cur_bundles; +pub fn getPackages() PkgList { + return cur_pkgs; } pub fn getProps() PropMap { @@ -100,7 +100,7 @@ pub fn init(dir: []const u8, sflg: bool) void { pub fn print() void { var props_iter = cur_props.iterator(); while (props_iter.next()) |ent| std.log.debug("{s} = {s}", .{ ent.key_ptr.*, ent.value_ptr.* }); - for (cur_bundles.items) |bn| std.log.debug("bundle {s}", .{bn}); + for (cur_pkgs.items) |bn| std.log.debug("bundle {s}", .{bn}); } fn readProps(path: []const u8) !PropMap { diff --git a/src/Session.zig b/src/Session.zig index 5daa8e70..1f064dd4 100644 --- a/src/Session.zig +++ b/src/Session.zig @@ -5,13 +5,18 @@ const Heap = @import("./Heap.zig"); const Out = @import("./Out.zig"); const Props = @import("./Props.zig"); +const makefile_txt = @embedFile("./makefile.txt"); + pub const Mode = enum { CLEAN, COMPILE, REFRESH, }; +const ZIGEM_MAIN = ".zigem-main.zig"; + var cur_mode: Mode = undefined; +var build_root: []const u8 = undefined; var gen_root: []const u8 = undefined; var out_root: []const u8 = undefined; var work_root: []const u8 = undefined; @@ -24,37 +29,62 @@ pub const ActivateParams = struct { }; pub fn activate(params: ActivateParams) !void { - work_root = try Fs.normalize(params.work); cur_mode = params.mode; - gen_root = Fs.slashify(Fs.join(&.{ work_root, ".gen" })); - out_root = Fs.slashify(Fs.join(&.{ work_root, ".out" })); - Fs.delete(gen_root); - Fs.delete(out_root); - if (cur_mode == .CLEAN) return; - Fs.mkdirs(work_root, ".gen"); - Fs.mkdirs(work_root, ".out"); + work_root = try Fs.normalize(params.work); + build_root = Fs.slashify(Fs.join(&.{ work_root, "zigem" })); + gen_root = build_root; + out_root = Fs.slashify(Fs.join(&.{ build_root, "out" })); + Fs.delete(build_root); + Fs.delete(Fs.slashify(Fs.join(&.{ work_root, ZIGEM_MAIN }))); + if (cur_mode == .CLEAN) { + // legacy + Fs.delete(Fs.slashify(Fs.join(&.{ work_root, ".gen" }))); + Fs.delete(Fs.slashify(Fs.join(&.{ work_root, ".out" }))); + Fs.delete(Fs.slashify(Fs.join(&.{ work_root, ".main-meta.zig" }))); + Fs.delete(Fs.slashify(Fs.join(&.{ work_root, ".main-targ.zig" }))); + return; + } + Fs.mkdirs(work_root, "zigem/out"); Fs.chdir(work_root); Props.init(work_root, params.setup != null); - try Props.addBundle("em.core"); - if (params.bundle) |bn| try Props.addBundle(bn); + try Props.addPackage("em.core"); + if (params.bundle) |bn| try Props.addPackage(bn); if (params.setup) |sn| try Props.addSetup(sn); try Props.addWorkspace(); - try Props.addBundle(getDistroBundle()); + try Props.addPackage(getDistroPkg()); } pub fn doBuild(upath: []const u8) !void { const uname = mkUname(upath); - try genStubs("host", uname, "pub"); - try genStubs("targ", uname, "export"); + try genStub("meta", uname); + try genStub("targ", uname); } pub fn doRefresh() !void { try genEmStub(); + try genMakefile(); try genProps(); - try genTarg(); + try genMain(); + try genDomain(); try genUnits(); } +fn genDomain() !void { + var file = try Out.open(Fs.join(&.{ gen_root, "domain.zig" })); + file.print( + \\pub const Domain = enum {{META, TARG}}; + \\pub const DOMAIN: Domain = .META; + \\ + , .{}); + file.close(); + // + file = try Out.open(Fs.join(&.{ gen_root, "meta.zig" })); + file.close(); + // + file = try Out.open(Fs.join(&.{ gen_root, "targ.zig" })); + file.close(); +} + fn genEmStub() !void { var file = try Out.open(Fs.join(&.{ gen_root, "em.zig" })); const fmt = @@ -68,7 +98,33 @@ fn genEmStub() !void { \\ \\pub const hal = @import("../{2s}/{3s}/hal.zig"); ; - file.print(fmt, .{ gen_root, out_root, getDistroBundle(), getDistroPkg() }); + file.print(fmt, .{ gen_root, out_root, getDistroPkg(), getDistroBuck() }); + file.close(); +} + +fn genMakefile() !void { + var file = try Out.open(Fs.join(&.{ build_root, "makefile" })); + file.print("{s}", .{makefile_txt}); + file.close(); +} + +fn genMain() !void { + var file = try Out.open(Fs.join(&.{ work_root, ZIGEM_MAIN })); + const txt = + \\// GENERATED FILE -- do not edit!!! + \\ + \\pub usingnamespace @import("zigem/em.zig"); + \\const domain_desc = @import("zigem/domain.zig"); + \\ + \\pub fn main() void { + \\ if (domain_desc.DOMAIN == .META) @import("zigem/meta.zig").exec(); + \\} + \\ + \\export fn zigem_main() void { + \\ if (domain_desc.DOMAIN == .TARG) @import("zigem/targ.zig").exec(); + \\} + ; + file.print("{s}", .{txt}); file.close(); } @@ -78,44 +134,30 @@ fn genProps() !void { file.print("pub const map = std.StaticStringMap([]const u8).initComptime(.{{\n", .{}); var ent_iter = Props.getProps().iterator(); while (ent_iter.next()) |e| { - // file.print("pub const @\"{s}\" = \"{s}\";\n", .{ e.key_ptr.*, e.value_ptr.* }); file.print(" .{{ \"{s}\", \"{s}\" }},\n", .{ e.key_ptr.*, e.value_ptr.* }); } file.print("}});\n", .{}); file.close(); } -fn genStubs(kind: []const u8, uname: []const u8, pre: []const u8) !void { - // .main-.zig - const fn1 = try sprint(".main-{s}.zig", .{kind}); - var file = try Out.open(Fs.join(&.{ work_root, fn1 })); - const fmt1 = - \\{0s} fn main() void {{ @import(".gen/{1s}.zig").exec(); }} - ; - file.print(fmt1, .{ pre, kind }); - file.close(); - // .gen/.zig - const fn2 = try sprint("{s}.zig", .{kind}); - file = try Out.open(Fs.join(&.{ gen_root, fn2 })); - const fmt2 = +fn genStub(kind: []const u8, uname: []const u8) !void { + // zigem/.zig + const fn1 = try sprint("{s}.zig", .{kind}); + var file = try Out.open(Fs.join(&.{ gen_root, fn1 })); + const fmt = \\const em = @import("./em.zig"); \\ \\pub fn exec() void {{ \\ @import("../em.core/em.lang/{0s}-main.zig").exec(em.import.@"{1s}".em__U) catch em.fail(); \\}} ; - file.print(fmt2, .{ kind, uname }); - file.close(); -} - -fn genTarg() !void { - var file = try Out.open(Fs.join(&.{ gen_root, "targ.zig" })); + file.print(fmt, .{ kind, uname }); file.close(); } fn genUnits() !void { - const distro_pkg = getDistroPkg(); - var pkg_set = std.StringArrayHashMap(void).init(Heap.get()); + const distro_buck = getDistroBuck(); + var buck_set = std.StringArrayHashMap(void).init(Heap.get()); var type_map = std.StringArrayHashMap([]const u8).init(Heap.get()); var file = try Out.open(Fs.join(&.{ gen_root, "imports.zig" })); const pre = @@ -124,38 +166,30 @@ fn genUnits() !void { \\ ; file.print(pre, .{}); - for (Props.getBundles().items) |bp| { - var iter = Fs.openDir(bp).iterate(); - const bname = Fs.basename(bp); + for (Props.getPackages().items) |pkgpath| { + var iter = Fs.openDir(pkgpath).iterate(); + const pkgname = Fs.basename(pkgpath); while (try iter.next()) |ent| { if (ent.kind != .directory) continue; - const pname = ent.name; - const is_distro = std.mem.eql(u8, pname, distro_pkg); - if (pkg_set.contains(pname)) continue; - try pkg_set.put(pname, {}); - var iter2 = Fs.openDir(Fs.join(&.{ bp, ent.name })).iterate(); + const buckname = ent.name; + const is_distro = std.mem.eql(u8, buckname, distro_buck); + if (buck_set.contains(buckname)) continue; + try buck_set.put(buckname, {}); + var iter2 = Fs.openDir(Fs.join(&.{ pkgpath, ent.name })).iterate(); while (try iter2.next()) |ent2| { if (ent2.kind != .file) continue; const idx = std.mem.indexOf(u8, ent2.name, ".em.zig"); if (idx == null) continue; - file.print("pub const @\"{0s}/{1s}\" = em.unitScope(@import(\"../{2s}/{0s}/{3s}\"));\n", .{ pname, ent2.name[0..idx.?], bname, ent2.name }); - const tn = try sprint("{s}.{s}.{s}.em", .{ bname, pname, ent2.name[0..idx.?] }); - const un = try sprint("{s}/{s}", .{ pname, ent2.name[0..idx.?] }); + file.print("pub const @\"{0s}/{1s}\" = em.unitScope(@import(\"../{2s}/{0s}/{3s}\"));\n", .{ buckname, ent2.name[0..idx.?], pkgname, ent2.name }); + const tn = try sprint("{s}.{s}.{s}.em", .{ pkgname, buckname, ent2.name[0..idx.?] }); + const un = try sprint("{s}/{s}", .{ buckname, ent2.name[0..idx.?] }); try type_map.put(tn, un); - if (is_distro) file.print("pub const @\"em__distro/{1s}\" = em.unitScope(@import(\"../{2s}/{0s}/{3s}\"));\n", .{ pname, ent2.name[0..idx.?], bname, ent2.name }); + if (is_distro) file.print("pub const @\"em__distro/{1s}\" = em.unitScope(@import(\"../{2s}/{0s}/{3s}\"));\n", .{ buckname, ent2.name[0..idx.?], pkgname, ent2.name }); } } } file.close(); // - file = try Out.open(Fs.join(&.{ gen_root, "domain.zig" })); - file.print( - \\pub const Domain = enum {{HOST, TARG}}; - \\pub const DOMAIN: Domain = .HOST; - \\ - , .{}); - file.close(); - // file = try Out.open(Fs.join(&.{ gen_root, "type_map.zig" })); for (type_map.keys()) |tn| { const un = type_map.get(tn).?; @@ -182,13 +216,13 @@ pub fn getBoard() []const u8 { return Props.getProps().get("em.lang.BoardKind").?; } -fn getDistroBundle() []const u8 { - const distro = Props.getProps().get("em.lang.DistroPackage").?; +fn getDistroPkg() []const u8 { + const distro = Props.getProps().get("em.lang.Distro").?; return distro[0..std.mem.indexOf(u8, distro, "://").?]; } -fn getDistroPkg() []const u8 { - const distro = Props.getProps().get("em.lang.DistroPackage").?; +fn getDistroBuck() []const u8 { + const distro = Props.getProps().get("em.lang.Distro").?; return distro[std.mem.indexOf(u8, distro, "://").? + 3 ..]; } diff --git a/src/main.zig b/src/main.zig index 275a2738..d26c498d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -31,10 +31,10 @@ fn doCompile() !void { try Session.activate(.{ .work = params.work, .mode = .COMPILE, .bundle = bn, .setup = params.setup }); try Session.doRefresh(); try Session.doBuild(un); - try writer.print("compiling HOST ...\n", .{}); + try writer.print("compiling META ...\n", .{}); try writer.print(" board: {s}\n", .{Session.getBoard()}); try writer.print(" setup: {s}\n", .{Session.getSetup()}); - var stdout = try execMake("host"); + var stdout = try execMake("meta"); if (stdout.len > 0) std.log.debug("stdout = {s}", .{stdout}); if (params.meta) { const t2: f80 = @floatFromInt(std.time.milliTimestamp()); @@ -71,10 +71,11 @@ fn doRefresh() !void { fn execMake(goal: []const u8) ![]const u8 { const OS = "OS=" ++ @tagName(builtin.os.tag); - const argv = [_][]const u8{ "make", goal, OS }; + const argv = [_][]const u8{ "make", "-f", "zigem/makefile", goal, OS }; const proc = try std.process.Child.run(.{ .allocator = Heap.get(), .argv = &argv, + // .cwd = Fs.join(&.{ Fs.cwd(), "build" }), }); if (proc.stderr.len > 0) { @@ -116,6 +117,15 @@ pub fn main() !void { t0 = @floatFromInt(std.time.milliTimestamp()); var runner = try cli.AppRunner.init(Heap.get()); + const file_opt = cli.Option{ + .long_name = "file", + .short_alias = 'f', + .help = "Workspace-relative path to a .em.zig source file", + .required = true, + .value_name = "UPATH", + .value_ref = runner.mkRef(¶ms.unit), + }; + const load_opt = cli.Option{ .long_name = "load", .short_alias = 'l', @@ -126,9 +136,9 @@ pub fn main() !void { }; const meta_opt = cli.Option{ - .long_name = "meta-only", + .long_name = "meta", .short_alias = 'm', - .help = "Only run the HOST meta-program", + .help = "Only run the hosted meta-program", .required = false, .value_name = "META", .value_ref = runner.mkRef(¶ms.meta), @@ -143,15 +153,6 @@ pub fn main() !void { .value_ref = runner.mkRef(¶ms.setup), }; - const unit_opt = cli.Option{ - .long_name = "unit", - .short_alias = 'u', - .help = "Workspace-relative path to .em.zig file", - .required = true, - .value_name = "UPATH", - .value_ref = runner.mkRef(¶ms.unit), - }; - const work_opt = cli.Option{ .long_name = "workspace", .short_alias = 'w', @@ -174,10 +175,10 @@ pub fn main() !void { const compile_cmd = cli.Command{ .name = "compile", .options = &.{ + file_opt, load_opt, meta_opt, setup_opt, - unit_opt, work_opt, }, .target = cli.CommandTarget{ @@ -208,7 +209,7 @@ pub fn main() !void { const app = &cli.App{ .command = cli.Command{ - .name = "zig-em", + .name = "zigem", .target = cli.CommandTarget{ .subcommands = &.{ clean_cmd, diff --git a/src/makefile.txt b/src/makefile.txt new file mode 100644 index 00000000..2c5f9c94 --- /dev/null +++ b/src/makefile.txt @@ -0,0 +1,68 @@ +DISTRO=ti.cc23xx/ti.distro.cc23xx + +BLD=zigem +GEN=$(BLD) +OUT=$(BLD)/out + +MAIN=.zigem-main.zig + +meta: + @rm -f $(GEN)/targ.zig + @touch $(GEN)/targ.zig + @rm -rf $(OUT)/* + @zig build-exe -I. -femit-bin=$(OUT)/meta-main.exe $(MAIN) + @$(OUT)/meta-main.exe + @zig fmt $(GEN)/targ.zig 2>&1 >/dev/null + +hal: + @zig translate-c $(DISTRO)/hal.h > $(DISTRO)/hal.zig + +## ----------------- + +TOOLS=../zig-out/tools + +ifeq ($(OS),windows) + BIN_SUF=".exe" + SCRIPT_SUF=".bat" +else + BIN_SUF="" + SCRIPT_SUF=".sh" +endif + +ifeq ($(OS),macos) + SHA256=shasum -a 256 + UNIFLASH?=/Applications/ti/uniflash_8.7.0/dslite.sh +else + SHA256=sha256sum + UNIFLASH?=$(TOOLS)/ti-uniflash/dslite$(SCRIPT_SUF) +endif + +OBJCOPY?=$(TOOLS)/arm-binutils/objcopy$(BIN_SUF) +OBJDUMP?=$(TOOLS)/arm-binutils/objdump$(BIN_SUF) + +TARG_OPTS=\ + --name main \ + -fentry=em__start \ + -fno-lto \ + -fsingle-threaded \ + -fno-strip \ + -mcpu cortex_m0plus \ + -target thumb-freestanding-eabi \ + -O ReleaseSmall \ + -femit-asm=$(OUT)/main.asm \ + -femit-bin=$(OUT)/main.out \ + +targ: + @zig build-exe -I. $(TARG_OPTS) --script $(OUT)/linkcmd.ld $(OUT)/startup.c $(MAIN) + @rm -f $(OUT)/main.out.o + @$(OBJCOPY) -O ihex $(OUT)/main.out $(OUT)/main.out.hex + @$(OBJDUMP) -h -d $(OUT)/main.out >$(OUT)/main.out.dis + @$(OBJDUMP) -t $(OUT)/main.out | tail -n +5 | sed -e 's/[FO] / /' | sed -e 's/df / /' >$(OUT)/main.out.sym + @sort -k1 $(OUT)/main.out.sym > $(OUT)/main.out.syma + @sort -k5 $(OUT)/main.out.sym > $(OUT)/main.out.symn + @$(SHA256) $(OUT)/main.out.hex | cut -c -8 >$(OUT)/main.out.sha32 + @$(OBJDUMP) -h $(OUT)/main.out + +load: + @$(UNIFLASH) --mode noConnectFlash -c ti.cc23xx/ti.distro.cc23xx/CC2340R5.ccxml $(OUT)/main.out + diff --git a/workspace/em.arch/em-bundle.ini b/workspace/em.arch/em-bundle.ini deleted file mode 100644 index b4c4656c..00000000 --- a/workspace/em.arch/em-bundle.ini +++ /dev/null @@ -1,3 +0,0 @@ -[em.lang] - - BundleName = em.arch diff --git a/workspace/em.arch/em.arch.arm/GlobalInterrupts.em.zig b/workspace/em.arch/em.arch.arm/GlobalInterrupts.em.zig deleted file mode 100644 index 3b4ba80c..00000000 --- a/workspace/em.arch/em.arch.arm/GlobalInterrupts.em.zig +++ /dev/null @@ -1,44 +0,0 @@ -pub const em = @import("../../.gen/em.zig"); -pub const em__U = em.module(@This(), .{ - .inherits = em.import.@"em.hal/GlobalInterruptsI", -}); - -pub const EM__HOST = struct { - // -}; - -pub const EM__TARG = struct { - // - pub fn disable() u32 { - const key = get_PRIMASK(); - set_PRIMASK(1); - return key; - } - - pub fn enable() void { - set_PRIMASK(0); - } - - pub fn restore(key: u32) void { - set_PRIMASK(key); - } - - fn get_PRIMASK() u32 { - const key: u32 = 0; - asm volatile ( - \\mrs %[key], primask - : - : [key] "r" (key), - : "memory" - ); - return key; - } - - fn set_PRIMASK(m: u32) void { - asm volatile ("msr primask, %[m]" - : - : [m] "r" (m), - : "memory" - ); - } -}; diff --git a/workspace/em.build/em-bundle.ini b/workspace/em.build/em-bundle.ini deleted file mode 100644 index 9fd6d8ab..00000000 --- a/workspace/em.build/em-bundle.ini +++ /dev/null @@ -1,3 +0,0 @@ -[em.lang] - - BundleName = em.build diff --git a/workspace/em.core/em-bundle.ini b/workspace/em.core/em-bundle.ini deleted file mode 100644 index 1c7de414..00000000 --- a/workspace/em.core/em-bundle.ini +++ /dev/null @@ -1,3 +0,0 @@ -[em.lang] - - BundleName = em.core diff --git a/workspace/em.core/em.arch.arm/GlobalInterrupts.em.zig b/workspace/em.core/em.arch.arm/GlobalInterrupts.em.zig new file mode 100644 index 00000000..e9d4ef43 --- /dev/null +++ b/workspace/em.core/em.arch.arm/GlobalInterrupts.em.zig @@ -0,0 +1,37 @@ +pub const em = @import("../../zigem/em.zig"); +pub const em__U = em.module(@This(), .{ + .inherits = em.import.@"em.hal/GlobalInterruptsI", +}); + +pub const EM__META = struct { + // +}; + +pub const EM__TARG = struct { + // + pub fn disable() u32 { + const key = get_PRIMASK(); + asm volatile ("cpsid i" ::: "memory"); + // set_PRIMASK(1); + return key; + } + + pub fn enable() void { + asm volatile ("cpsie i" ::: "memory"); + } + + pub fn isEnabled() bool { + return get_PRIMASK() == 0; + } + + pub fn restore(key: u32) void { + if (key == 0) enable(); + } + + pub fn get_PRIMASK() u32 { + return asm volatile ( + \\mrs %[ret], primask + : [ret] "={r0}" (-> u32), + ); + } +}; diff --git a/workspace/em.arch/em.arch.arm/IntrVec.em.zig b/workspace/em.core/em.arch.arm/IntrVec.em.zig similarity index 97% rename from workspace/em.arch/em.arch.arm/IntrVec.em.zig rename to workspace/em.core/em.arch.arm/IntrVec.em.zig index 3e32c44a..9b644f3a 100644 --- a/workspace/em.arch/em.arch.arm/IntrVec.em.zig +++ b/workspace/em.core/em.arch.arm/IntrVec.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -8,11 +8,11 @@ pub const EM__CONFIG = struct { }; export fn DEFAULT_isr() void { - if (em.hosted) return; + if (em.IS_META) return; em__U.scope().defaultIsr(); } -pub const EM__HOST = struct { +pub const EM__META = struct { // var name_tab = em__C.name_tab; var used_tab = em__C.used_tab; diff --git a/workspace/em.arch/em.arch.arm/StartupH.em.zig b/workspace/em.core/em.arch.arm/StartupH.em.zig similarity index 98% rename from workspace/em.arch/em.arch.arm/StartupH.em.zig rename to workspace/em.core/em.arch.arm/StartupH.em.zig index 81472096..ecde27d0 100644 --- a/workspace/em.arch/em.arch.arm/StartupH.em.zig +++ b/workspace/em.core/em.arch.arm/StartupH.em.zig @@ -1,9 +1,9 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ - .host_only = true, + .meta_only = true, }); -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn em__generateH() void { genArmStartup(); @@ -26,7 +26,7 @@ pub const EM__HOST = struct { \\extern uint32_t __global_pointer__; \\extern uint32_t __stack_top__; \\ - \\extern void main(); + \\extern void zigem_main(); \\extern bool __is_warm(); \\ \\typedef struct { @@ -66,7 +66,7 @@ pub const EM__HOST = struct { \\#endif \\ } \\ - \\ main(); + \\ zigem_main(); \\ __builtin_unreachable(); \\} \\ @@ -92,7 +92,7 @@ pub const EM__HOST = struct { \\ \\#include "arm-startup.c" \\ - \\extern void main(); + \\extern void zigem_main(); \\ \\bool __is_warm() { \\ return false; diff --git a/workspace/em.arch/em.arch.arm/cmsis/cmsis_armclang.h b/workspace/em.core/em.arch.arm/cmsis/cmsis_armclang.h similarity index 100% rename from workspace/em.arch/em.arch.arm/cmsis/cmsis_armclang.h rename to workspace/em.core/em.arch.arm/cmsis/cmsis_armclang.h diff --git a/workspace/em.arch/em.arch.arm/cmsis/cmsis_compiler.h b/workspace/em.core/em.arch.arm/cmsis/cmsis_compiler.h similarity index 100% rename from workspace/em.arch/em.arch.arm/cmsis/cmsis_compiler.h rename to workspace/em.core/em.arch.arm/cmsis/cmsis_compiler.h diff --git a/workspace/em.arch/em.arch.arm/cmsis/cmsis_gcc.h b/workspace/em.core/em.arch.arm/cmsis/cmsis_gcc.h similarity index 100% rename from workspace/em.arch/em.arch.arm/cmsis/cmsis_gcc.h rename to workspace/em.core/em.arch.arm/cmsis/cmsis_gcc.h diff --git a/workspace/em.arch/em.arch.arm/cmsis/cmsis_iccarm.h b/workspace/em.core/em.arch.arm/cmsis/cmsis_iccarm.h similarity index 100% rename from workspace/em.arch/em.arch.arm/cmsis/cmsis_iccarm.h rename to workspace/em.core/em.arch.arm/cmsis/cmsis_iccarm.h diff --git a/workspace/em.arch/em.arch.arm/cmsis/cmsis_version.h b/workspace/em.core/em.arch.arm/cmsis/cmsis_version.h similarity index 100% rename from workspace/em.arch/em.arch.arm/cmsis/cmsis_version.h rename to workspace/em.core/em.arch.arm/cmsis/cmsis_version.h diff --git a/workspace/em.arch/em.arch.arm/cmsis/core_cm0plus.h b/workspace/em.core/em.arch.arm/cmsis/core_cm0plus.h similarity index 100% rename from workspace/em.arch/em.arch.arm/cmsis/core_cm0plus.h rename to workspace/em.core/em.arch.arm/cmsis/core_cm0plus.h diff --git a/workspace/em.arch/em.arch.arm/cmsis/mpu_armv7.h b/workspace/em.core/em.arch.arm/cmsis/mpu_armv7.h similarity index 100% rename from workspace/em.arch/em.arch.arm/cmsis/mpu_armv7.h rename to workspace/em.core/em.arch.arm/cmsis/mpu_armv7.h diff --git a/workspace/em.arch/em.arch.arm/cmsis/test.zig b/workspace/em.core/em.arch.arm/cmsis/test.zig similarity index 100% rename from workspace/em.arch/em.arch.arm/cmsis/test.zig rename to workspace/em.core/em.arch.arm/cmsis/test.zig diff --git a/workspace/em.build/em.build.misc/LinkerH.em.zig b/workspace/em.core/em.build.misc/LinkerH.em.zig similarity index 97% rename from workspace/em.build/em.build.misc/LinkerH.em.zig rename to workspace/em.core/em.build.misc/LinkerH.em.zig index 81d4dd97..4c616d76 100644 --- a/workspace/em.build/em.build.misc/LinkerH.em.zig +++ b/workspace/em.core/em.build.misc/LinkerH.em.zig @@ -1,9 +1,9 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ - .host_only = true, + .meta_only = true, }); -pub const EM__HOST = struct { +pub const EM__META = struct { // const flash_txt = \\MEMORY { diff --git a/workspace/em.test/em.examples.basic/Alarm1P.em.zig b/workspace/em.core/em.examples.basic/Alarm1P.em.zig similarity index 93% rename from workspace/em.test/em.examples.basic/Alarm1P.em.zig rename to workspace/em.core/em.examples.basic/Alarm1P.em.zig index c6765452..385cb8b4 100644 --- a/workspace/em.test/em.examples.basic/Alarm1P.em.zig +++ b/workspace/em.core/em.examples.basic/Alarm1P.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -11,7 +11,7 @@ pub const AlarmMgr = em.import.@"em.utils/AlarmMgr"; pub const AppLed = em.import.@"em__distro/BoardC".AppLed; pub const FiberMgr = em.import.@"em.utils/FiberMgr"; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn em__constructH() void { const blinkF = FiberMgr.createH(em__U.fxn("blinkFB", FiberMgr.BodyArg)); diff --git a/workspace/em.test/em.examples.basic/Alarm2P.em.zig b/workspace/em.core/em.examples.basic/Alarm2P.em.zig similarity index 93% rename from workspace/em.test/em.examples.basic/Alarm2P.em.zig rename to workspace/em.core/em.examples.basic/Alarm2P.em.zig index d688a095..1924a4d2 100644 --- a/workspace/em.test/em.examples.basic/Alarm2P.em.zig +++ b/workspace/em.core/em.examples.basic/Alarm2P.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -11,7 +11,7 @@ pub const AlarmMgr = em.import.@"em.utils/AlarmMgr"; pub const AppLed = em.import.@"em__distro/BoardC".AppLed; pub const FiberMgr = em.import.@"em.utils/FiberMgr"; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn em__constructH() void { const blinkF = FiberMgr.createH(em__U.fxn("blinkFB", FiberMgr.BodyArg)); diff --git a/workspace/em.test/em.examples.basic/BlinkerDbgP.em.zig b/workspace/em.core/em.examples.basic/BlinkerDbgP.em.zig similarity index 94% rename from workspace/em.test/em.examples.basic/BlinkerDbgP.em.zig rename to workspace/em.core/em.examples.basic/BlinkerDbgP.em.zig index 6d5e365a..ac53b78f 100644 --- a/workspace/em.test/em.examples.basic/BlinkerDbgP.em.zig +++ b/workspace/em.core/em.examples.basic/BlinkerDbgP.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -11,7 +11,7 @@ pub const EM__CONFIG = struct { pub const BoardC = em.import.@"em__distro/BoardC"; pub const Common = em.import.@"em.mcu/Common"; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn em__initH() void { em__C.dbg_flag.set(true); diff --git a/workspace/em.test/em.examples.basic/BlinkerP.em.zig b/workspace/em.core/em.examples.basic/BlinkerP.em.zig similarity index 88% rename from workspace/em.test/em.examples.basic/BlinkerP.em.zig rename to workspace/em.core/em.examples.basic/BlinkerP.em.zig index c45d32ab..c2274dec 100644 --- a/workspace/em.test/em.examples.basic/BlinkerP.em.zig +++ b/workspace/em.core/em.examples.basic/BlinkerP.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const AppLed = em.import.@"em__distro/BoardC".AppLed; diff --git a/workspace/em.test/em.examples.basic/Button1P.em.zig b/workspace/em.core/em.examples.basic/Button1P.em.zig similarity index 93% rename from workspace/em.test/em.examples.basic/Button1P.em.zig rename to workspace/em.core/em.examples.basic/Button1P.em.zig index 9a7b517d..e79215d8 100644 --- a/workspace/em.test/em.examples.basic/Button1P.em.zig +++ b/workspace/em.core/em.examples.basic/Button1P.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -10,7 +10,7 @@ pub const AppButEdge = em.import.@"em__distro/BoardC".AppButEdge; pub const AppLed = em.import.@"em__distro/BoardC".AppLed; pub const Common = em.import.@"em.mcu/Common"; -pub const EM__HOST = struct { +pub const EM__META = struct { pub fn em__constructH() void { AppButEdge.setDetectHandlerH(em__U.fxn("handler", AppButEdge.HandlerArg)); } diff --git a/workspace/em.test/em.examples.basic/Button2P.em.zig b/workspace/em.core/em.examples.basic/Button2P.em.zig similarity index 94% rename from workspace/em.test/em.examples.basic/Button2P.em.zig rename to workspace/em.core/em.examples.basic/Button2P.em.zig index 26a54cb7..db2a9ff3 100644 --- a/workspace/em.test/em.examples.basic/Button2P.em.zig +++ b/workspace/em.core/em.examples.basic/Button2P.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -12,7 +12,7 @@ pub const AppLed = em.import.@"em__distro/BoardC".AppLed; pub const Common = em.import.@"em.mcu/Common"; pub const FiberMgr = em.import.@"em.utils/FiberMgr"; -pub const EM__HOST = struct { +pub const EM__META = struct { pub fn em__constructH() void { AppButEdge.setDetectHandlerH(em__U.fxn("handler", AppButEdge.HandlerArg)); const blinkF = FiberMgr.createH(em__U.fxn("blinkFB", FiberMgr.BodyArg)); diff --git a/workspace/em.test/em.examples.basic/Button3P.em.zig b/workspace/em.core/em.examples.basic/Button3P.em.zig similarity index 92% rename from workspace/em.test/em.examples.basic/Button3P.em.zig rename to workspace/em.core/em.examples.basic/Button3P.em.zig index efca4f13..88c56bac 100644 --- a/workspace/em.test/em.examples.basic/Button3P.em.zig +++ b/workspace/em.core/em.examples.basic/Button3P.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -12,7 +12,7 @@ pub const Common = em.import.@"em.mcu/Common"; pub const FiberMgr = em.import.@"em.utils/FiberMgr"; pub const SysLed = em.import.@"em__distro/BoardC".SysLed; -pub const EM__HOST = struct {}; +pub const EM__META = struct {}; pub const EM__TARG = struct { // diff --git a/workspace/em.test/em.examples.basic/EmptyP.em.zig b/workspace/em.core/em.examples.basic/EmptyP.em.zig similarity index 69% rename from workspace/em.test/em.examples.basic/EmptyP.em.zig rename to workspace/em.core/em.examples.basic/EmptyP.em.zig index 8f0445a4..19bfefd3 100644 --- a/workspace/em.test/em.examples.basic/EmptyP.em.zig +++ b/workspace/em.core/em.examples.basic/EmptyP.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const EM__TARG = struct { diff --git a/workspace/em.test/em.examples.basic/FiberP.em.zig b/workspace/em.core/em.examples.basic/FiberP.em.zig similarity index 92% rename from workspace/em.test/em.examples.basic/FiberP.em.zig rename to workspace/em.core/em.examples.basic/FiberP.em.zig index d047bfaf..9b23e3ae 100644 --- a/workspace/em.test/em.examples.basic/FiberP.em.zig +++ b/workspace/em.core/em.examples.basic/FiberP.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -10,7 +10,7 @@ pub const AppLed = em.import.@"em__distro/BoardC".AppLed; pub const Common = em.import.@"em.mcu/Common"; pub const FiberMgr = em.import.@"em.utils/FiberMgr"; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn em__constructH() void { const blinkF = FiberMgr.createH(em__U.fxn("blinkFB", FiberMgr.BodyArg)); diff --git a/workspace/em.test/em.examples.basic/HelloP.em.zig b/workspace/em.core/em.examples.basic/HelloP.em.zig similarity index 76% rename from workspace/em.test/em.examples.basic/HelloP.em.zig rename to workspace/em.core/em.examples.basic/HelloP.em.zig index 481a27ad..217917e9 100644 --- a/workspace/em.test/em.examples.basic/HelloP.em.zig +++ b/workspace/em.core/em.examples.basic/HelloP.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const EM__TARG = struct { diff --git a/workspace/em.test/em.examples.basic/OneShot1P.em.zig b/workspace/em.core/em.examples.basic/OneShot1P.em.zig similarity index 91% rename from workspace/em.test/em.examples.basic/OneShot1P.em.zig rename to workspace/em.core/em.examples.basic/OneShot1P.em.zig index 741d74a5..0b667eee 100644 --- a/workspace/em.test/em.examples.basic/OneShot1P.em.zig +++ b/workspace/em.core/em.examples.basic/OneShot1P.em.zig @@ -1,11 +1,11 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const AppLed = em.import.@"em__distro/BoardC".AppLed; pub const Common = em.import.@"em.mcu/Common"; pub const OneShot = em.import.@"em__distro/BoardC".OneShot; -pub const EM__HOST = struct { +pub const EM__META = struct { // }; diff --git a/workspace/em.test/em.examples.basic/OneShot2P.em.zig b/workspace/em.core/em.examples.basic/OneShot2P.em.zig similarity index 93% rename from workspace/em.test/em.examples.basic/OneShot2P.em.zig rename to workspace/em.core/em.examples.basic/OneShot2P.em.zig index 55117596..219dc00a 100644 --- a/workspace/em.test/em.examples.basic/OneShot2P.em.zig +++ b/workspace/em.core/em.examples.basic/OneShot2P.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -11,7 +11,7 @@ pub const Common = em.import.@"em.mcu/Common"; pub const FiberMgr = em.import.@"em.utils/FiberMgr"; pub const OneShot = em.import.@"em__distro/BoardC".OneShot; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn em__constructH() void { em__C.blinkF.set(FiberMgr.createH(em__U.fxn("blinkFB", FiberMgr.BodyArg))); diff --git a/workspace/em.test/em.examples.basic/PollerP.em.zig b/workspace/em.core/em.examples.basic/PollerP.em.zig similarity index 85% rename from workspace/em.test/em.examples.basic/PollerP.em.zig rename to workspace/em.core/em.examples.basic/PollerP.em.zig index 2e89cad7..0ccf2752 100644 --- a/workspace/em.test/em.examples.basic/PollerP.em.zig +++ b/workspace/em.core/em.examples.basic/PollerP.em.zig @@ -1,11 +1,11 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const AppLed = em.import.@"em__distro/BoardC".AppLed; pub const Common = em.import.@"em.mcu/Common"; pub const Poller = em.import.@"em.mcu/Poller"; -pub const EM__HOST = struct { +pub const EM__META = struct { // }; diff --git a/workspace/em.test/em.examples.basic/TickerP.em.zig b/workspace/em.core/em.examples.basic/TickerP.em.zig similarity index 55% rename from workspace/em.test/em.examples.basic/TickerP.em.zig rename to workspace/em.core/em.examples.basic/TickerP.em.zig index f3c8562d..ef57d8ef 100644 --- a/workspace/em.test/em.examples.basic/TickerP.em.zig +++ b/workspace/em.core/em.examples.basic/TickerP.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -12,7 +12,7 @@ pub const FiberMgr = em.import.@"em.utils/FiberMgr"; pub const TickerMgr = em.import.@"em.utils/TickerMgr"; pub const SysLed = em.import.@"em__distro/BoardC".SysLed; -pub const EM__HOST = struct { +pub const EM__META = struct { pub fn em__constructH() void { em__C.appTicker.set(TickerMgr.createH()); em__C.sysTicker.set(TickerMgr.createH()); @@ -40,47 +40,3 @@ pub const EM__TARG = struct { SysLed.wink(100); } }; - -//package em.examples.basic -// -//from em$distro import BoardC -//from BoardC import AppLed -//from BoardC import SysLed -// -//from em.utils import FiberMgr -//from em.utils import TickerMgr -// -//module TickerP -// -//private: -// -// function appTickCb: TickerMgr.TickCallback -// function sysTickCb: TickerMgr.TickCallback -// -// config appTicker: TickerMgr.Ticker& -// config sysTicker: TickerMgr.Ticker& -// -//end -// -//def em$construct() -// appTicker = TickerMgr.createH() -// sysTicker = TickerMgr.createH() -//end -// -//def em$run() -// appTicker.start(256, appTickCb) -// sysTicker.start(384, sysTickCb) -// FiberMgr.run() -//end -// -//def appTickCb() -// %%[c] -// AppLed.wink(100) -//end -// -//def sysTickCb() -// %%[d] -// SysLed.wink(100) -//end -// -// diff --git a/workspace/em.core/em.hal/BusyWaitI.em.zig b/workspace/em.core/em.hal/BusyWaitI.em.zig index 0c43ac3a..fb887dc7 100644 --- a/workspace/em.core/em.hal/BusyWaitI.em.zig +++ b/workspace/em.core/em.hal/BusyWaitI.em.zig @@ -1,6 +1,8 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); -pub fn wait(usecs: u32) void { - _ = usecs; -} +pub const EM__TARG = struct { + pub fn wait(usecs: u32) void { + _ = usecs; + } +}; diff --git a/workspace/em.core/em.hal/ButtonI.em.zig b/workspace/em.core/em.hal/ButtonI.em.zig index 2b188675..74241418 100644 --- a/workspace/em.core/em.hal/ButtonI.em.zig +++ b/workspace/em.core/em.hal/ButtonI.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); pub const DurationMs = struct { @@ -9,11 +9,12 @@ pub const DurationMs = struct { pub const OnPressedCbFxn = em.Fxn(OnPressedCbArg); pub const OnPressedCbArg = struct {}; -pub fn isPressed() bool { - return false; -} - -pub fn onPressed(cb: OnPressedCbFxn, dur: DurationMs) void { - _ = cb; - _ = dur; -} +pub const EM__TARG = struct { + pub fn isPressed() bool { + return false; + } + pub fn onPressed(cb: OnPressedCbFxn, dur: DurationMs) void { + _ = cb; + _ = dur; + } +}; diff --git a/workspace/em.core/em.hal/ConsoleUartI.em.zig b/workspace/em.core/em.hal/ConsoleUartI.em.zig index 88b25388..7e22c7da 100644 --- a/workspace/em.core/em.hal/ConsoleUartI.em.zig +++ b/workspace/em.core/em.hal/ConsoleUartI.em.zig @@ -1,11 +1,12 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); -pub fn flush() void { - return; -} - -pub fn put(data: u8) void { - _ = data; - return; -} +pub const EM__TARG = struct { + pub fn flush() void { + return; + } + pub fn put(data: u8) void { + _ = data; + return; + } +}; diff --git a/workspace/em.core/em.hal/GlobalInterruptsI.em.zig b/workspace/em.core/em.hal/GlobalInterruptsI.em.zig index 8bf5335d..64f2bd88 100644 --- a/workspace/em.core/em.hal/GlobalInterruptsI.em.zig +++ b/workspace/em.core/em.hal/GlobalInterruptsI.em.zig @@ -1,15 +1,18 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); -pub fn disable() u32 { - return 0; -} - -pub fn enable() void { - return; -} - -pub fn restore(key: u32) void { - _ = key; - return; -} +pub const EM__TARG = struct { + pub fn disable() u32 { + return 0; + } + pub fn enable() void { + return; + } + pub fn isEnabled() bool { + return false; + } + pub fn restore(key: u32) void { + _ = key; + return; + } +}; diff --git a/workspace/em.core/em.hal/GpioEdgeI.em.zig b/workspace/em.core/em.hal/GpioEdgeI.em.zig index 0a3ab20f..162046ef 100644 --- a/workspace/em.core/em.hal/GpioEdgeI.em.zig +++ b/workspace/em.core/em.hal/GpioEdgeI.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{ .inherits = em.import.@"em.hal/GpioI", }); @@ -6,27 +6,27 @@ pub const em__U = em.interface(@This(), .{ pub const HandlerFxn = em.Fxn(HandlerArg); pub const HandlerArg = struct {}; -pub fn setDetectHandlerH(h: HandlerFxn) void { - _ = h; - return; -} +pub const EM__META = struct { + pub fn setDetectHandlerH(h: HandlerFxn) void { + _ = h; + return; + } +}; -pub fn clearDetect() void { - return; -} - -pub fn disableDetect() void { - return; -} - -pub fn enableDetect() void { - return; -} - -pub fn setDetectFallingEdge() void { - return; -} - -pub fn setDetectRisingEdge() void { - return; -} +pub const EM__TARG = struct { + pub fn clearDetect() void { + return; + } + pub fn disableDetect() void { + return; + } + pub fn enableDetect() void { + return; + } + pub fn setDetectFallingEdge() void { + return; + } + pub fn setDetectRisingEdge() void { + return; + } +}; diff --git a/workspace/em.core/em.hal/GpioI.em.zig b/workspace/em.core/em.hal/GpioI.em.zig index 0a401479..53b64022 100644 --- a/workspace/em.core/em.hal/GpioI.em.zig +++ b/workspace/em.core/em.hal/GpioI.em.zig @@ -1,52 +1,43 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); -pub fn clear() void { - return; -} - -pub fn functionSelect(select: u8) void { - _ = select; - return; -} - -pub fn get() bool { - return false; -} - -pub fn isInput() bool { - return false; -} - -pub fn isOutput() bool { - return false; -} - -pub fn makeInput() void { - return; -} - -pub fn makeOutput() void { - return; -} - -pub fn pinId() i16 { - return -1; -} - -pub fn reset() void { - return; -} - -pub fn set() void { - return; -} - -pub fn setInternalPullup(enable: bool) void { - _ = enable; - return; -} - -pub fn toggle() void { - return; -} +pub const EM__TARG = struct { + pub fn clear() void { + return; + } + pub fn functionSelect(select: u8) void { + _ = select; + return; + } + pub fn get() bool { + return false; + } + pub fn isInput() bool { + return false; + } + pub fn isOutput() bool { + return false; + } + pub fn makeInput() void { + return; + } + pub fn makeOutput() void { + return; + } + pub fn pinId() i16 { + return -1; + } + pub fn reset() void { + return; + } + pub fn set() void { + return; + } + pub fn setInternalPullup(enable: bool) void { + _ = enable; + return; + } + pub fn toggle() void { + return; + } +}; diff --git a/workspace/em.core/em.hal/IdleI.em.zig b/workspace/em.core/em.hal/IdleI.em.zig index 301f7598..94ee9dbc 100644 --- a/workspace/em.core/em.hal/IdleI.em.zig +++ b/workspace/em.core/em.hal/IdleI.em.zig @@ -1,10 +1,11 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); -pub fn exec() void { - return; -} - -pub fn wakeup() void { - return; -} +pub const EM__TARG = struct { + pub fn exec() void { + return; + } + pub fn wakeup() void { + return; + } +}; diff --git a/workspace/em.core/em.hal/LedI.em.zig b/workspace/em.core/em.hal/LedI.em.zig index e494849a..0905b7d6 100644 --- a/workspace/em.core/em.hal/LedI.em.zig +++ b/workspace/em.core/em.hal/LedI.em.zig @@ -1,14 +1,14 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); -pub fn off() void { - return; -} - -pub fn on() void { - return; -} - -pub fn toggle() void { - return; -} +pub const EM__TARG = struct { + pub fn off() void { + return; + } + pub fn on() void { + return; + } + pub fn toggle() void { + return; + } +}; diff --git a/workspace/em.core/em.hal/McuI.em.zig b/workspace/em.core/em.hal/McuI.em.zig index 54e595a4..d5ff287b 100644 --- a/workspace/em.core/em.hal/McuI.em.zig +++ b/workspace/em.core/em.hal/McuI.em.zig @@ -1,6 +1,8 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); -pub fn startup() void { - return; -} +pub const EM__TARG = struct { + pub fn startup() void { + return; + } +}; diff --git a/workspace/em.core/em.hal/MsCounterI.em.zig b/workspace/em.core/em.hal/MsCounterI.em.zig index c5213a94..57449fea 100644 --- a/workspace/em.core/em.hal/MsCounterI.em.zig +++ b/workspace/em.core/em.hal/MsCounterI.em.zig @@ -1,10 +1,11 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); -pub fn start() void { - return; -} - -pub fn stop() u32 { - return 0; -} +pub const EM__TARG = struct { + pub fn start() void { + return; + } + pub fn stop() u32 { + return 0; + } +}; diff --git a/workspace/em.core/em.hal/OneShotMilliI.em.zig b/workspace/em.core/em.hal/OneShotMilliI.em.zig index aedf4705..42cafd9a 100644 --- a/workspace/em.core/em.hal/OneShotMilliI.em.zig +++ b/workspace/em.core/em.hal/OneShotMilliI.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); pub const HandlerFxn = em.Fxn(HandlerArg); @@ -6,13 +6,14 @@ pub const HandlerArg = struct { arg: em.ptr_t, }; -pub fn disable() void { - return; -} - -pub fn enable(msecs: u32, handler: HandlerFxn, arg: em.ptr_t) void { - _ = msecs; - _ = handler; - _ = arg; - return; -} +pub const EM__TARG = struct { + pub fn disable() void { + return; + } + pub fn enable(msecs: u32, handler: HandlerFxn, arg: em.ptr_t) void { + _ = msecs; + _ = handler; + _ = arg; + return; + } +}; diff --git a/workspace/em.core/em.hal/UptimerI.em.zig b/workspace/em.core/em.hal/UptimerI.em.zig index 61c820ef..8a5b80a3 100644 --- a/workspace/em.core/em.hal/UptimerI.em.zig +++ b/workspace/em.core/em.hal/UptimerI.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); pub const Time = struct { @@ -7,24 +7,23 @@ pub const Time = struct { ticks: u32 = 0, }; -pub fn calibrate(secs256: u32, ticks: u32) u16 { - // TODO - _ = secs256; - _ = ticks; - return 0; -} - -pub fn read() *const Time { - // TODO - return @ptrFromInt(0); -} - -pub fn resetSync() void { - // TODO - return; -} - -pub fn trim() u16 { - // TODO - return 0; -} +pub const EM__TARG = struct { + pub fn calibrate(secs256: u32, ticks: u32) u16 { + // TODO + _ = secs256; + _ = ticks; + return 0; + } + pub fn read() *const Time { + // TODO + return @ptrFromInt(4); + } + pub fn resetSync() void { + // TODO + return; + } + pub fn trim() u16 { + // TODO + return 0; + } +}; diff --git a/workspace/em.core/em.hal/UsCounterI.em.zig b/workspace/em.core/em.hal/UsCounterI.em.zig index 7e08fc40..4bcf1da8 100644 --- a/workspace/em.core/em.hal/UsCounterI.em.zig +++ b/workspace/em.core/em.hal/UsCounterI.em.zig @@ -1,11 +1,12 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); -pub fn start() void { - return; -} - -pub fn stop(o_raw: ?*u32) u32 { - _ = o_raw; - return 0; -} +pub const EM__TARG = struct { + pub fn start() void { + return; + } + pub fn stop(o_raw: ?*u32) u32 { + _ = o_raw; + return 0; + } +}; diff --git a/workspace/em.core/em.hal/WakeupTimerI.em.zig b/workspace/em.core/em.hal/WakeupTimerI.em.zig index f90e8aa2..9516a051 100644 --- a/workspace/em.core/em.hal/WakeupTimerI.em.zig +++ b/workspace/em.core/em.hal/WakeupTimerI.em.zig @@ -1,31 +1,29 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.interface(@This(), .{}); pub const HandlerFxn = em.Fxn(HandlerArg); pub const HandlerArg = struct {}; -pub fn disable() void { - return; -} - -pub fn enable(thresh: u32, handler: HandlerFxn) void { - _ = thresh; - _ = handler; - return; -} - -pub fn secs256ToTicks(secs256: u32) u32 { - _ = secs256; - return 0; -} - -pub fn ticksToThresh(ticks: u32) u32 { - _ = ticks; - return 0; -} - -pub fn timeToTicks(secs: u32, subs: u32) u32 { - _ = secs; - _ = subs; - return 0; -} +pub const EM__TARG = struct { + pub fn disable() void { + return; + } + pub fn enable(thresh: u32, handler: HandlerFxn) void { + _ = thresh; + _ = handler; + return; + } + pub fn secs256ToTicks(secs256: u32) u32 { + _ = secs256; + return 0; + } + pub fn ticksToThresh(ticks: u32) u32 { + _ = ticks; + return 0; + } + pub fn timeToTicks(secs: u32, subs: u32) u32 { + _ = secs; + _ = subs; + return 0; + } +}; diff --git a/workspace/em.core/em.lang/Console.em.zig b/workspace/em.core/em.lang/Console.em.zig index 3e0e3119..699da631 100644 --- a/workspace/em.core/em.lang/Console.em.zig +++ b/workspace/em.core/em.lang/Console.em.zig @@ -1,11 +1,11 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const Common = em.import.@"em.mcu/Common"; pub const Error = error{}; -pub const EM__HOST = struct { +pub const EM__META = struct { // }; diff --git a/workspace/em.core/em.lang/Debug.em.zig b/workspace/em.core/em.lang/Debug.em.zig index 8bc059b5..79786c41 100644 --- a/workspace/em.core/em.lang/Debug.em.zig +++ b/workspace/em.core/em.lang/Debug.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -12,7 +12,7 @@ pub const EM__CONFIG = struct { const Common = em.import.@"em.mcu/Common"; const GpioI = em.import.@"em.hal/GpioI"; -pub const EM__HOST = struct { +pub const EM__META = struct { pub const DbgA = em__C.DbgA; pub const DbgB = em__C.DbgB; pub const DbgC = em__C.DbgC; @@ -30,7 +30,14 @@ pub const EM__TARG = struct { Common.BusyWait.wait(1); } - pub fn mark(comptime id: u8, k: u8) void { + pub fn mark(comptime id: u8, e: anytype) void { + const ti = @typeInfo(@TypeOf(e)); + const k: u8 = switch (ti) { + .Bool => @intFromBool(e), + .Enum => @intFromEnum(e), + .Int, .ComptimeInt => em.@"<>"(u8, e), + else => 0, + }; for (0..k + 1) |_| { pulse(id); } diff --git a/workspace/em.core/em.lang/em.zig b/workspace/em.core/em.lang/em.zig index d675da5b..2c7b84df 100644 --- a/workspace/em.core/em.lang/em.zig +++ b/workspace/em.core/em.lang/em.zig @@ -1,68 +1,56 @@ const @"// -------- EXECUTION DOMAIN -------- //" = {}; -const domain_desc = @import("../../.gen/domain.zig"); +const domain_desc = @import("../../zigem/domain.zig"); pub const Domain = domain_desc.Domain; pub const DOMAIN = domain_desc.DOMAIN; -pub const hosted = (DOMAIN == .HOST); +pub const IS_META = (DOMAIN == .META); const @"// -------- UNIT SPEC -------- //" = {}; -pub const UnitName = @import("../../.gen/unit_names.zig").UnitName; +pub const UnitName = @import("../../zigem/unit_names.zig").UnitName; fn mkUnit(This: type, kind: UnitKind, opts: UnitOpts) Unit { const un = if (opts.name != null) opts.name.? else @as([]const u8, @field(type_map, @typeName(This))); return Unit{ ._U = This, .generated = opts.generated, - .host_only = opts.host_only, + .meta_only = opts.meta_only, .inherits = if (opts.inherits == void) null else opts.inherits.em__U, + .Itab = if (kind == .interface) ItabType(unitScope(This)) else void, .kind = kind, .legacy = opts.legacy, .upath = un, }; } -pub fn composite(This: type, opts: UnitOpts) Unit { - return mkUnit(This, .composite, opts); -} - -pub fn interface(This: type, opts: UnitOpts) Unit { - return mkUnit(This, .interface, opts); -} - -pub fn module(This: type, opts: UnitOpts) Unit { - return mkUnit(This, .module, opts); -} - -pub fn template(This: type, opts: UnitOpts) Unit { - return mkUnit(This, .template, opts); -} - -fn ItabType(ImplT: type) type { +fn ItabType(T: type) type { comptime { - const ti = @typeInfo(ImplT); - var fld_list: []const std.builtin.Type.StructField = &.{}; + const ti = @typeInfo(T); + var fdecl_list: []const std.builtin.Type.Declaration = &.{}; for (ti.Struct.decls) |decl| { - if (!std.mem.eql(u8, decl.name, "em__I")) { - const dval = @field(ImplT, decl.name); + if (!isBuiltin(decl.name)) { + const dval = @field(T, decl.name); const dti = @typeInfo(@TypeOf(dval)); - if (dti == .Fn) { - const fld = std.builtin.Type.StructField{ - .name = decl.name, - .type = *const @TypeOf(dval), - .default_value = null, - .is_comptime = false, - .alignment = 0, - }; - fld_list = fld_list ++ ([_]std.builtin.Type.StructField{fld})[0..]; - } + if (dti == .Fn) fdecl_list = fdecl_list ++ ([_]std.builtin.Type.Declaration{decl})[0..]; } } - const freeze = fld_list; + var fld_list: [fdecl_list.len]std.builtin.Type.StructField = undefined; + for (fdecl_list, 0..) |fdecl, i| { + const func = @field(T, fdecl.name); + const func_ptr = &func; + fld_list[i] = std.builtin.Type.StructField{ + .name = fdecl.name, + .type = *const @TypeOf(func), + .default_value = @ptrCast(&func_ptr), + .is_comptime = false, + .alignment = 0, + }; + } + const fld_list_freeze = fld_list; return @Type(.{ .Struct = .{ .layout = .auto, - .fields = freeze, + .fields = fld_list_freeze[0..], .decls = &.{}, .is_tuple = false, .backing_integer = null, @@ -70,18 +58,65 @@ fn ItabType(ImplT: type) type { } } -pub fn mkItab(comptime ImplT: type) ItabType(ImplT) { - var itab: ItabType(ImplT) = undefined; - inline for (comptime std.meta.declarations(ImplT)) |decl| { - if (!std.mem.eql(u8, decl.name, "em__I")) { - const dval = @field(ImplT, decl.name); +fn mkIobj(Itab: type, U: type) Itab { + var iobj = Itab{}; + const ti = @typeInfo(Itab); + inline for (ti.Struct.fields) |fld| { + if (@hasDecl(U, fld.name)) { + @field(iobj, fld.name) = @field(U, fld.name); + } + } + const iobj_freeze = iobj; + return iobj_freeze; +} + +fn mkItab(U: type, I: type) *const anyopaque { + comptime { + const ti = @typeInfo(I); + var fdecl_list: []const std.builtin.Type.Declaration = &.{}; + for (ti.Struct.decls) |decl| { + const dval = @field(I, decl.name); const dti = @typeInfo(@TypeOf(dval)); - if (dti == .Fn) { - @field(itab, decl.name) = dval; - } + if (dti == .Fn) fdecl_list = fdecl_list ++ ([_]std.builtin.Type.Declaration{decl})[0..]; } + var fld_list: [fdecl_list.len]std.builtin.Type.StructField = undefined; + for (fdecl_list, 0..) |fdecl, i| { + const func = @field(U, fdecl.name); + const func_ptr = &func; + fld_list[i] = std.builtin.Type.StructField{ + .name = fdecl.name, + .type = *const @TypeOf(func), + .default_value = @ptrCast(&func_ptr), + .is_comptime = false, + .alignment = 0, + }; + } + const freeze = fld_list; + const ITab = @Type(.{ .Struct = .{ + .layout = .auto, + .fields = freeze[0..], + .decls = &.{}, + .is_tuple = false, + .backing_integer = null, + } }); + return @as(*const anyopaque, &ITab{}); } - return itab; +} + +pub fn composite(This: type, opts: UnitOpts) Unit { + return mkUnit(This, .composite, opts); +} + +pub fn interface(This: type, opts: UnitOpts) Unit { + return mkUnit(This, .interface, opts); +} + +pub fn module(This: type, opts: UnitOpts) Unit { + return mkUnit(This, .module, opts); +} + +pub fn template(This: type, opts: UnitOpts) Unit { + return mkUnit(This, .template, opts); } pub const UnitKind = enum { @@ -93,7 +128,7 @@ pub const UnitKind = enum { pub const UnitOpts = struct { name: ?[]const u8 = null, - host_only: bool = false, + meta_only: bool = false, legacy: bool = false, generated: bool = false, inherits: type = void, @@ -105,14 +140,15 @@ pub const Unit = struct { _U: type, kind: UnitKind, upath: []const u8, - host_only: bool = false, + meta_only: bool = false, legacy: bool = false, generated: bool = false, inherits: ?Unit, + Itab: type, pub fn config(self: Self, comptime CT: type) CT { switch (DOMAIN) { - .HOST => { + .META => { return initConfig(CT, self.upath); //const init = if (@hasField(CT, "em__upath")) .{ .em__upath = self.upath } else .{}; //return @constCast(&std.mem.zeroInit(CT, init)); @@ -141,14 +177,14 @@ pub const Unit = struct { return unitScope(Template_Unit.em__generateS(self.extendPath(as_name))); } - pub fn hasItab(self: Self) bool { - return self.inherits != null or self.kind == .interface; + pub fn hasInterface(self: Self, inter: Unit) bool { + comptime var iu = self.inherits; + inline while (iu) |iuval| : (iu = iuval.inherits) { + if (std.mem.eql(u8, iuval.upath, inter.upath)) return true; + } + return false; } - //pub fn itab(self: Self) if (self.hasItab()) ItabType(self.scope()) else void { - // return if (self.hasItab()) mkItab(self.scope()) else {}; - //} - pub fn resolve(self: Self) type { var it = std.mem.splitSequence(u8, self.upath, "__"); var U = @field(import, it.first()); @@ -165,11 +201,11 @@ pub const Unit = struct { pub fn unitScope(U: type) type { // TODO eliminate - return if (DOMAIN == .HOST) unitScope_H(U) else unitScope_T(U); + return if (DOMAIN == .META) unitScope_H(U) else unitScope_T(U); } pub fn unitScope_H(U: type) type { - const S = if (@hasDecl(U, "EM__HOST")) U.EM__HOST else struct {}; + const S = if (@hasDecl(U, "EM__META")) U.EM__META else struct {}; return struct { const _UID = @typeName(U) ++ "_scope"; pub usingnamespace U; @@ -231,7 +267,7 @@ const CfgId = struct { }; pub fn Factory(T: type) type { - return if (DOMAIN == .HOST) Factory_H(T) else Factory_T(T); + return if (DOMAIN == .META) Factory_H(T) else Factory_T(T); } pub fn Factory_H(T: type) type { @@ -288,7 +324,7 @@ pub fn Factory_H(T: type) type { const abs_txt = \\comptime {{ \\ asm (".globl \"{0s}${1d}\""); - \\ asm ("\"{0s}${1d}\" = \".gen.targ.{0s}__OBJARR\" + {1d} * " ++ @"{0s}__SIZE"); + \\ asm ("\"{0s}${1d}\" = \"zigem.targ.{0s}__OBJARR\" + {1d} * " ++ @"{0s}__SIZE"); \\}} \\extern const @"{0s}${1d}": usize; \\const @"{0s}__{1d}": *{2s} = @constCast(@ptrCast(&@"{0s}${1d}")); @@ -308,7 +344,7 @@ pub fn Factory_T(T: type) type { pub fn Fxn(PT: type) type { switch (DOMAIN) { - .HOST => { + .META => { return struct { const Self = @This(); pub const _em__builtin = {}; @@ -333,7 +369,7 @@ pub fn Fxn(PT: type) type { } pub fn Obj(T: type) type { - return if (DOMAIN == .HOST) Obj_H(T) else Obj_T(T); + return if (DOMAIN == .META) Obj_H(T) else Obj_T(T); } pub fn Obj_H(T: type) type { @@ -364,7 +400,7 @@ pub fn Obj_T(T: type) type { } pub fn Param(T: type) type { - return if (DOMAIN == .HOST) Param_H(T) else Param_T(T); + return if (DOMAIN == .META) Param_H(T) else Param_T(T); } pub fn Param_H(T: type) type { @@ -413,25 +449,34 @@ pub fn Param_T(T: type) type { } pub fn Proxy(I: type) type { - return if (DOMAIN == .HOST) Proxy_H(I) else Proxy_T(I); + return if (DOMAIN == .META) Proxy_H(I) else Proxy_T(I); } pub fn Proxy_H(I: type) type { return *struct { const Self = @This(); - pub const _em__builtin = {}; + const Iobj = I.em__U.Itab; + em__cfgid: CfgId, _upath: []const u8 = I.em__U.upath, + _iobj: Iobj = mkIobj(I.em__U.Itab, I.em__U.scope()), - //pub fn get(self: *const Self) Unit { - // return @field(import, self._upath).em__U; - //} + pub fn get(self: *const Self) Iobj { + return self._iobj; + } - pub fn set(self: *Self, x: anytype) void { - self._upath = x.em__U.upath; + pub fn set(self: *Self, mod: anytype) void { + const unit: Unit = mod.em__U; + std.debug.assert(unit.hasInterface(I.em__U)); + if (!unit.hasInterface(I.em__U)) { + std.log.err("unit {s} does not implement {s}", .{ unit.upath, I.em__U.upath }); + fail(); + } + self._upath = unit.upath; + self._iobj = mkIobj(I.em__U.Itab, unit.scope()); } pub fn toStringDecls(_: *const Self, comptime _: []const u8, comptime _: []const u8) []const u8 { @@ -458,7 +503,7 @@ pub fn Proxy_T(_: type) type { pub const TableAccess = enum { RO, RW }; pub fn Table(T: type, acc: TableAccess) type { - return if (DOMAIN == .HOST) Table_H(T, acc) else Table_T(T, acc); + return if (DOMAIN == .META) Table_H(T, acc) else Table_T(T, acc); } pub fn Table_H(comptime T: type, acc: TableAccess) type { @@ -525,7 +570,7 @@ const @"// -------- BUILTIN FXNS -------- //" = {}; pub fn fail() void { switch (DOMAIN) { - .HOST => { + .META => { std.log.err("em.fail", .{}); std.process.exit(1); }, @@ -537,7 +582,7 @@ pub fn fail() void { pub fn halt() void { switch (DOMAIN) { - .HOST => { + .META => { std.log.info("em.halt", .{}); std.process.exit(0); }, @@ -549,7 +594,7 @@ pub fn halt() void { pub fn print(comptime fmt: []const u8, args: anytype) void { switch (DOMAIN) { - .HOST => { + .META => { std.log.debug(fmt, args); }, .TARG => { @@ -577,8 +622,8 @@ pub fn @"%%[a+]"() void { pub fn @"%%[a-]"() void { Debug.minus('A'); } -pub fn @"%%[a:]"(k: u8) void { - Debug.mark('A', k); +pub fn @"%%[a:]"(e: anytype) void { + Debug.mark('A', e); } pub fn @"%%[b]"() void { @@ -590,8 +635,8 @@ pub fn @"%%[b+]"() void { pub fn @"%%[b-]"() void { Debug.minus('B'); } -pub fn @"%%[b:]"(k: u8) void { - Debug.mark('B', k); +pub fn @"%%[b:]"(e: anytype) void { + Debug.mark('B', e); } pub fn @"%%[c]"() void { @@ -603,8 +648,8 @@ pub fn @"%%[c+]"() void { pub fn @"%%[c-]"() void { Debug.minus('C'); } -pub fn @"%%[c:]"(k: u8) void { - Debug.mark('C', k); +pub fn @"%%[c:]"(e: anytype) void { + Debug.mark('C', e); } pub fn @"%%[d]"() void { @@ -616,8 +661,8 @@ pub fn @"%%[d+]"() void { pub fn @"%%[d-]"() void { Debug.minus('D'); } -pub fn @"%%[d:]"(k: u8) void { - Debug.mark('D', k); +pub fn @"%%[d:]"(e: anytype) void { + Debug.mark('D', e); } const @"// -------- MEM MGMT -------- //" = {}; @@ -630,8 +675,8 @@ pub fn getHeap() std.mem.Allocator { const @"// -------- TARGET GEN -------- //" = {}; -const targ = @import("../../.gen/targ.zig"); -const type_map = @import("../../.gen/type_map.zig"); +const targ = @import("../../zigem/targ.zig"); +const type_map = @import("../../zigem/type_map.zig"); fn mkTypeName(T: type) []const u8 { const ti = @typeInfo(T); @@ -669,7 +714,7 @@ fn mkUnitImport(upath: []const u8) []const u8 { return sb.get(); } -pub fn toStringAux(v: anytype) []const u8 { // use zig fmt after host build +pub fn toStringAux(v: anytype) []const u8 { // use zig fmt after meta build const T = @TypeOf(v); const ti = @typeInfo(T); const tn = @typeName(T); @@ -757,7 +802,7 @@ pub fn toStringPre(v: anytype, comptime upath: []const u8, comptime cname: []con const @"// -------- PROPERTY VALUES -------- //" = {}; -const props = @import("../../.gen/props.zig"); +const props = @import("../../zigem/props.zig"); pub fn property(name: []const u8, T: type, v: T) T { if (!props.map.has(name)) return v; @@ -806,7 +851,11 @@ pub fn complog(comptime fmt: []const u8, args: anytype) void { @compileLog(std.fmt.comptimePrint(" |{s}| {s}", .{ mode, msg })); } -pub const import = @import("../../.gen/imports.zig"); +pub const import = @import("../../zigem/imports.zig"); + +pub fn isBuiltin(name: []const u8) bool { + return std.mem.eql(u8, name, "em") or std.mem.startsWith(u8, name, "em__") or std.mem.startsWith(u8, name, "EM__"); +} pub const ptr_t = ?*anyopaque; diff --git a/workspace/em.core/em.lang/host-main.zig b/workspace/em.core/em.lang/meta-main.zig similarity index 90% rename from workspace/em.core/em.lang/host-main.zig rename to workspace/em.core/em.lang/meta-main.zig index 47aa7c2b..e788c91b 100644 --- a/workspace/em.core/em.lang/host-main.zig +++ b/workspace/em.core/em.lang/meta-main.zig @@ -1,7 +1,7 @@ -const em = @import("../../.gen/em.zig"); +const em = @import("../../zigem/em.zig"); const std = @import("std"); -const type_map = @import("../../.gen/type_map.zig"); +const type_map = @import("../../zigem/type_map.zig"); var used_set = std.StringHashMap(void).init(em.getHeap()); @@ -26,7 +26,7 @@ pub fn exec(top: em.Unit) !void { callAll("em__constructH", ulist_top, false); callAll("em__generateH", ulist_top, false); try genDomain(); - try genTarg(ulist_bot, ulist_top); + try genTarg(top, ulist_bot, ulist_top); std.process.exit(0); } @@ -74,7 +74,7 @@ fn genDomain() !void { const file = try std.fs.createFileAbsolute(em._domain_file, .{}); const out = file.writer(); try out.print( - \\pub const Domain = enum {{HOST, TARG}}; + \\pub const Domain = enum {{META, TARG}}; \\pub const DOMAIN: Domain = .TARG; \\ , .{}); @@ -87,14 +87,14 @@ fn genImport(path: []const u8, out: std.fs.File.Writer) !void { if (std.mem.eql(u8, un, "em")) { try out.print("em", .{}); } else { - try out.print("em.unitScope(em.import.@\"{s}\")", .{un}); + try out.print("em.import.@\"{s}\"", .{un}); } while (it.next()) |seg| { try out.print(".{s}", .{seg}); } } -fn genTarg(ulist_bot: []const em.Unit, ulist_top: []const em.Unit) !void { +fn genTarg(cur_top: em.Unit, ulist_bot: []const em.Unit, ulist_top: []const em.Unit) !void { const file = try std.fs.createFileAbsolute(em._targ_file, .{}); const out = file.writer(); const fmt = @@ -107,8 +107,11 @@ fn genTarg(ulist_bot: []const em.Unit, ulist_top: []const em.Unit) !void { ; try out.print(fmt, .{}); inline for (ulist_bot) |u| { - if (u.kind == .module and !u.host_only and !u.legacy) { - try out.print("// {0s} {1s} {0s}\n", .{ "=" ** 8, u.upath }); + if (u.kind == .module and !u.meta_only and !u.legacy) { + //const @"// -------- BUILTIN FXNS -------- //" = {}; + + try out.print("const @\"// {0s} {1s} {0s} //\" = {{}};\n\n", .{ "-" ** 8, u.upath }); + //try out.print("// {0s} {1s} {0s}\n", .{ "=" ** 8, u.upath }); try genConfig(u, out); try out.print("\n", .{}); } @@ -133,7 +136,7 @@ fn genTarg(ulist_bot: []const em.Unit, ulist_top: []const em.Unit) !void { try out.print(" asm volatile (\".global __em__run\");\n", .{}); try out.print(" asm volatile (\"__em__run:\");\n", .{}); try out.print(" ", .{}); - try genImport(ulist_top[0].upath, out); + try genImport(cur_top.upath, out); try out.print(".em__run();\n", .{}); try out.print(" em.halt();\n", .{}); try out.print("}}\n", .{}); diff --git a/workspace/em.core/em.mcu/Common.em.zig b/workspace/em.core/em.mcu/Common.em.zig index 6d936127..ced0819f 100644 --- a/workspace/em.core/em.mcu/Common.em.zig +++ b/workspace/em.core/em.mcu/Common.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -12,7 +12,7 @@ pub const EM__CONFIG = struct { UsCounter: em.Proxy(em.import.@"em.hal/UsCounterI"), }; -pub const EM__HOST = struct { +pub const EM__META = struct { pub const BusyWait = em__C.BusyWait; pub const ConsoleUart = em__C.ConsoleUart; pub const GlobalInterrupts = em__C.GlobalInterrupts; diff --git a/workspace/em.core/em.mcu/Poller.em.zig b/workspace/em.core/em.mcu/Poller.em.zig index c2dc00ec..4fe7d109 100644 --- a/workspace/em.core/em.mcu/Poller.em.zig +++ b/workspace/em.core/em.mcu/Poller.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -8,7 +8,7 @@ pub const EM__CONFIG = struct { pub const Common = em.import.@"em.mcu/Common"; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub const OneShot = em__C.OneShot; }; diff --git a/workspace/em.core/em.utils/AlarmMgr.em.zig b/workspace/em.core/em.utils/AlarmMgr.em.zig index 0532687c..b1de332f 100644 --- a/workspace/em.core/em.utils/AlarmMgr.em.zig +++ b/workspace/em.core/em.utils/AlarmMgr.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -31,7 +31,7 @@ pub const Alarm = struct { } }; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub const WakeupTimer = em__C.WakeupTimer; diff --git a/workspace/em.core/em.utils/BoardController.em.zig b/workspace/em.core/em.utils/BoardController.em.zig index 65c42932..299aef92 100644 --- a/workspace/em.core/em.utils/BoardController.em.zig +++ b/workspace/em.core/em.utils/BoardController.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -8,7 +8,7 @@ pub const EM__CONFIG = struct { pub const Common = em.import.@"em.mcu/Common"; -pub const EM__HOST = struct { +pub const EM__META = struct { pub const Led = em__C.Led; }; diff --git a/workspace/em.core/em.utils/ButtonT.em.zig b/workspace/em.core/em.utils/ButtonT.em.zig index 45baeb28..5a2ce90f 100644 --- a/workspace/em.core/em.utils/ButtonT.em.zig +++ b/workspace/em.core/em.utils/ButtonT.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__T = em.template(@This(), .{}); pub const EM__CONFIG = struct { em__upath: []const u8, @@ -26,14 +26,15 @@ pub fn em__generateS(comptime name: []const u8) type { pub const OnPressedCbFxn = ButtonI.OnPressedCbFxn; pub const OnPressedCbArg = ButtonI.OnPressedCbArg; - pub const EM__HOST = struct { + pub const EM__META = struct { // pub const Edge = em__C.Edge; + const GpioEdgeI = em.import.@"em.hal/GpioEdgeI"; pub fn em__constructH() void { const debounceF = FiberMgr.createH(em__U.fxn("debounceFB", FiberMgr.BodyArg)); em__C.debounceF.set(debounceF); - // Edge.get().scope().setDetectHandlerH(em__U.fxn("buttonHandler", em__C.Edge.get().scope().HandlerArg)); + Edge.get().setDetectHandlerH(em__U.fxn("buttonHandler", GpioEdgeI.HandlerArg)); } }; @@ -76,7 +77,7 @@ pub fn em__generateS(comptime name: []const u8) type { pub fn onPressed(cb: OnPressedCbFxn, dur: DurationMs) void { cur_cb = cb; max_dur = dur.max; - min_dur = dur.max; + min_dur = dur.min; if (cb == null) { Edge.disableDetect(); } else { @@ -86,76 +87,3 @@ pub fn em__generateS(comptime name: []const u8) type { }; }; } - -//|->>> -// ## ---- generated by em.utils/ButtonT ---- ## -// package `pn` -// -// from em.hal import ButtonI -// from em.hal import GpioEdgeDetectMinI -// -// from em.mcu import Poller -// -// from em.utils import FiberMgr -// -// module `un`: ButtonI -// # ^| implements the ButtonI interface -// proxy Edge: GpioEdgeDetectMinI -// # ^| a GPIO with edge-detection capabilities -// private: -// -// function buttonHandler: Edge.Handler -// function debounceFB: FiberMgr.FiberBodyFxn -// -// config debounceF: FiberMgr.Fiber& -// -// var curDuration: uint16 -// var curCb: OnPressedCB -// var maxDur: uint16 -// var minDur: uint16 -// -// end -// -// def em$construct() -// Edge.setDetectHandlerH(buttonHandler) -// debounceF = FiberMgr.createH(debounceFB) -// end -// -// def em$startup() -// Edge.makeInput() -// Edge.setInternalPullup(true) -// Edge.setDetectFallingEdge() -// end -// -// def buttonHandler() -// Edge.clearDetect() -// debounceF.post() if curCb -// end -// -// def debounceFB(arg) -// curDuration = 0 -// for ;; -// Poller.pause(minDur) -// return if curDuration == 0 && !isPressed() -// curDuration += minDur -// break if !isPressed() || curDuration >= maxDur -// end -// curCb() -// end -// -// def isPressed() -// return !Edge.get() -// end -// -// def onPressed(cb, minDurationMs, maxDurationMs) -// curCb = cb -// maxDur = maxDurationMs -// minDur = minDurationMs -// if cb == null -// Edge.disableDetect() -// else -// Edge.enableDetect() -// end -// end -//|-<<< -// diff --git a/workspace/em.core/em.utils/EpochTime.em.zig b/workspace/em.core/em.utils/EpochTime.em.zig index 299c2aa5..116d40ea 100644 --- a/workspace/em.core/em.utils/EpochTime.em.zig +++ b/workspace/em.core/em.utils/EpochTime.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -6,7 +6,7 @@ pub const EM__CONFIG = struct { Uptimer: em.Proxy(em.import.@"em.hal/UptimerI"), }; -pub const EM__HOST = struct { +pub const EM__META = struct { pub const Uptimer = em__C.Uptimer; }; diff --git a/workspace/em.core/em.utils/FiberMgr.em.zig b/workspace/em.core/em.utils/FiberMgr.em.zig index 2794825d..afb8d0a0 100644 --- a/workspace/em.core/em.utils/FiberMgr.em.zig +++ b/workspace/em.core/em.utils/FiberMgr.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -28,7 +28,7 @@ pub const Fiber = struct { } }; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn createH(body: BodyFxn) Obj { const fiber = em__C.FiberOF.createH(.{ .body = body }); @@ -40,26 +40,27 @@ pub const EM__TARG = struct { // var ready_list = struct { const Self = @This(); - const NIL: *Fiber = @ptrFromInt(4); - head: *Fiber = NIL, - tail: *Fiber = NIL, + const END: *Fiber = @ptrFromInt(4); + head: *Fiber = END, + tail: *Fiber = END, + count: u8 = 0, fn empty(self: *Self) bool { - return self.head == NIL; + return self.head == END; } fn give(self: *Self, elem: *Fiber) void { if (self.empty()) { self.head = elem; - self.tail = elem; } else { self.tail.link = elem; } - elem.link = NIL; + self.tail = elem; + elem.link = END; } fn take(self: *Self) *Fiber { const e = self.head; self.head = e.link.?; e.link = null; - if (self.head == NIL) self.tail = NIL; + if (self.head == END) self.tail = END; return e; } }{}; diff --git a/workspace/em.core/em.utils/LedT.em.zig b/workspace/em.core/em.utils/LedT.em.zig index 7ac091c5..2d90cd42 100644 --- a/workspace/em.core/em.utils/LedT.em.zig +++ b/workspace/em.core/em.utils/LedT.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__T = em.template(@This(), .{}); pub const EM__CONFIG = struct { @@ -19,7 +19,7 @@ pub fn em__generateS(comptime name: []const u8) type { pub const Poller = em.import.@"em.mcu/Poller"; - pub const EM__HOST = struct { + pub const EM__META = struct { // pub const active_low = em__C.active_low; pub const Pin = em__C.Pin; diff --git a/workspace/em.core/em.utils/TickerMgr.em.zig b/workspace/em.core/em.utils/TickerMgr.em.zig index bc962972..38be9586 100644 --- a/workspace/em.core/em.utils/TickerMgr.em.zig +++ b/workspace/em.core/em.utils/TickerMgr.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -28,7 +28,7 @@ pub const Ticker = struct { } }; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn createH() Obj { const fiber = FiberMgr.createH(em__U.fxn("alarmFB", FiberMgr.BodyArg)); diff --git a/workspace/em.core/zigem-package.ini b/workspace/em.core/zigem-package.ini new file mode 100644 index 00000000..e2bbb6f1 --- /dev/null +++ b/workspace/em.core/zigem-package.ini @@ -0,0 +1,3 @@ +[em.lang] + + PackageName = em.core diff --git a/workspace/em.test/em-bundle.ini b/workspace/em.test/em-bundle.ini deleted file mode 100644 index ed038609..00000000 --- a/workspace/em.test/em-bundle.ini +++ /dev/null @@ -1,3 +0,0 @@ -[em.lang] - - BundleName = em.test diff --git a/workspace/makefile b/workspace/makefile deleted file mode 100644 index b706b2f4..00000000 --- a/workspace/makefile +++ /dev/null @@ -1,62 +0,0 @@ -DISTRO = ti.cc23xx/ti.distro.cc23xx - -host: - @rm -f .gen/targ.zig - @touch .gen/targ.zig - @rm -rf .out/* - @zig build-exe -I. -femit-bin=.out/host-main.exe .main-host.zig - @.out/host-main.exe - @zig fmt .gen/targ.zig 2>&1 >/dev/null - -hal: - @zig translate-c $(DISTRO)/hal.h > $(DISTRO)/hal.zig - -## ----------------- - -TOOLS=../zig-out/tools - -ifeq ($(OS),windows) - BIN_SUF=".exe" - SCRIPT_SUF=".bat" -else - BIN_SUF="" - SCRIPT_SUF=".sh" -endif - -ifeq ($(OS),macos) - SHA256=shasum -a 256 - UNIFLASH?=/Applications/ti/uniflash_8.7.0/dslite.sh -else - SHA256=sha256sum - UNIFLASH?=$(TOOLS)/ti-uniflash/dslite$(SCRIPT_SUF) -endif - -OBJCOPY?=$(TOOLS)/arm-binutils/objcopy$(BIN_SUF) -OBJDUMP?=$(TOOLS)/arm-binutils/objdump$(BIN_SUF) - -TARG_OPTS=\ - --name main \ - -fentry=em__start \ - -fno-lto \ - -fsingle-threaded \ - -fno-strip \ - -mcpu cortex_m0plus \ - -target thumb-freestanding-eabi \ - -O ReleaseSmall \ - -femit-asm=.out/main.asm \ - -femit-bin=.out/main.out \ - -targ: - @zig build-exe -I. $(TARG_OPTS) --script .out/linkcmd.ld .out/startup.c .main-targ.zig - @rm -f .out/main.out.o - @$(OBJCOPY) -O ihex .out/main.out .out/main.out.hex - @$(OBJDUMP) -h -d .out/main.out >.out/main.out.dis - @$(OBJDUMP) -t .out/main.out | tail -n +5 | sed -e 's/[FO] / /' | sed -e 's/df / /' >.out/main.out.sym - @sort -k1 .out/main.out.sym > .out/main.out.syma - @sort -k5 .out/main.out.sym > .out/main.out.symn - @$(SHA256) .out/main.out.hex | cut -c -8 >.out/main.out.sha32 - @$(OBJDUMP) -h .out/main.out - -load: - @$(UNIFLASH) --mode noConnectFlash -c ti.cc23xx/ti.distro.cc23xx/CC2340R5.ccxml .out/main.out - diff --git a/workspace/ti.cc23xx/em-bundle.ini b/workspace/ti.cc23xx/em-bundle.ini deleted file mode 100644 index ee5b17cc..00000000 --- a/workspace/ti.cc23xx/em-bundle.ini +++ /dev/null @@ -1,4 +0,0 @@ -[em.lang] - - BundleName = ti.cc23xx - BundleRequires = em.arch,em.build diff --git a/workspace/ti.cc23xx/setup-default.ini b/workspace/ti.cc23xx/setup-default.ini index 9dd6f672..705ce983 100644 --- a/workspace/ti.cc23xx/setup-default.ini +++ b/workspace/ti.cc23xx/setup-default.ini @@ -1,6 +1,6 @@ [em.lang] BoardKind = LP_EM_CC2340R5 - DistroPackage = ti.cc23xx://ti.distro.cc23xx + Distro = ti.cc23xx://ti.distro.cc23xx [em.build] Optimize = ReleaseSmall diff --git a/workspace/ti.cc23xx/setup-sram.ini b/workspace/ti.cc23xx/setup-sram.ini index f6a0327e..9b1d9689 100644 --- a/workspace/ti.cc23xx/setup-sram.ini +++ b/workspace/ti.cc23xx/setup-sram.ini @@ -1,11 +1,8 @@ [em.lang] - SetupExtends = ti.cc23xx://default [em.build] - BootFlash = true [em.config] - ti.mcu.cc23xx/Mcu.no_cache = true \ No newline at end of file diff --git a/workspace/ti.cc23xx/ti.distro.cc23xx/BoardC.em.zig b/workspace/ti.cc23xx/ti.distro.cc23xx/BoardC.em.zig index bcee1e2b..64ef5abc 100644 --- a/workspace/ti.cc23xx/ti.distro.cc23xx/BoardC.em.zig +++ b/workspace/ti.cc23xx/ti.distro.cc23xx/BoardC.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.composite(@This(), .{}); pub const AlarmMgr = em.import.@"em.utils/AlarmMgr"; @@ -35,7 +35,7 @@ pub const Uptimer = em.import.@"ti.mcu.cc23xx/UptimerRtc"; pub const UsCounter = em.import.@"ti.mcu.cc23xx/UsCounterSystick"; pub const WakeupTimer = em.import.@"ti.mcu.cc23xx/WakeupRtc"; -pub const EM__HOST = struct {}; +pub const EM__META = struct {}; pub fn em__configureH() void { AlarmMgr.WakeupTimer.set(WakeupTimer); diff --git a/workspace/ti.cc23xx/ti.distro.cc23xx/BuildH.em.zig b/workspace/ti.cc23xx/ti.distro.cc23xx/BuildH.em.zig index 1e30ccd2..27e1d179 100644 --- a/workspace/ti.cc23xx/ti.distro.cc23xx/BuildH.em.zig +++ b/workspace/ti.cc23xx/ti.distro.cc23xx/BuildH.em.zig @@ -1,6 +1,6 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ - .host_only = true, + .meta_only = true, }); pub const BoardC = em.import.@"em__distro/BoardC"; @@ -8,7 +8,7 @@ pub const IntrVec = em.import.@"em.arch.arm/IntrVec"; pub const LinkerH = em.import.@"em.build.misc/LinkerH"; pub const StartupH = em.import.@"em.arch.arm/StartupH"; -pub const EM__HOST = struct {}; +pub const EM__META = struct {}; pub fn em__configureH() void { const nvic_intrs = [_][]const u8{ diff --git a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_ble5_ram_regs.h b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_ble5_ram_regs.h index 9f34f8a3..6cf9482a 100644 --- a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_ble5_ram_regs.h +++ b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_ble5_ram_regs.h @@ -4,17 +4,17 @@ // Generated on 2024-04-04 15:06:12 // by user: developer // on machine: swtools -// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/build/lrfbledig/iar/pbe/ble5 -// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt -// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt +// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/zigem/lrfbledig/iar/pbe/ble5 +// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt +// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt // // Relevant file version(s): // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl // rcs-info: (file not managed or unknown revision control system) // git-hash: 68a752a8737845355f7bdb320d25a59eac685840 // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt // rcs-info: (file not managed or unknown revision control system) // git-hash: 0b79d4d13cc055db992ad8a96ee84cae10ff93ac // diff --git a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_ble5_regdef_regs.h b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_ble5_regdef_regs.h index 588c65c6..38e30dee 100644 --- a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_ble5_regdef_regs.h +++ b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_ble5_regdef_regs.h @@ -4,17 +4,17 @@ // Generated on 2024-04-04 15:06:12 // by user: developer // on machine: swtools -// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/build/lrfbledig/iar/pbe/ble5 -// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt -// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt +// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/zigem/lrfbledig/iar/pbe/ble5 +// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt +// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt // // Relevant file version(s): // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl // rcs-info: (file not managed or unknown revision control system) // git-hash: 68a752a8737845355f7bdb320d25a59eac685840 // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/ble5/doc/pbe_ble5_regdef_regs.txt // rcs-info: (file not managed or unknown revision control system) // git-hash: 753310d49982671f410f10b434972b7c27836bba // diff --git a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_common_ram_regs.h b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_common_ram_regs.h index 84747910..7f365442 100644 --- a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_common_ram_regs.h +++ b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_common_ram_regs.h @@ -4,17 +4,17 @@ // Generated on 2024-04-04 15:06:12 // by user: developer // on machine: swtools -// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/build/lrfbledig/iar/pbe/common -// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/common/doc/pbe_common_ram_regs.txt -// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/common/doc/pbe_common_ram_regs.txt +// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/zigem/lrfbledig/iar/pbe/common +// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/common/doc/pbe_common_ram_regs.txt +// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/common/doc/pbe_common_ram_regs.txt // // Relevant file version(s): // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl // rcs-info: (file not managed or unknown revision control system) // git-hash: 68a752a8737845355f7bdb320d25a59eac685840 // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/common/doc/pbe_common_ram_regs.txt +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/common/doc/pbe_common_ram_regs.txt // rcs-info: (file not managed or unknown revision control system) // git-hash: cef3659936323c87a91f6983db5e9f40a1f01b57 // diff --git a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_generic_ram_regs.h b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_generic_ram_regs.h index b818609e..5988ce0a 100644 --- a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_generic_ram_regs.h +++ b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_generic_ram_regs.h @@ -4,17 +4,17 @@ // Generated on 2024-04-04 15:06:12 // by user: developer // on machine: swtools -// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/build/lrfbledig/iar/pbe/generic -// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt -// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt +// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/zigem/lrfbledig/iar/pbe/generic +// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt +// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt // // Relevant file version(s): // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl // rcs-info: (file not managed or unknown revision control system) // git-hash: 68a752a8737845355f7bdb320d25a59eac685840 // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt // rcs-info: (file not managed or unknown revision control system) // git-hash: e341d2d047097f8c7281906c9724785f4a71526a // diff --git a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_generic_regdef_regs.h b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_generic_regdef_regs.h index a30e9513..0c42ec71 100644 --- a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_generic_regdef_regs.h +++ b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/pbe_generic_regdef_regs.h @@ -4,17 +4,17 @@ // Generated on 2024-04-04 15:06:12 // by user: developer // on machine: swtools -// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/build/lrfbledig/iar/pbe/generic -// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt -// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt +// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/zigem/lrfbledig/iar/pbe/generic +// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt +// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_ram_regs.txt /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt // // Relevant file version(s): // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl // rcs-info: (file not managed or unknown revision control system) // git-hash: 68a752a8737845355f7bdb320d25a59eac685840 // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/pbe/generic/doc/pbe_generic_regdef_regs.txt // rcs-info: (file not managed or unknown revision control system) // git-hash: 909cc6f86073545ee6bc3a4d5aa0343a4542ddcc // diff --git a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/rfe_common_ram_regs.h b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/rfe_common_ram_regs.h index 5b64268a..47fc514f 100644 --- a/workspace/ti.cc23xx/ti.distro.cc23xx/inc/rfe_common_ram_regs.h +++ b/workspace/ti.cc23xx/ti.distro.cc23xx/inc/rfe_common_ram_regs.h @@ -4,17 +4,17 @@ // Generated on 2024-04-04 15:06:12 // by user: developer // on machine: swtools -// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/build/lrfbledig/iar/rfe/common -// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/rfe/common/doc/rfe_common_ram_regs.txt -// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/rfe/common/doc/rfe_common_ram_regs.txt +// CWD: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/zigem/lrfbledig/iar/rfe/common +// Commandline: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/rfe/common/doc/rfe_common_ram_regs.txt +// C&P friendly: /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl -x /home/developer/.conan/data/f65lokilrfbledig/1.3.19-1/library-lprf/eng/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/source/ti.com_LOKI_LRFBLEDIG_1.0.xml -f acr --devices CC2340R5:B (2.0) /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/rfe/common/doc/rfe_common_ram_regs.txt // // Relevant file version(s): // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/../tools/topsm/regtxtconv.pl // rcs-info: (file not managed or unknown revision control system) // git-hash: 68a752a8737845355f7bdb320d25a59eac685840 // -// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/build/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/rfe/common/doc/rfe_common_ram_regs.txt +// /home/developer/.conan/data/loki-lrf/8.10.00.20/library-lprf/ga/zigem/0c46501566d33cb4afdce9818f8c3e61ffe04c9a/lrfbledig/rfe/common/doc/rfe_common_ram_regs.txt // rcs-info: (file not managed or unknown revision control system) // git-hash: d6fcb11658d75207ef1e20e66c8f03c3d5bf2cfe // diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/BusyWait.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/BusyWait.em.zig index 7f5b96d1..06fedc2b 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/BusyWait.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/BusyWait.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ .inherits = em.import.@"em.hal/BusyWaitI", }); @@ -8,7 +8,7 @@ pub const EM__CONFIG = struct { scalar: em.Param(u8), }; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub const scalar = em__C.scalar; diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/ConsoleUart0.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/ConsoleUart0.em.zig index 15850466..9b721424 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/ConsoleUart0.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/ConsoleUart0.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ .inherits = em.import.@"em.hal/ConsoleUartI", }); @@ -10,7 +10,7 @@ pub const EM__CONFIG = struct { pub const Idle = em.import.@"ti.mcu.cc23xx/Idle"; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub const TxPin = em__C.TxPin; diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/ExtFlashDisabler.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/ExtFlashDisabler.em.zig index c84a5515..2d5b6f0f 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/ExtFlashDisabler.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/ExtFlashDisabler.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -11,7 +11,7 @@ pub const EM__CONFIG = struct { pub const BusyWait = em.import.@"ti.mcu.cc23xx/BusyWait"; -pub const EM__HOST = struct { +pub const EM__META = struct { pub const CS = em__C.CS; pub const CLK = em__C.CLK; pub const PICO = em__C.PICO; diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioEdgeAux.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioEdgeAux.em.zig index 29c49494..eed49bba 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioEdgeAux.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioEdgeAux.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -15,7 +15,7 @@ pub const HandlerInfo = struct { handler: GpioEdgeI.HandlerFxn, }; -pub const EM__HOST = struct { +pub const EM__META = struct { // var handler_info_tab = em__C.handler_info_tab; @@ -40,7 +40,7 @@ pub const EM__TARG = struct { } export fn GPIO_COMB_isr() void { - if (em.hosted) return; + if (em.IS_META) return; const mis = reg(hal.GPIO_BASE + hal.GPIO_O_MIS).*; for (handler_info_tab) |hi| { if ((mis & hi.mask) != 0 and hi.handler != null) { diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioEdgeT.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioEdgeT.em.zig index 9d2bde7c..c08f3780 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioEdgeT.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioEdgeT.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__T = em.template(@This(), .{}); pub const EM__CONFIG = struct { @@ -32,7 +32,7 @@ pub fn em__generateS(comptime name: []const u8) type { return m; } - pub const EM__HOST = struct { + pub const EM__META = struct { // pub const pin = em__C.pin; diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioT.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioT.em.zig index 668be8d0..41f06b5c 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioT.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/GpioT.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__T = em.template(@This(), .{}); pub const EM__CONFIG = struct { @@ -18,7 +18,7 @@ pub fn em__generateS(comptime name: []const u8) type { ); pub const em__C = em__U.config(EM__CONFIG); - pub const EM__HOST = struct { + pub const EM__META = struct { // pub const pin = em__C.pin; diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/Hapi.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/Hapi.em.zig index 45a6db62..03c338c6 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/Hapi.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/Hapi.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); const ROM_T = extern struct { @@ -7,7 +7,7 @@ const ROM_T = extern struct { const ROM_TABLE: *const ROM_T = @ptrFromInt(0x0F00004C); -pub const EM__HOST = struct {}; +pub const EM__META = struct {}; pub const EM__TARG = struct { // diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/Idle.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/Idle.em.zig index a9cb428e..4aeae23d 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/Idle.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/Idle.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ .inherits = em.import.@"em.hal/IdleI", }); @@ -16,7 +16,7 @@ pub const SleepCbFxn = em.Fxn(SleepCbArg); pub const SleepCbArg = struct {}; pub const CallbackTab = em.Table(SleepCbFxn, .RO); -pub const EM__HOST = struct { +pub const EM__META = struct { // var sleep_enter_cb_tab = em__C.sleep_enter_fxn_tab; var sleep_leave_cb_tab = em__C.sleep_leave_fxn_tab; diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/Mcu.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/Mcu.em.zig index 52ec15f0..791192b2 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/Mcu.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/Mcu.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ .inherits = em.import.@"em.hal/McuI", }); @@ -11,7 +11,7 @@ pub const EM__CONFIG = struct { pub const BusyWait = em.import.@"ti.mcu.cc23xx/BusyWait"; pub const Debug = em.import.@"em.lang/Debug"; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn em__initH() void { em__C.no_cache.init(false); diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/MsCounterGpt3.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/MsCounterGpt3.em.zig index 57252b84..90053c44 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/MsCounterGpt3.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/MsCounterGpt3.em.zig @@ -1,9 +1,9 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ .inherits = em.import.@"em.hal/MsCounterI", }); -pub const EM__HOST = struct { +pub const EM__META = struct { // }; diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/OneShotGpt3.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/OneShotGpt3.em.zig index 2ccf1687..52263783 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/OneShotGpt3.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/OneShotGpt3.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ .inherits = OneShotMilliI, }); @@ -10,7 +10,7 @@ pub const OneShotMilliI = em.import.@"em.hal/OneShotMilliI"; pub const HandlerArg = OneShotMilliI.HandlerArg; pub const HandlerFxn = OneShotMilliI.HandlerFxn; -pub const EM__HOST = struct { +pub const EM__META = struct { // pub fn em__constructH() void { IntrVec.useIntrH("LGPT3_COMB"); @@ -40,12 +40,13 @@ pub const EM__TARG = struct { hal.NVIC_EnableIRQ(hal.LGPT3_COMB_IRQn); reg(hal.CLKCTL_BASE + hal.CLKCTL_O_CLKENSET0).* = hal.CLKCTL_CLKENSET0_LGPT3; reg(hal.LGPT3_BASE + hal.LGPT_O_IMSET).* = hal.LGPT_IMSET_TGT; - reg(hal.LGPT3_BASE + hal.LGPT_O_TGT).* = msecs * (48_000_000 / 1000); + reg(hal.LGPT3_BASE + hal.LGPT_O_PRECFG).* = (192 << hal.LGPT_PRECFG_TICKDIV_S); + reg(hal.LGPT3_BASE + hal.LGPT_O_TGT).* = msecs * (250); reg(hal.LGPT3_BASE + hal.LGPT_O_CTL).* = hal.LGPT_CTL_MODE_UP_ONCE | hal.LGPT_CTL_C0RST; } export fn LGPT3_COMB_isr() void { - if (em.hosted) return; + if (em.IS_META) return; const fxn = cur_fxn; disable(); if (fxn != null) fxn.?(.{ .arg = cur_arg }); diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/Rtc.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/Rtc.em.zig index 3aa5e595..a218dbd3 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/Rtc.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/Rtc.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{}); pub const em__C = em__U.config(EM__CONFIG); @@ -6,7 +6,7 @@ pub const EM__CONFIG = struct {}; pub const IntrVec = em.import.@"em.arch.arm/IntrVec"; -pub const EM__HOST = struct { +pub const EM__META = struct { pub fn em__constructH() void { IntrVec.useIntrH("CPUIRQ0"); } @@ -67,7 +67,7 @@ pub const EM__TARG = struct { } export fn CPUIRQ0_isr() void { - if (em.hosted) return; + if (em.IS_META) return; em.reg(hal.RTC_BASE + hal.RTC_O_ICLR).* = hal.RTC_ICLR_EV0; if (cur_handler != null) cur_handler.?(Handler{}); } diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/UptimerRtc.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/UptimerRtc.em.zig index b8cb5e02..faa33893 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/UptimerRtc.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/UptimerRtc.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ .inherits = UptimerI, }); @@ -8,7 +8,7 @@ pub const UptimerI = em.import.@"em.hal/UptimerI"; pub const Time = UptimerI.Time; -pub const EM__HOST = struct { +pub const EM__META = struct { // }; diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/UsCounterSystick.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/UsCounterSystick.em.zig index 2aaa8259..b686e02d 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/UsCounterSystick.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/UsCounterSystick.em.zig @@ -1,9 +1,9 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ .inherits = em.import.@"em.hal/UsCounterI", }); -pub const EM__HOST = struct {}; +pub const EM__META = struct {}; pub const EM__TARG = struct { // diff --git a/workspace/ti.cc23xx/ti.mcu.cc23xx/WakeupRtc.em.zig b/workspace/ti.cc23xx/ti.mcu.cc23xx/WakeupRtc.em.zig index dcebbf85..46b722be 100644 --- a/workspace/ti.cc23xx/ti.mcu.cc23xx/WakeupRtc.em.zig +++ b/workspace/ti.cc23xx/ti.mcu.cc23xx/WakeupRtc.em.zig @@ -1,4 +1,4 @@ -pub const em = @import("../../.gen/em.zig"); +pub const em = @import("../../zigem/em.zig"); pub const em__U = em.module(@This(), .{ .inherits = WakeupTimerI, }); @@ -9,7 +9,7 @@ pub const WakeupTimerI = em.import.@"em.hal/WakeupTimerI"; pub const HandlerFxn = WakeupTimerI.HandlerFxn; pub const HandlerArg = WakeupTimerI.HandlerArg; -pub const EM__HOST = struct { +pub const EM__META = struct { // }; diff --git a/workspace/ti.cc23xx/zigem-package.ini b/workspace/ti.cc23xx/zigem-package.ini new file mode 100644 index 00000000..a95ecb32 --- /dev/null +++ b/workspace/ti.cc23xx/zigem-package.ini @@ -0,0 +1,3 @@ +[em.lang] + + PackageName = ti.cc23xx