Here you will find needed documentation to define your own command files to use
with tt-loader.

=== General syntax ===

1. One command is generally completly defined by one line finished by a single
   line feed.

2. The command function is defined by only the first char.

3. Commands with one parameter must only be one char, than a space or line feed,
   and then the parameter.
   
4. Command can only have one parameter.

5. One char commands can be separated by just ';' char without spaces. This is
   used for example to dump large memory blocks with 'M' command.

=== Comments ===

6. Comments are defined with chars '/' or '#':
   * lines beginning with '/' are completly ignored
   * lines beginning with '#' are printed out but ignored
   
=== One char commands ===

7. 'M' is used to dump the content from currently known address. The known
   address is always initialized with 'a' command. As memory is dump, the known
   address is updated to point to the next memory block. Dumps are done by block
   of 8 kilo-bytes.

8. 'P' is used to peek the word pointed by the currently known address. Address
   is then updated to the next word.

9. 'S' is used to set the stack address to the currently known address. This can
   be useful when testing boot loaders in case the current stack may be reset to
   zeros.

10. 'c' is used to call a program from the currently known address. The program
   should return and the returned value is logged.

11. 'b' is used to boot to the last known address. Program should not return.

12. 'e' is used to specify the end of the commands. No other command will be
    read after this command.
    
13. 'D' is used to ask a download from the OMAP device to a file. The filename
    must have been spécified earlier as if it is still exists, the download will
    only occur if the CRC32 of the local file is different from the remote CRC32
    of the checked memory.
    
=== One parameter commands ===

13. 'a' must be used to update the currently known address in the OMAP device.
    The address should be specified as hexadecimal with 8 digits as in the
    following format:
    a 0x12345678

14. 'f' is used to load a file into the device memory. The start address must
    has been set with 'a' command just before. The parameter must be the path to
    the file to load.

15. 'd' is used to save to a file the content of the memory downloaded with 'm'
    command. The parameter id the path to path to write.
    If the file exists, it is just overwritten.
    The file size will be the size of the downloaded memory.

16. 'F' is used to prepare a next download. The parameter must be the path to
    the file to be created or updated. This command is necessary if you must to
    update an existing file only if CRC32 of local file is different from remote
    memory CRC32 check. This is accomplish by using the 'C' command with '0' as
    parameter. Later, the 'D' command must be used to update the file. As in the
    following example:
    
    F /tmp/memory-dump.raw
    C 0
    // Dump 1 Mb from address 0x10000000
    a 0x10000000
    m 1024
    # Updating file is CRC32 has changed
    D

17. 'C' is used to set a CRC32 is to be checked on the next memory download. The
    parameter is an unsigned integer. It should be specified as an 8-digit
    hexadecimal number or just set to 0. If it is set to 0 and a file has been
    specified with the 'F' command, then the sent CRC32 will be computed from
    the file content. On the next download with 'm' command, this CRC32 will be
    compared to the one found for the targeted memory part.

18. 'm' is used to just download a memory part to a computer buffer. The
    parameter is an unsigned integer specifying the size of the memory part to
    download. The start address of that part must has been set just before with
    the 'a' command. If a CRC32 has been sent with the 'C' command, you will
    receive an empty part if the CRC32 match the targeted memory part CRC32.

19. 'k' is used while you want to start a linux kernel. The parameter must be an
    integer specifying the device id. For example, for OMAP P2 device id should
    be set to 491. This id must match one from "linux/arch/arm/tools/mach-types"
    linux kernel source file. The address to boot the kernel must has been
    specified with 'a' command.
    By default, some other ATAG are still set:
    ATAG_MEM memory start is set to 0x10000000 and size to 64 Mbytes.
    ATAG_CORE has defaults (check 2nd.bin sources if you are interested)
    ATAG_INITRD is not set as defaumt initrd size is zero.
    ATAG_CMDLINE is set to:
    "mem=64M console=ttyS0,115200 noinitrd root=/dev/mtdblock_bbs5"
    
    If you need other defaults, you should edit 2nd/config.h or/and the
    set_kernel_args() function in 2nd/main.c and cross-compile 2nd.bin before
    using tt-loader.
    
TODO:
 * Authorize to override some ATAG default values to boot linux kernel
 * Add a command to validate the CRC32 of the uploaded file to be definitively
   paranoid in some critical case. If the content should be flash to a NAND
   critical part for example.
