1.3.4 assemble

Writes assembler instructions to memory.

The debugger performs inline assembly of the instructions between the assemble and end commands, using the specified instruction set, and then writes them to the specified memory location.

This command is useful for making small changes to your code without recompiling. For larger code changes or to make use of a wider set of assembler directives you must use the standalone assembler tool provided by your compiler toolchain.

Note:

The assemble command does not change the processor state. You must ensure that the processor is in the correct state to execute the new instructions.

Syntax

assemble address [InstructionSet]
[Instruction]
...
end

Where:

address

Specifies the address to write the first instruction to. Subsequent instructions are written to following memory.

InstructionSet

Specifies the instruction set to assemble to. This can be:

  • ARM

  • Thumb

  • A32

  • T32

  • A64.

You can only specify an instruction set that is available for the processor. If you do not specify the instruction set, it defaults to the instruction set state at the specified address.

Instruction

Assembler instruction to write to memory. You can specify multiple instructions. Each instruction must be on a separate line.

You can also specify supported directives. The supported directives are:

  • ARM

  • THUMB

  • CODE32

  • CODE16

  • A64

  • DCB

  • DCD

  • DCDU

  • DCDO

  • DCFD

  • DCFDU

  • DCFS

  • DCFSU

  • DCI

  • DCQ

  • DCQU

  • DCW

  • DCWU.

    Note:

    The syntax for the instructions and directives follow the ARM assembly language syntax.
end

Specifies the end of the assemble command. The list of assembler instructions are written to memory only when you enter end.

Example 1-7 Examples

assemble $pc ARM    # Assemble the following ARM instructions
    ADD r1,r2,r3    # Write the A32 add instruction to address $PC
    SUB r2,r3,r4    # Write the A32 sub instruction to address $PC+4
    DMB             # Write Data Memory Barrier to $PC+8
    THUMB           # Assemble the following Thumb instructions
    MOVS r0,#10     # Write T32 move instruction to $PC+12
end                 # End of the assemble command

assemble 0x00008000 # Assemble the following directives
    DCB 0,1,2,3     # Write four bytes to 0x00008000
    DCD 7,8         # Write two words to 0x00008004 and 0x00008008
end                 # End of the assemble command
Non-ConfidentialPDF file icon PDF versionARM DUI0452Z
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.