无论是生成二进制固件的机器还是使用此二进制固件会闪光的设备,它们的字节存储顺序都需要小心对待。
One thing to be very careful here is the endianness of either the machine that produces the binary firmware and the device that will be flashed using this binary firmware.
Endianness是指多字节字在内存中的存储顺序。
Endianness refers to the order in which the bytes of a multi-byte word are stored in memory.
如果可以选择的话,请使用标准库函数来进行字节交换操作,并按照字节在数据文件中存储的顺序进行标准化;网络字节顺序最适合这种工作。
If you have the option, use standard library functions to do byte-swapping operations, and standardize on the order in which bytes are stored in your data files; network byte order is the best.
应用推荐