Skip to content

gnu_avr.py

ofrak_patch_maker.toolchain.gnu_avr

GNU_AVR_5_Toolchain (Abstract_GNU_Toolchain)

name: str property readonly

Returns:

Type Description
str

name property that matches the value used in toolchain.conf to access paths

segment_alignment: int property readonly

For example, x86 returns 16. This will most often be used when programmatically allocating memory for code/data.

Returns:

Type Description
int

required alignment factor for the toolchain/ISA

_get_assembler_target(self, processor) private

Red Balloon Security strongly recommends all users provide their specific hardware target for best results.

Parameters:

Name Type Description Default
processor ArchInfo required

Returns:

Type Description
str

a default assembler target for the provided processor unless one is provided in self._config.

Exceptions:

Type Description
PatchMakerException

if no target provided and program attributes do not correspond to a default value.

Source code in ofrak_patch_maker/toolchain/gnu_avr.py
def _get_assembler_target(self, processor: ArchInfo) -> str:
    if processor.isa is not InstructionSet.AVR:
        raise ValueError(
            f"The GNU AVR toolchain does not support ISAs which are not AVR; "
            f"given ISA {processor.isa.name}"
        )
    if self._config.assembler_target:
        return self._config.assembler_target
    return InstructionSet.AVR.value.lower()