Add support for mappers
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 15/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- zig
- 领域
- embedded-iot
调研方向
The issue sketches a Static memory type that takes a base address, plus a dispatch step that routes reads and writes to SRAM, EEPROM or I/O by address. Start with the RAM type and its memory() and vtable code, and with how the CPU currently dispatches loads on cpu.sram, cpu.eeprom and cpu.io. Design the mapper first, because the issue leaves that open; done means an agreed design with tests that cover address translation on an atxmega-style layout.
由索引模型根据 Issue 内容生成。
描述
Some mcus, e.g. the atxmega, map peripherals to different parts of the address space. For example, the RAM starts at 0x2000, and EEPROM starts at 0x1000.
This can be supported by adding a 'base' field to the type contructor to adjust incoming r/w addresses. A mapper will be needed to send the requests to the correct peripheral. For example, the way I hack it in:
if (address >= cpu.sram.base) {
const val = cpu.sram.read(address);
cpu.regs[d.num()] = val;
} else if (address >= cpu.eeprom.base) {
cpu.regs[d.num()] = cpu.eeprom.read(@truncate(address));
} else {
const val = cpu.io.read(@truncate(address));
cpu.regs[d.num()] = val;
}
And the way I support a memory base:
pub fn Static(comptime size: comptime_int, comptime base: usize) type {
return struct {
const Self = @This();
data: [size]u8 align(2) = .{0} ** size,
base: usize = base,
pub fn memory(self: *Self) RAM {
return RAM{
.ctx = self,
.vtable = &vtable,
.size = size,
.base = base,
};
}
pub const vtable = VTable{
.readFn = memRead,
.writeFn = memWrite,
};
fn memRead(ctx: ?*anyopaque, addr: Address) u8 {
const mem: *Self = @ptrCast(@alignCast(ctx.?));
return mem.data[addr - mem.base];
}
fn memWrite(ctx: ?*anyopaque, addr: Address, value: u8) void {
const mem: *Self = @ptrCast(@alignCast(ctx.?));
mem.data[addr - mem.base] = value;
}
};
}
- 主要语言
- Zig
- 星标
- 2.3k
- 派生
- 198
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 37
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ZigEmbeddedGroup/microzig 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
ZigEmbeddedGroup/microzig#1086 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 69/100
ZigEmbeddedGroup/microzig#1085 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
ZigEmbeddedGroup/microzig#1061 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
ZigEmbeddedGroup/microzig#1059 · 1 条评论 ·
维护者通常 1 天内回复
-
regz: AVR peripherals generated at address 0 when the register-group name matches the module (ATDF)未关闭
难度 4/5 3-5 天 新手友好度 48/100
ZigEmbeddedGroup/microzig#1072 ·
维护者通常 1 天内回复
查看 ZigEmbeddedGroup/microzig 的全部 Issue
相似的 Issue
-
[BUG] OTA Requestor accepts reserved provider endpoint 0xFFFF可能已有人在做 @Chapoly1305 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
project-chip/connectedhomeip#74742 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 63/100
Xinyuan-LilyGO/T-Display-S3#352 · 3 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 79/100
lsongdev/node-bluetooth#62 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
`espup update` fails with `File exists (os error 17)` when `~/.espup/esp-clang` is a dangling symlink可能已有人在做 @SergioGasquez 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100