2018-07-25 19:06:21 +08:00
|
|
|
Binary Blob Assembler (bba)
|
|
|
|
===========================
|
|
|
|
|
|
|
|
This tools read a text file describing binary data, and write that binary data
|
|
|
|
file. The usual flow is that the input to bbasm is generated by a python
|
|
|
|
script, and the output is linked or loaded into a C program, using (packed)
|
|
|
|
structs to interpret the binary data.
|
|
|
|
|
|
|
|
All references (pointers) are encoded als 32 bit byte offset relative to the
|
|
|
|
location of the pointer. This way the resulting binary blob is position
|
|
|
|
independent.
|
|
|
|
|
|
|
|
Valid commands for the input are as follows.
|
|
|
|
|
2018-07-26 20:33:46 +08:00
|
|
|
pre \<string\>
|
|
|
|
--------------
|
2018-07-25 19:06:21 +08:00
|
|
|
|
|
|
|
When a C file is generated as output, all the "pre" strings will be included
|
|
|
|
before the binary blob.
|
|
|
|
|
2018-07-26 20:33:46 +08:00
|
|
|
post \<string\>
|
|
|
|
---------------
|
2018-07-25 19:06:21 +08:00
|
|
|
|
|
|
|
When a C file is generated as output, all the "post" strings will be included
|
|
|
|
after the binary blob.
|
|
|
|
|
2018-07-26 20:33:46 +08:00
|
|
|
push \<name\>
|
|
|
|
-------------
|
2018-07-25 19:06:21 +08:00
|
|
|
|
|
|
|
All following commands up until the matching "pop" will be writen to stream
|
|
|
|
<name>. Everything written to the same stream will end up in a continous
|
|
|
|
region of the output.
|
|
|
|
|
|
|
|
pop
|
|
|
|
---
|
|
|
|
|
|
|
|
End of a push..pop block.
|
|
|
|
|
2018-07-26 20:33:46 +08:00
|
|
|
label \<name\> \[\<comment\>\]
|
|
|
|
------------------------------
|
2018-07-25 19:06:21 +08:00
|
|
|
|
|
|
|
Add a label for the current position.
|
|
|
|
|
2018-07-26 20:33:46 +08:00
|
|
|
ref \<name\> \[\<comment\>\]
|
|
|
|
----------------------------
|
2018-07-25 19:06:21 +08:00
|
|
|
|
|
|
|
Add a 32-bit reference to the specified label. The reference will be a byte
|
|
|
|
offset relative to the memory location of the reference itself.
|
|
|
|
|
2018-07-26 20:33:46 +08:00
|
|
|
u8 \<value\> \[\<comment\>\]
|
|
|
|
----------------------------
|
2018-07-25 19:06:21 +08:00
|
|
|
|
|
|
|
Add a 8-bit value to the binary blob.
|
|
|
|
|
2018-07-26 20:33:46 +08:00
|
|
|
u16 \<value\> \[\<comment\>\]
|
|
|
|
-----------------------------
|
2018-07-25 19:06:21 +08:00
|
|
|
|
|
|
|
Add a 16-bit value to the binary blob. Note that the input must be structured
|
|
|
|
in a way that ensures that all u16 are aligned to 2-byte addresses.
|
|
|
|
|
2018-07-26 20:33:46 +08:00
|
|
|
u32 \<value\> \[\<comment\>\]
|
|
|
|
-----------------------------
|
2018-07-25 19:06:21 +08:00
|
|
|
|
|
|
|
Add a 32-bit value to the binary blob. Note that the input must be structured
|
|
|
|
in a way that ensures that all u32 are aligned to 4-byte addresses.
|
|
|
|
|
2018-07-26 20:33:46 +08:00
|
|
|
str \<string\>
|
|
|
|
--------------
|
2018-07-25 19:06:21 +08:00
|
|
|
|
|
|
|
Add a reference to a zero-terminated copy of the specified string.
|