Skip to content

Commit e034ec2

Browse files
committed
add linker script
1 parent 6f3b72a commit e034ec2

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

port/raspberrypi/rp2xxx/build.zig

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,15 @@ pub fn init(dep: *std.Build.Dependency) Self {
177177
}),
178178
.pico_flashless = chip_rp2040.derive(.{
179179
.entry = .{ .symbol_name = "_entry_point" },
180-
.linker_script = .{ .generate = .none, .file = b.path("ld/rp2040/ram_image_linker.ld") },
180+
.linker_script = .{
181+
.generate = .none,
182+
.file = b.path("ld/rp2040/ram_image_linker.ld"),
183+
},
181184
.ram_image = true,
182185
.board = .{
183186
.name = "RaspberryPi Pico (ram image)",
184187
.url = "https://www.raspberrypi.com/products/raspberry-pi-pico/",
185-
.root_source_file = b.path("src/boards/raspberry_pi_pico2.zig"),
188+
.root_source_file = b.path("src/boards/raspberry_pi_pico.zig"),
186189
},
187190
}),
188191
.pico2_arm = chip_rp2350_arm.derive(.{
@@ -194,6 +197,10 @@ pub fn init(dep: *std.Build.Dependency) Self {
194197
}),
195198
.pico2_arm_flashless = chip_rp2350_arm.derive(.{
196199
.ram_image = true,
200+
.linker_script = .{
201+
.generate = .memory_regions,
202+
.file = b.path("ld/rp2350/arm_ram_image_sections.ld"),
203+
},
197204
.board = .{
198205
.name = "RaspberryPi Pico 2 (ram image)",
199206
.url = "https://www.raspberrypi.com/products/raspberry-pi-pico2/",
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
SECTIONS
2+
{
3+
/DISCARD/ :
4+
{
5+
*(.entry)
6+
}
7+
8+
.flash_start :
9+
{
10+
KEEP(*(microzig_flash_start))
11+
} > ram0
12+
13+
.bootmeta :
14+
{
15+
__bootmeta_start__ = .;
16+
KEEP(*(.bootmeta))
17+
__bootmeta_end__ = .;
18+
} > ram0
19+
20+
.text :
21+
{
22+
*(.text*)
23+
KEEP(*(.ram_text))
24+
*(.rodata*)
25+
} > ram0
26+
27+
.ARM.extab : {
28+
*(.ARM.extab* .gnu.linkonce.armextab.*)
29+
} > ram0
30+
31+
.ARM.exidx : {
32+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
33+
} > ram0
34+
35+
.data :
36+
{
37+
*(.data*)
38+
} > ram0
39+
40+
.bss :
41+
{
42+
*(.bss*)
43+
} > ram0
44+
45+
/* Unused, but set as extern in startup_logic */
46+
microzig_data_start = .;
47+
microzig_data_end = .;
48+
microzig_bss_start = .;
49+
microzig_bss_end = .;
50+
microzig_data_load_start = .;
51+
}

0 commit comments

Comments
 (0)