Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Use a pointer instead of u32 for initial_stack_pointer #87

@ikskuh

Description

@ikskuh

See this code:

extern var __microzig_end_of_stack: anyopaque;

const Table = extern struct {
    initial_stack_pointer: *anyopaque,
    reset: *const fn() callconv(.C) void,
    nmi: *const fn() callconv(.C) void,
};

export const vector_table: Table = .{
    .initial_stack_pointer = &__microzig_end_of_stack,
    .reset = _reset,
    .nmi = _nmi,
};

fn _reset() callconv(.C) void { }
fn _nmi() callconv(.C) void { }

which will then generate

example._nmi:
        ret

vector_table:
        .quad   __microzig_end_of_stack
        .quad   example._nmi
        .quad   example._nmi

as the generated assembly. this will allow us to fully configure the stack size and location from the linker script and don't require any weird shenanigans with address offsetting

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions