--- gitea: none include_toc: true --- # Executables Sentinel 65X's firmware is designed to load and execute binaries in the `PGZ` format. This is a multi-segment binary file format which can load data into any number of areas of memory from a compact binary. ## PGZ Format The first byte of a PGZ file is always an ASCII "Z", hexadecimal value `0x5A`, decimal value `90`. This is followed by one or more segments, packed with no padding or separator. Each such segment has the following format: | Offset | Length | Description | | :----: | :----: | :------------: | | 0 | 3 bytes | Target address | | 3 | 3 bytes | Length of data | | 6 | ... | Data | This enables the binary loader to be extremely simple, as the data to be read into memory is always read from a contiguous region of memory, and the information provided is sufficient to make use of the C standard library `memcpy()` function. The final segment is special: its target address represents the entry point to the executable, and its length of data value is always `0x000000`. The loader can easily detect this to identify when loading is done and where to enter the program.