luna_soc.generate.c module

Generate a C library for SoC designs.

class luna_soc.generate.c.Header(memory_map: ~amaranth_soc.memory.MemoryMap, interrupts: dict[int, (<class 'str'>, <class 'amaranth.lib.wiring.Component'>)])[source]

Bases: object

generate(file=None, macro_name='SOC_RESOURCES', platform_name='Generic Platform')[source]

Generate a C header file that simplifies access to the platform’s resources.

Parameters:
  • macro_name – Optional. The name of the guard macro for the C header, as a string without spaces.

  • file – Optional. If provided, this will be treated as the file= argument to the print() – function. This can be used to generate file content instead of printing to the terminal.

class luna_soc.generate.c.LinkerScript(memory_map: MemoryMap, reset_addr: int = 0)[source]

Bases: object

generate(file=None, macro_name='SOC_RESOURCES', platform_name='Generic Platform')[source]

Generates a ldscript that holds our primary RAM and ROM regions.

Parameters:

file – Optional. If provided, this will be treated as the file= argument to the print() – function. This can be used to generate file content instead of printing to the terminal.