Skip to content

Commit 60e3c8f

Browse files
committed
[xmake] Generate vmem for legacy builds
Signed-off-by: Douglas Reis <[email protected]>
1 parent 3b7857f commit 60e3c8f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

common.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@ function convert_to_uf2(target)
88
os.execv("uf2conv", { firmware .. ".strip", "-b0x10000000", "-f0x6CE29E60", "-co", firmware .. ".slot2.uf2" })
99
os.execv("uf2conv", { firmware .. ".strip", "-b0x20000000", "-f0x6CE29E60", "-co", firmware .. ".slot3.uf2" })
1010
end
11+
12+
function convert_to_vmem(target)
13+
local firmware = target:targetfile()
14+
os.execv("riscv32-unknown-elf-objcopy", { firmware, "-O", "binary" , firmware .. ".bin" })
15+
os.execv("srec_cat", { firmware .. ".bin", "-binary",
16+
"-offset" ,"0x0000", "-byte-swap", "4",
17+
"-o", firmware .. ".vmem", "-vmem" })
18+
end
19+

examples/heartbleed/legacy/xmake.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ local legacy_dir = path.join(rootdir, "third_party/sonata-system/sw/legacy")
1212

1313
set_defaultarchs("cheriot")
1414
set_defaultplat("cheriot")
15+
includes("../../../common.lua")
1516

1617
-- Setup the GCC toolchain for building non-CHERI baremetal programs
1718
toolchain("legacy-gcc")
@@ -68,8 +69,8 @@ function legacy_firmware(name)
6869
path.join(legacy_dir, "common/timer.c"),
6970
path.join(legacy_dir, "common/uart.c")
7071
)
72+
after_link(convert_to_vmem)
7173
end
72-
7374
set_toolchains("legacy-gcc")
7475

7576
-- Legacy-specific LCD library for using the display drivers

0 commit comments

Comments
 (0)