Skip to content

Commit

Permalink
Logan nano - board added
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane committed Mar 20, 2022
1 parent 8a5ee67 commit ccb28aa
Show file tree
Hide file tree
Showing 9 changed files with 24,756 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ pub fn build(b: *std.build.Builder) !void {
BuildConfig{ .name = "boards.mbed_lpc1768", .backing = Backing{ .board = boards.mbed_lpc1768 } },
//BuildConfig{ .name = "chips.atmega328p", .backing = Backing{ .chip = pkgs.chips.atmega328p } },
BuildConfig{ .name = "chips.lpc1768", .backing = Backing{ .chip = chips.lpc1768 } },
//BuildConfig{ .name = "chips.stm32f103x8", .backing = Backing{ .chip = chips.stm32f103x8 } },
BuildConfig{ .name = "boards.stm32f3discovery", .backing = Backing{ .board = boards.stm32f3discovery }, .supports_uart = false },
// BuildConfig{ .name = "chips.stm32f103x8", .backing = Backing{ .chip = chips.stm32f103x8 } },
// BuildConfig{ .name = "chips.gd32vf103x8", .backing = Backing{ .chip = chips.gd32vf103x8 } },
BuildConfig{ .name = "boards.logan_nano", .backing = Backing{ .board = boards.logan_nano } },
BuildConfig{ .name = "boards.stm32f3discovery", .backing = Backing{ .board = boards.stm32f3discovery }, .supports_uart_test = false },
};

const Test = struct { name: []const u8, source: []const u8, uses_uart: bool = false };
Expand Down
6 changes: 6 additions & 0 deletions src/modules/boards.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ pub const stm32f3discovery = Board{
.path = root_path ++ "boards/stm32f3discovery/stm32f3discovery.zig",
.chip = chips.stm32f303vc,
};

pub const logan_nano = Board{
.name = "Logan Nano",
.path = root_path ++ "boards/logan-nano/logan-nano.zig",
.chip = chips.gd32vf103xb,
};
70 changes: 70 additions & 0 deletions src/modules/boards/logan-nano/logan-nano.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
pub const chip = @import("chip");
pub const micro = @import("microzig");

pub const cpu_frequency = 8_000_000;

pub const pin_map = .{
// Port A
.PA0 = "PA0",
.PA1 = "PA1",
.PA2 = "PA2",
.PA3 = "PA3",
.PA4 = "PA4",
.PA5 = "PA5",
.PA6 = "PA6",
.PA7 = "PA7",
.PA8 = "PA8",
.PA9 = "PA9",
.PA10 = "PA10",
.PA11 = "PA11",
.PA12 = "PA12",
.PA13 = "PA13",

// Port B
.PB0 = "PB0",
.PB1 = "PB1",
.PB2 = "PB2",
.PB3 = "PB3",
.PB4 = "PB4",
.PB5 = "PB5",
.PB6 = "PB6",
.PB7 = "PB7",
.PB8 = "PB8",
.PB9 = "PB9",
.PB10 = "PB10",
.PB11 = "PB11",
.PB12 = "PB12",
.PB13 = "PB13",
.PB14 = "PB14",
.PB15 = "PB15",

// Port C
.PC13 = "PC13",
.PC14 = "PC14",
.PC15 = "PC15",

// Colors LED
// LCD_COLOR_WHITE 0xFFFF
// LCD_COLOR_BLACK 0x0000
// LCD_COLOR_GREY 0xF7DE
// LCD_COLOR_BLUE 0x001F
// LCD_COLOR_BLUE2 0x051F
// LCD_COLOR_RED 0xF800
// LCD_COLOR_MAGENTA 0xF81F
// LCD_COLOR_GREEN 0x07E0
// LCD_COLOR_CYAN 0x7FFF
// LCD_COLOR_YELLOW 0xFFE0
};

// pub fn debugWrite(string: []const u8) void {
// const uart0 = micro.Uart(0).getOrInit(.{
// .baud_rate = 115200,
// .data_bits = .eight,
// .parity = null,
// .stop_bits = .one,
// }) catch unreachable;

// const writer = uart0.writer();
// _ = writer.write(string) catch unreachable;
// uart0.internal.txflush();
// }
20 changes: 20 additions & 0 deletions src/modules/chips.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ pub const lpc1768 = Chip{
},
};

pub const gd32vf103xb = Chip{
.name = "GD32VF103xB",
.path = root_path ++ "chips/gd32vf103/gd32vf103.zig",
.cpu = cpus.riscv32_imac,
.memory_regions = &.{
MemoryRegion{ .offset = 0x08000000, .length = 128 * 1024, .kind = .flash },
MemoryRegion{ .offset = 0x20000000, .length = 32 * 1024, .kind = .ram },
},
};

pub const gd32vf103x8 = Chip{
.name = "GD32VF103x8",
.path = root_path ++ "chips/gd32vf103/gd32vf103.zig",
.cpu = cpus.riscv32_imac,
.memory_regions = &.{
MemoryRegion{ .offset = 0x08000000, .length = 64 * 1024, .kind = .flash },
MemoryRegion{ .offset = 0x20000000, .length = 20 * 1024, .kind = .ram },
},
};

pub const stm32f103x8 = Chip{
.name = "STM32F103x8",
.path = root_path ++ "chips/stm32f103/stm32f103.zig",
Expand Down
2 changes: 2 additions & 0 deletions src/modules/chips/gd32vf103/gd32vf103.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub const cpu = @import("cpu");
pub const registers = @import("registers.zig");
Loading

0 comments on commit ccb28aa

Please sign in to comment.