Project

General

Profile

Submit #3042

firmware: endianness support for fw_stub.awk

Added by sucanjan@fit.cvut.cz 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
06/03/2017
Due date:
% Done:

0%


Description

Hello,

this patch adds an optional parameter to a firmware specification
tuple for the fw_stub.awk script. The argument is a path to the
big-endian version of the firmware. If it is provided by the user, the
first path in the tuple is treated as little-endian, and two calls of
firmware_register() are generated by the script. The calls are
compiled conditionally according to endianness of target machine.

This is needed for the isp driver firmware to be moved from uit16_t C
arrays in header files to .uu files in sys/contrib/dev/isp.

Example of generated C source code:

#if BYTE_ORDER == BIG_ENDIAN
fp = firmware_register("name", _binary_BigEndianFW_start , (size_t)(_binary_BigEndianFW_end - _binary_BigEndianFW_start), 1234, NULL);
#else
fp = firmware_register("name", _binary_firmware_start , (size_t)(_binary_firmware_end - _binary_firmware_start), 1234, NULL);
#endif

0001-firmware-endianness-support-for-fw_stub.awk.patch View (3.58 KB) sucanjan@fit.cvut.cz, 06/03/2017 03:26 AM

History

#1 Updated by sucanjan@fit.cvut.cz 5 months ago

  • Status changed from New to Closed

Well, this doesn't seem to work as intended when firmware is to be embedded in a module. In order for it to work, kmod.mk would need to be patched too. Modifying the isp driver code so it is more endianness aware will be the simplest solution after all, because it is probably the only driver with this issue.

Also available in: Atom PDF