Linking and linker relaxation fixes (#200)

wch-ch32v003
Djordje Nedic 4 months ago committed by GitHub
parent 6b1efed294
commit 1b1e3e6b39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -67,7 +67,12 @@ pub const startup_logic = struct {
:
: [eos] "r" (@as(u32, microzig.config.end_of_stack)),
);
asm volatile ("la gp, __global_pointer$");
asm volatile (
\\.option push
\\.option norelax
\\la gp, __global_pointer$
\\.option pop
);
microzig.cpu.setStatusBit(.mtvec, microzig.config.end_of_stack);
root.initialize_system_memories();
microzig_main();

@ -121,8 +121,9 @@ pub fn main() !void {
\\ .data :
\\ {
\\ microzig_data_start = .;
\\ *(.rodata*)
\\ *(.sdata*)
\\ *(.data*)
\\ *(.rodata*)
\\ microzig_data_end = .;
\\ } > ram0 AT> flash0
\\
@ -137,6 +138,14 @@ pub fn main() !void {
\\
);
}
switch (program_args.cpu_arch) {
.riscv32, .riscv64 => try writer.writeAll(
\\ PROVIDE(__global_pointer$ = microzig_data_start + 0x800);
),
else => {},
}
try writer.writeAll("}\n");
// TODO: Assert that the flash can actually hold all data!

Loading…
Cancel
Save