.n suffix to branch instruction?

We are inside write_four_registers_and_readback() , and the following command should call delay(10) :

 004002a4: bn 0x4002f4 <write_four_registers_and_readback+172> 78 delay(10); 

From the ARM instruction set, we learn that b is a branch followed by a two-minute mnemonics

Example:

 CMP R1,#0 ; Compare R1 with zero and branch to fred ; if R1 was zero, otherwise continue BEQ fred ; to next instruction. 

But this .n does not seem to be included in the table of two-letter mnemonics ... frankly, this is also not two-letter mnemonics. What does it mean.

Also, what does the number 0x4002f4 ? Is this just an absolute representation of the address placed in <> ? Or something else - point 4.4.3 Assembler syntax does not seem to explain.

The device is SAM4S , and the toolchain is arm-none-eabi-gcc .

+5
source share
1 answer

You have quite an old reference material there, but a modern tool chain. When Thumb-2 was introduced, ARM also introduced the new Unified Assembler Language , which allows you to write code that can be compiled into ARM or Thumb with (potentially) unchanged. Most, if not all, of the latest tools use UALs by default (although many of them still support legacy syntaxes).

In UAL, the suffixes .n and .w apply to mnemonics, which have both 16-bit Thumb (narrow) and 32-bit Thumb-2 ("wide") encoding * . If not specified, the assembler will automatically select the appropriate encoding, but if a specific encoding is required (for example, forcing a 32-bit encoding when the assembler selects a 16-bit version to register code for cache alignment), then a suffix can be specified.

Disassemblers typically emit suffixes to ensure that output, if passed through assembler, will result in the same object.

So, you have a 16-bit Thumb branch command for address 0x4002f4 , which goes through the write_four_registers_and_readback character for 172 bytes.

* Technically, all ARM encodings are also "wide" and therefore may have the suffix .w , but in this case it is completely redundant.

+8
source

Source: https://habr.com/ru/post/1207730/


All Articles