bindesc: Fix placing of the descriptors end tag

Prior to this fix the descriptors end tag was placed in the binary
using LONG. This was wrong because the tag is of type short, and
the size of the descriptor (0), should have also been placed.
It so happened that on little endian machines the incorrect linker
script yielded correct results, as the extra zeros added to make
the value a long ended up as the correct byte sequence
(FF FF 00 00). On big endian machines however, the wrong sequence
is generated (00 00 FF FF).
This patch correct this issue.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
This commit is contained in:
Yonatan Schachter 2023-12-20 13:47:01 +02:00 committed by Anas Nashif
parent da87952948
commit c8c25b5c52
2 changed files with 4 additions and 3 deletions

View file

@ -62,8 +62,8 @@ Putting it all together, here is what the example above would look like in memor
.. code-block::
46 60 a4 7e 5a 3e 86 b9 02 10 0d 00 48 65 6c 6c 6f 20 77 6f 72 6c 64 21 00 00 00 00 ff ff
| magic | tag |length| H e l l o w o r l d ! | pad | end |
46 60 a4 7e 5a 3e 86 b9 02 10 0d 00 48 65 6c 6c 6f 20 77 6f 72 6c 64 21 00 00 00 00 ff ff 00 00
| magic | tag |length| H e l l o w o r l d ! | pad | end |
Usage
*****

View file

@ -10,4 +10,5 @@
SQUAD(BINDESC_MAGIC);
Z_LINK_ITERABLE(bindesc_entry);
. = ALIGN(BINDESC_ALIGNMENT);
LONG(BINDESC_TAG_DESCRIPTORS_END)
SHORT(BINDESC_TAG_DESCRIPTORS_END);
SHORT(0);