Skip to content

Commit

Permalink
Merge branch 'master' into riscof-run
Browse files Browse the repository at this point in the history
  • Loading branch information
lekcyjna123 authored Dec 3, 2023
2 parents c03cab9 + 4904a07 commit bbc1524
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
11 changes: 11 additions & 0 deletions test/asm/link.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
OUTPUT_ARCH( "riscv" )

start = 0;

SECTIONS
{
.text : { *(.text) }
. = 0x100000000; /* start from 2**32 - trick to emulate Harvard architecture (.bss addresses will start from 0) */
.bss : { *(.bss) }
_end = .;
}
20 changes: 18 additions & 2 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ def test_asm_source(self):
self.base_dir = "test/asm/"
self.bin_src = []

with tempfile.NamedTemporaryFile() as asm_tmp, tempfile.NamedTemporaryFile() as bin_tmp:
with (
tempfile.NamedTemporaryFile() as asm_tmp,
tempfile.NamedTemporaryFile() as ld_tmp,
tempfile.NamedTemporaryFile() as bin_tmp,
):
subprocess.check_call(
[
"riscv64-unknown-elf-as",
Expand All @@ -279,7 +283,19 @@ def test_asm_source(self):
]
)
subprocess.check_call(
["riscv64-unknown-elf-objcopy", "-O", "binary", "-j", ".text", asm_tmp.name, bin_tmp.name]
[
"riscv64-unknown-elf-ld",
"-m",
"elf32lriscv",
"-T",
self.base_dir + "link.ld",
asm_tmp.name,
"-o",
ld_tmp.name,
]
)
subprocess.check_call(
["riscv64-unknown-elf-objcopy", "-O", "binary", "-j", ".text", ld_tmp.name, bin_tmp.name]
)
code = bin_tmp.read()
for word_idx in range(0, len(code), 4):
Expand Down

0 comments on commit bbc1524

Please sign in to comment.