Sections in MicroTESK

Home / New Features / Sections in MicroTESK

As you may know, the GNU Assembler (GAS) as well as the ELF and COFF object file formats supports so-called sections. Section is a contiguous piece of code located at a specified memory address. Besides the starting address, each section is described with a number of attributes such as name, size, etc.

The recent MicroTESK build (2.4.27) allows using sections in test templates. It supports two predefined sections: .data (constants and variables) and .text (executable code). Also, there is a possibility to define custom sections. Syntactically, sections are blocks that wrap data or code declarations.

section_data(...) { # .data
  word 0, 1, 2
  ...
}
section_text(...) { # .text
  sequence {
    add t0, t1, t2
    ...
  }.run
}
section(:name => 'name', ...) { # .section name
  ...
}

Each section has the following parameters (excluding custom sections’ :name):

:va is the starting virtual address (the value should be consistent with the linker option);
:pa is the starting physical address (a hint for MicroTESK to initialize memory);
:args are format-specific arguments (they are passed to the assembly output without interpretation).

section(:name => 'custom', :va => 0x0123_0000, :pa => 0x0123_0000, :args => '#write') {
  ...
}

The build can be downloaded from the link below:
http://forge.ispras.ru/attachments/download/5213/microtesk-2.4.27-beta-170626.tar.gz

For more information on the .section directive in GAS, see Using as.

 

Leave a Reply

Your email address will not be published. Required fields are marked *