Zehn

From Hackspire
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.