On Sat, Jun 24, 2023 at 11:59 AM Michael Schwingen <mich...@schwingen.org> wrote: > > On 23.06.23 14:12, Antonio Borneo wrote: > > Hi, > > I would like to have your feedback on this topic. > > > > Today a binary package of OpenOCD should include: > > - the binary openocd[.exe] > > - the TCL scripts from tcl folder > > - the file contrib/60-openocd.rules (for Linux only) > > - documentation > > - license files > > > To avoid adding the two new files in the binary package, I would like > > to embed them too inside openocd[.exe]. > > What is the problem you are trying to solve by embedding these files? > > OpenOCD already needs to find the scripts. While embedding small files > like flash code is fine, I do not see a reason why bigger files like > FPGA bitstreams can't be distributed in their original form. > > What is the benefit of including zlib and code to manage decompression > versus just loading the data from a file?
Valid question! But I either don't see a good reason to distribute the FPGA bitstream in the original form as a big file, Some of the flashing binaries are not small, so compression can be welcome there too (maybe we should also investigate why they are so big and if they can be optimized). Embedding the binaries is an easy way to deploy OpenOCD without a complete packaging; I can just copy openocd statically linked (or with its lib dependencies) plus the few scripts I need. Keeping separate the loadable scripts is instead welcome: they are good as examples, are easy to edit/change, the user can load its own script. This does not (always) apply to the binaries. We offer command-line flags and TCL commands to set the search path and to find the scripts in the path. Today the only external binary is searched at a fixed path. If we allow external binaries we should add some features to find them. I'm thinking I would try to add zlib and use it for one of the big flashers, to see how much mess it adds. It could end up that it doesn't make sense just for the extra code to be maintained... And I ask again: any other use case that could benefit from compression? By the way, someone is going to extend OpenOCD to load external binary flashers from ARM CMSIS files.FLM https://open-cmsis-pack.github.io/Open-CMSIS-Pack-Spec/main/html/flashAlgorithm.html These are often prorietary binaries with either custom and/or incompatible licenses; they cannot be embedded in OpenOCD, probably even cannot be distributed in the same package. They must be loaded from external files, but here the reason why is clear. Antonio