Skip to content

gnu_arm.py

ofrak_patch_maker.toolchain.gnu_arm

GNU_ARM_NONE_EABI_10_2_1_Toolchain (GNU_10_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

Thumb mode should be defined in the assembler source at the top, using:

.syntax unified
.thumb           ; or .code 16
Source code in ofrak_patch_maker/toolchain/gnu_arm.py
def _get_assembler_target(self, processor: ArchInfo):
    """
    Thumb mode should be defined in the assembler source at the top, using:

        .syntax unified
        .thumb           ; or .code 16
    """
    if processor.isa is not InstructionSet.ARM:
        raise ValueError(
            f"The GNU ARM toolchain does not support ISAs which are not ARM; "
            f"given ISA {processor.isa.name}"
        )
    if self._config.assembler_target:
        return self._config.assembler_target

    if processor.sub_isa:
        return processor.sub_isa.value.lower()
    elif processor.isa == InstructionSet.ARM:
        return SubInstructionSet.ARMv7A.value.lower()
    else:
        raise ToolchainException("Assembler Target not provided and no valid default found!")