antmicro / zynq-mkbootimage

An open source replacement of the Xilinx bootgen application.
BSD 2-Clause "Simplified" License
92 stars 47 forks source link

Converting a bitstream to raw byte-swapped format #10

Open rroohhh opened 5 years ago

rroohhh commented 5 years ago

bootgen has the option --process_bitstream which converts a .bit-format bitstream to the raw byte-swapped format that is also used in a normal boot image, but without all the headers of a normal boot image (see http://www.wiki.xilinx.com/Solution+Zynq+PL+Programming+With+FPGA+Manager for a complete example). This is the format used by the mainline linux zynq support for programming the fpga and it would be useful to have this option in zynq-mkbootimage aswell.

All the necessary code is already there (basicly write only the data generated by bitstream_append to a file), however I'm not sure where in the code you would want to integrate this.

If you tell me how want this integrated (if at all) I would be happy to implement it.

tgorochowik commented 5 years ago

Hello Robin, That would be a nice addition indeed. Thank you!

I can think of two ways to do that: 1) Adding a new argument, parsing it in main and creating a bootrom.c equivalent with the process_bitstream (or even putting that callback right into bootrom.c, why not), that would be fully compatible with what Xilinx does. 2) Creating a completely new util, e.g. simply process-bitstream, in a new file with a new Makefile target - and invoke it simply like this: process-bitsream <original.bit> <processed.bin> - This is incompatible with what bootgen does but it seems to be over complicated to create a .bif file with just a single entry just to process bitstream, so it is fine not to keep this kind of compatibility in my opinion. We should only care that the actual usable .bif files are compatible with bootgen.

I guess both options are fine for now, if there are more features like this in the future we may just choose to go the other way and convert it (whatever will be cleaner).

Thanks!