diff --git a/README.md b/README.md index 1a44ae33f..0aaf89673 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# microzig +![microzig logo](design/logo-text-auto.svg) [![discord](https://img.shields.io/discord/824493524413710336.svg?logo=discord)](https://discord.gg/ShUWykk38X) @@ -6,15 +6,14 @@ APIs will likely break in the future -Table of Contents -================= +# Table of Contents - * [Contributing](#contributing) - * [Introduction](#introduction) - * [How to](#how-to) - * [Embedded project with "supported" chip/board](#embedded-project-with-supported-chipboard) - * [Embedded project with "unsupported" chip](#embedded-project-with-unsupported-chip) - * [Interrupts](#interrupts) +- [Contributing](#contributing) +- [Introduction](#introduction) +- [How to](#how-to) + - [Embedded project with "supported" chip/board](#embedded-project-with-supported-chipboard) + - [Embedded project with "unsupported" chip](#embedded-project-with-unsupported-chip) + - [Interrupts](#interrupts) @@ -26,6 +25,7 @@ There will be issues marked as `good first issue`, or drafts for larger ideas th ## Introduction This repo contains the infrastructure for getting started in an embedded Zig project, as well as some code to interact with some chips/boards. Specifically it offers: + - a single easy-to-use builder function that: - generates your linker script - sets up packages and start code @@ -87,6 +87,7 @@ pub fn main() !void { If you have a board/chip that isn't defined in microzig, you can set it up yourself! You need to have: + - SVD or ATDF file defining registers - flash and ram address and sizes diff --git a/design/logo-text-auto.svg b/design/logo-text-auto.svg new file mode 100644 index 000000000..ab4049446 --- /dev/null +++ b/design/logo-text-auto.svg @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/design/logo-text-brightmode.svg b/design/logo-text-brightmode.svg new file mode 100644 index 000000000..c048b67d2 --- /dev/null +++ b/design/logo-text-brightmode.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/design/logo-text-darkmode.svg b/design/logo-text-darkmode.svg new file mode 100644 index 000000000..f744c990b --- /dev/null +++ b/design/logo-text-darkmode.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/design/logo-text-inkscape.svg b/design/logo-text-inkscape.svg new file mode 100644 index 000000000..210065c4c --- /dev/null +++ b/design/logo-text-inkscape.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/design/logo.svg b/design/logo.svg new file mode 100644 index 000000000..c48f7174f --- /dev/null +++ b/design/logo.svg @@ -0,0 +1 @@ + diff --git a/src/core/microzig.zig b/src/core/microzig.zig index 8df10fcc7..0353d355c 100644 --- a/src/core/microzig.zig +++ b/src/core/microzig.zig @@ -24,6 +24,8 @@ pub const board = if (config.has_board) @import("board") else void; /// Provides access to the low level features of the CPU. pub const cpu = @import("cpu"); +pub const hal = @import("hal"); + /// Module that helps with interrupt handling. pub const interrupts = @import("interrupts.zig"); diff --git a/src/main.zig b/src/main.zig index afd868ae9..cd3098643 100644 --- a/src/main.zig +++ b/src/main.zig @@ -108,18 +108,18 @@ pub fn addEmbeddedExecutable( const config_pkg = Pkg{ .name = "microzig-config", - .path = .{ .path = config_file_name }, + .source = .{ .path = config_file_name }, }; const chip_pkg = Pkg{ .name = "chip", - .path = .{ .path = chip.path }, + .source = .{ .path = chip.path }, .dependencies = &.{pkgs.microzig}, }; const cpu_pkg = Pkg{ .name = "cpu", - .path = .{ .path = chip.cpu.path }, + .source = .{ .path = chip.cpu.path }, .dependencies = &.{pkgs.microzig}, }; @@ -148,7 +148,7 @@ pub fn addEmbeddedExecutable( break :blk std.build.Pkg{ .name = "app", - .path = .{ .path = source }, + .source = .{ .path = source }, .dependencies = app_pkgs.items, }; }; @@ -163,7 +163,7 @@ pub fn addEmbeddedExecutable( if (options.hal_package_path) |hal_package_path| exe.addPackage(.{ .name = "hal", - .path = hal_package_path, + .source = hal_package_path, .dependencies = &.{pkgs.microzig}, }); @@ -171,7 +171,7 @@ pub fn addEmbeddedExecutable( .board => |board| { exe.addPackage(std.build.Pkg{ .name = "board", - .path = .{ .path = board.path }, + .source = .{ .path = board.path }, .dependencies = &.{pkgs.microzig}, }); }, @@ -184,12 +184,12 @@ pub fn addEmbeddedExecutable( const pkgs = struct { const mmio = std.build.Pkg{ .name = "microzig-mmio", - .path = .{ .path = root_path ++ "core/mmio.zig" }, + .source = .{ .path = root_path ++ "core/mmio.zig" }, }; const microzig = std.build.Pkg{ .name = "microzig", - .path = .{ .path = root_path ++ "core/import-package.zig" }, + .source = .{ .path = root_path ++ "core/import-package.zig" }, }; }; @@ -197,13 +197,13 @@ const pkgs = struct { pub const drivers = struct { pub const quadrature = std.build.Pkg{ .name = "microzig.quadrature", - .path = .{ .path = root_path ++ "drivers/quadrature.zig" }, + .source = .{ .path = root_path ++ "drivers/quadrature.zig" }, .dependencies = &.{pkgs.microzig}, }; pub const button = std.build.Pkg{ .name = "microzig.button", - .path = .{ .path = root_path ++ "drivers/button.zig" }, + .source = .{ .path = root_path ++ "drivers/button.zig" }, .dependencies = &.{pkgs.microzig}, }; }; diff --git a/src/modules/cpus.zig b/src/modules/cpus.zig index ea1b61e46..cca07d394 100644 --- a/src/modules/cpus.zig +++ b/src/modules/cpus.zig @@ -18,6 +18,17 @@ pub const avr5 = Cpu{ }, }; +pub const cortex_m0plus = Cpu{ + .name = "ARM Cortex-M0+", + .path = root_path ++ "cpus/cortex-m/cortex-m.zig", + .target = std.zig.CrossTarget{ + .cpu_arch = .thumb, + .cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m0plus }, + .os_tag = .freestanding, + .abi = .none, + }, +}; + pub const cortex_m3 = Cpu{ .name = "ARM Cortex-M3", .path = root_path ++ "cpus/cortex-m/cortex-m.zig",