rcolistete wrote: ↑Sat Jul 25, 2020 6:00 pm
Maybe an option would be :
- to implement all ulab functions with "ICACHE_FLASH_ATTR" decorator;
- detect when not building for ESP8266, then "ICACHE_FLASH_ATTR" decorator could be set as empty.
I am not sure it is an elegant solution. What happens, if some other platform requires other kind of decorators? I think compilation issues have to be handled either in the main, or in make files, and the ulab code itself should be platform-independent.
rcolistete wrote: ↑Sat Jul 25, 2020 6:00 pm
I prefer to add 1 single line in "micropython/ports/esp8266/boards/esp8266_common.ld".
If so, you could try to convince the micropython maintainers to provide a tool that would overriding of the linker options possible. I believe, all that would be required is that at the beginning of the make process, you should be able to/allowed to run your own script that could modify the Makefile, the linker scripts, or whatever. This could be a rather universal solution, and it would also eliminate the need for modifications of the micropython main for each user library.
I see that you are passionate about bringing ulab to the ESP8266. So am I, but we also have to keep in mind that micropython itself should not be steered by external libraries. There should be tools to make the inclusion of third-party components possible, but everything else should he done on the library's side.
If you want to make ESP8266 with ulab available for everyone, you should simply write and publish a script that modifies the above-mentioned three files, and then you are done. We can do that in the ulab repository, if you would like.
rcolistete wrote: ↑Sat Jul 25, 2020 6:00 pm
Not just that, I prefer to have ulab builtin in many MicroPython firmwares (with enough space) : Pyboard v1.11, Pyboard D, ESP8266 with >= 2MB flash, ESP32, etc.
I think the cleanest way is to compile the firmware yourself, if you need ulab. The problem is that there are other user modules out there, and you can't possibly put everything in the "official" firmware. But if it is so, who should choose the packages? Even on a computer, python is in every linux distribution, but you have to install numpy separately. And what should happen, if the modification of an external module breaks the compilation process? Whose responsibility will it be to fix the problem?
Also, even the pyboard has many options that you can switch off (like support for SD card, user switch, LEDs, etc.) to save space. I also made ulab highly configurable, because I do know that there are situations, when flash space is an issue.