Zehn

From Hackspire
Revision as of 20:28, 17 August 2014 by Vogtinator (talk | contribs) (Created page with "Zehn is a new executable format, which supports: * Full relocation (No "-fpic" or similiar needed) * Every kind of section in an ELF file (E.g. ARM unwind information for C++ exc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Zehn is a new executable format, which supports:

Name

"Zehn" is German for 10 while ELF is German for 11.

Format

The main header file (https://github.com/ndless-nspire/Ndless/blob/master/ndless-sdk/include/zehn.h) contains everything needed to parse a Zehn file. The Zehn header (identified by ZEHN_SIGNATURE) may be everywhere (4-byte aligned) in the first 4KiB if the file starts with "PRG\0" to support backwards-compatibility.

genzehn tool

The "genzehn" tool (https://github.com/ndless-nspire/Ndless/blob/master/ndless-sdk/toolchain/genzehn/genzehn.cpp) converts ELF files with embedded relocation info (needs to be linked with "--emit-relocs") to relocatable Zehn files. Run "genzehn --help" to get version and usage information. For basic conversion it's sufficient to only specify "--input input.elf" and "--output output.tns". The resulting executable will open on every version of OS, ndless and type of hardware and the version will be 1.

make-prg tool

The "make-prg" tool (https://github.com/ndless-nspire/Ndless/blob/master/ndless-sdk/bin/make-prg) adds zehn_loader.tns at the top of the file, so that older versions of ndless without native support for Zehn. "zehn_loader.tns" is also used to boostrap ndless_resources, which is a Zehn file itself. It doesn't support any of the flags, so your executable may be executed on unsupported hardware or significantly too old OS versions! To use it, execute "make-prg <input> <output>". It compiles zehn_loader.tns if needed.