Creating a block of data in ROM

The following macros allow to insert data in program space:

  1. ROM_TXT(text)

    Insert the specifed text in ROM, at the current program location. The text must be enclosed by double quotes. The resulting block is not nul-terminated by default, so an explicit zero must be included in the specified string when needed. (eg: ROM_TXT("my string\0") ; ). It is important to note that the text is encoded with 2 chars in each program word, so texts with an odd number of chars are padded with a nul char (ASCII 0).

  2. ROM_BYTES(data)

    Insert the specified sequence of bytes in ROM. The data parameter can be any sequence of bytes, encosed by double quotes (eg: ROM_BYTES("0,1,2,0x33,5") ; ). Since the parameter of ROM_BYTES is processed by the assembler, your can use any syntax recognized by the assembler, for example a calculation on constant values (eg: ROM_BYTES("'A', 'A'+1") ; ) Like strings, a nul byte is added for padding when the number of specified bytes is odd.

  3. ROM_WORDS(data)

    Insert the specified sequence of words (ie: 16 bit) in ROM. The data parameter can be any sequence of numbers, enclosed with double quotes
    (eg: ROM_WORDS("1000,200,123, 0xFFFF") ; ).

AG 2013-04-10