What is the flash data between interrupt vectors and trampolines?

If one takes a compiled .elf file from the Arduino IDE and disassembles it there is an amount of what I think is data inbetween the interrupt vector table and the start of the trampolines which I cannot fathom what it does.

For example on mega2560 after doing "avr-objdump -S output_elf_file > assembly.txt" get :

00000000 <__vectors>:
       0:	0c 94 b6 32 	jmp	0x656c	; 0x656c <__ctors_end>
       4:	0c 94 d1 96 	jmp	0x12da2	; 0x12da2 <__vector_1>
       8:	0c 94 a6 96 	jmp	0x12d4c	; 0x12d4c <__vector_2>
       c:	0c 94 7b 96 	jmp	0x12cf6	; 0x12cf6 <__vector_3>
      10:	0c 94 50 96 	jmp	0x12ca0	; 0x12ca0 <__vector_4>
      14:	0c 94 25 96 	jmp	0x12c4a	; 0x12c4a <__vector_5>
      18:	0c 94 fa 95 	jmp	0x12bf4	; 0x12bf4 <__vector_6>
      1c:	0c 94 cf 95 	jmp	0x12b9e	; 0x12b9e <__vector_7>
      20:	0c 94 a4 95 	jmp	0x12b48	; 0x12b48 <__vector_8>
      24:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      28:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      2c:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      30:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      34:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      38:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      3c:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      40:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      44:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      48:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      4c:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      50:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      54:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      58:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      5c:	0c 94 5a 95 	jmp	0x12ab4	; 0x12ab4 <__vector_23>
      60:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      64:	0c 94 d0 89 	jmp	0x113a0	; 0x113a0 <__vector_25>
      68:	0c 94 a6 89 	jmp	0x1134c	; 0x1134c <__vector_26>
      6c:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      70:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      74:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      78:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      7c:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      80:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      84:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      88:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      8c:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      90:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      94:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      98:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      9c:	0c 94 f7 af 	jmp	0x15fee	; 0x15fee <__vector_39>
      a0:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      a4:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      a8:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      ac:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      b0:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      b4:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      b8:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      bc:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      c0:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      c4:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      c8:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      cc:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      d0:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      d4:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      d8:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      dc:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      e0:	0c 94 e7 32 	jmp	0x65ce	; 0x65ce <__bad_interrupt>
      e4:	08 00       	.word	0x0008	; ????
      e6:	00 00       	nop
      e8:	be 92       	st	-X, r11
      ea:	24 49       	sbci	r18, 0x94	; 148
      ec:	12 3e       	cpi	r17, 0xE2	; 226
      ee:	ab aa       	std	Y+51, r10	; 0x33
      f0:	aa 2a       	or	r10, r26
      f2:	be cd       	rjmp	.-1156   	; 0xfffffc70 <__eeprom_end+0xff7efc70>
      f4:	cc cc        	rjmp	.-1640   	; 0xfffffa8e <__eeprom_end+0xff7efa8e>
      f6:	4c 3e       	cpi	r20, 0xEC	; 236
      f8:	00 00       	nop
      fa:	00 80       	ld	r0, Z
      fc:	be ab       	std	Y+54, r27	; 0x36
      fe:	aa aa       	std	Y+50, r10	; 0x32
     100:	aa 3e       	cpi	r26, 0xEA	; 234
     102:	00 00       	nop
     104:	00 00       	nop
     106:	bf 00       	.word	0x00bf	; ????
     108:	00 00       	nop
     10a:	80 3f       	cpi	r24, 0xF0	; 240
     10c:	00 00       	nop
     10e:	00 00       	nop
     110:	00 08       	sbc	r0, r0
     112:	41 78       	andi	r20, 0x81	; 129
     114:	d3 bb       	out	0x13, r29	; 19
     116:	43 87       	std	Z+11, r20	; 0x0b
     118:	d1 13       	cpse	r29, r17
     11a:	3d 19       	sub	r19, r13
     11c:	0e 3c       	cpi	r16, 0xCE	; 206
     11e:	c3 bd       	out	0x23, r28	; 35
     120:	42 82       	std	Z+2, r4	; 0x02
     122:	ad 2b       	or	r26, r29
     124:	3e 68       	ori	r19, 0x8E	; 142
     126:	ec 82       	std	Y+4, r14	; 0x04
     128:	76 be       	out	0x36, r7	; 54
     12a:	d9 8f       	std	Y+25, r29	; 0x19
     12c:	e1 a9       	ldd	r30, Z+49	; 0x31
     12e:	3e 4c       	sbci	r19, 0xCE	; 206
     130:	80 ef       	ldi	r24, 0xF0	; 240
     132:	ff be       	        out	0x3f, r15	; 63
     134:	01 c4       	rjmp	.+2050   	; 0x938 <_ZL21FreeSans24pt7bBitmaps+0x262>
     136:	ff 7f       	        andi	r31, 0xFF	; 255
     138:	3f 00       	.word	0x003f	; ????
     13a:	00 00       	nop
	...

