forked from M-Labs/artiq
Sebastien Bourdeauducq
938e1c2842
The only advantage of UP is to support the Papilio Pro, but that port is also very limited in other ways and the Pipistrello provides a more reasonable platform that also supports AMP. On the other hand, RPCs on UP are difficult to implement with the session.c protocol system (without an operating system or coroutines), along with many other minor difficulties and maintainance issues. Planned features such as watchdogs in the core device are also difficult on UP.
53 lines
1.4 KiB
Python
Executable File
53 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
|
|
from elftools.elf.elffile import ELFFile
|
|
|
|
|
|
services = [
|
|
("syscalls", [
|
|
("rpc", "rpc"),
|
|
("rtio_set_o", "rtio_set_o"),
|
|
("rtio_set_oe", "rtio_set_oe"),
|
|
("rtio_set_sensitivity", "rtio_set_sensitivity"),
|
|
("rtio_get_counter", "rtio_get_counter"),
|
|
("rtio_get", "rtio_get"),
|
|
("dds_phase_clear_en", "dds_phase_clear_en"),
|
|
("dds_program", "dds_program"),
|
|
]),
|
|
("eh", [
|
|
("setjmp", "exception_setjmp"),
|
|
("push", "exception_push"),
|
|
("pop", "exception_pop"),
|
|
("getid", "exception_getid"),
|
|
("raise", "exception_raise"),
|
|
])
|
|
]
|
|
|
|
|
|
def print_service_table(ksupport_elf_filename):
|
|
with open(ksupport_elf_filename, "rb") as f:
|
|
elf = ELFFile(f)
|
|
symtab = elf.get_section_by_name(b".symtab")
|
|
symbols = {symbol.name: symbol.entry.st_value
|
|
for symbol in symtab.iter_symbols()}
|
|
for name, contents in services:
|
|
print("static const struct symbol {}[] = {{".format(name))
|
|
for name, value in contents:
|
|
print(" {{\"{}\", (void *)0x{:08x}}},"
|
|
.format(name, symbols[bytes(value, "ascii")]))
|
|
print(" {NULL, NULL}")
|
|
print("};")
|
|
|
|
|
|
def main():
|
|
if len(sys.argv) == 2:
|
|
print_service_table(sys.argv[1])
|
|
else:
|
|
print("Incorrect number of command line arguments")
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|