0000013e <__trampolines_start>:
     13e:	0c 94 5a ce 	jmp	0x19cb4	; 0x19cb4 <main+0x21d0>
     142:	0c 94 a9 9c 	jmp	0x13952	; 0x13952 <_ZN6SdFile5writeEh>
     146:	0c 94 01 78 	jmp	0xf002	; 0xf002 <_ZN7TwoWire5writeEPKhj>
     14a:	0c 94 85 a0 	jmp	0x1410a	; 0x1410a <_ZN13MCUFRIEND_kbv8fillRectEiiiij>
     14e:	0c 94 3d 74 	jmp	0xe87a	; 0xe87a <setup+0x3080>
     152:	0c 94 45 74 	jmp	0xe88a	; 0xe88a <setup+0x3090>
     156:	0c 94 d7 75 	jmp	0xebae	; 0xebae <_ZN14HardwareSerial4readEv>
     15a:	0c 94 41 74 	jmp	0xe882	; 0xe882 <setup+0x3088>
     15e:	0c 94 7c 77 	jmp	0xeef8	; 0xeef8 <_ZN5SDLib4File17availableForWriteEv>
     162:	0c 94 02 77 	jmp	0xee04	; 0xee04 <turnOffPWM+0x66>
     166:	0c 94 78 7b 	jmp	0xf6f0	; 0xf6f0 <_ZN12Adafruit_GFX8drawRectEiiiij>
     16a:	0c 94 4e cc 	jmp	0x1989c	; 0x1989c <main+0x1db8>
     16e:	0c 94 51 74 	jmp	0xe8a2	; 0xe8a2 <setup+0x30a8>
     172:	0c 94 3c 8c 	jmp	0x11878	; 0x11878 <analogWrite+0x8a>
     ...

I believe the stuff at e4 to 13d is actually data as the assembly code makes no sense to me at all.

Does anyone know what this is ?

Reason why I do not believe this is assembly code is that a few lines in it has:

      f2:	be cd       	rjmp	.-1156   	; 0xfffffc70 <__eeprom_end+0xff7efc70>
      f4:	cc cc       	        rjmp	.-1640   	; 0xfffffa8e <__eeprom_end+0xff7efa8e>

It makes no sense doing a relative jump back 1640 from a starting point less than that (flash address f4).

Many thanks...

Geoffrey, NZ.

Presumably constants; stuff like the pin-to-port mapping table, F() strings, and so on.

This is controlled by the "linker script", which you can find in .../hardware/tools/avr/avr/lib/ldscripts/

I think mega2560 uses avr6.x, which has:

  /* Internal text space or external memory.  */
  .text   :
  {
    *(.vectors)
    KEEP(*(.vectors))
    /* For data that needs to reside in the lower 64k of progmem.  */
     *(.progmem.gcc*)
    /* PR 13812: Placing the trampolines here gives a better chance
       that they will be in range of the code that uses them.  */
    . = ALIGN(2);
     __trampolines_start = . ;
    /* The jump trampolines for the 16-bit limited relocs will reside here.  */
    *(.trampolines)
     *(.trampolines*)
     __trampolines_end = . ;
    /* avr-libc expects these data to reside in lower 64K. */
     *libprintf_flt.a:*(.progmem.data)
     *libc.a:*(.progmem.data)
     *(.progmem*)
    . = ALIGN(2);
    /* For future tablejump instruction arrays for 3 byte pc devices.
       We don't relax jump/call instructions within these sections.  */
    *(.jumptables)
     *(.jumptables*)
    /* For code that needs to reside in the lower 128k progmem.  */
    *(.lowtext)
     *(.lowtext*)
     __ctors_start = . ;
     *(.ctors)
     __ctors_end = . ;
     __dtors_start = . ;
     *(.dtors)
     __dtors_end = . ;
    KEEP(SORT(*)(.ctors))
    KEEP(SORT(*)(.dtors))
    /* From this point on, we don't bother about wether the insns are
       below or above the 16 bits boundary.  */
    *(.init0)  /* Start here after reset.  */
/* etc : */
1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.