I'm actually programming an MKR 1310 Arduino in order to make a feedback box. I want also the box to be set up via an easy to undertsand software. For example, using a form for the parameters instead of modifying each parameter and knowing how to write and understand code.
So modifying a text file is easy from a software, but were it gets more difficult is how I can compile the modified file. To keep the most simple and understandable user interface I cannot use the arduino CLI (or at least I don't think so). Moreover I cannot compile the binary file with the arduino IDE because it means for the user to open this IDE (tell me if I'm wrong).
More, I don't see the interest to make a makefile which would include all the arduino compilation commands that we can see during the compilation which are quite numerous and complex.
Finally, the MKR 1310 uses bossac as upload and not avrdude so the following make file does not work: GitHub - sudar/Arduino-Makefile: Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.
Well, my questions now are :
do you know another way or a simplest way to compile an .ino file without using the IDE ?
do you think that it could be relevant for me to code in C or C++ and compile in binary via gcc, g++ which are easier ?
I truly believe Arduino CLI is the ideal option if you want to use the Arduino framework for your code. You mention your desire to use make; is that really so much more simple and understandable than Arduino CLI?
More importantly, if you are already writing software to set these parameters, why not make the same software run the arduino-cli upload command, so the user never has to interact directly with it at all?
You can use Arduino IDE 1.x from the command line, but that is no improvement compared to using Arduino CLI, and in fact significantly worse due to the order of magnitude increase in the application size (for the GUI features you won't even use), as well as it being a dead end due to Arduino IDE 2.x not having a command line interface (since it would be redundant to Arduino CLI, which comes bundled with the installation).
I doubt there is any. As you said, it is a very complex process.
For a fixed hardware configuration and limited range of "options", it ought to be pretty trivial to convert "Arduino code" to something that is compileable via CLI gcc commands (and uploaded via BOSSAC or whatever.) (pre-compile the core and any libraries, write your "sketch" so that it does not need the Arduino pre-processing.)
Note, however, that installing the avr-gcc compiler is usually "somewhat more difficult" than installing Arduino.
Yes I really don't want the user to see that there is anything about code, the users will really be non-informatic person, plus users from other countries who don't necessarily have access to digital as easily as we do and therefore will have more difficulties to take in hand the arduino CLI in the form that it is, in my opinion.
That's a good idea that will be an excellent compromise I think, I will try to make that.
Thank you for your time and very pertinent answer !
First of all, thank you for your answer !
That was an idea I had but I was wondering is the compiling binary different when we change the content of the text file on the SD card ?
If the binary will be different it cannot be a solution for how to compile the .ino file easily.
I don't understand what you mean by that. In which case the "sketch" need the Arduino pre-processing ? A "sketch" that doesn't need the Arduino pre-processing is a sketch written in C ?
Other question that is more about programming is how do you put together the pre-compile core and the newly compile sketch ?
Actually, for a MKR1310 (which I didn't notice before), you'd need an arm arm-none-eabi-gcc compiler install. And the associated Microchip SAMD support.
"just gcc" would target the same processor that the compiler is installed on (your PC?), but to compile for a separate board like an Arduino you need a different version of the compiler to produce code for whatever processor is on that board. (A Microchip SAMD21 ARM Cortex M0+, for the MKR1310.) Installing an RAM compiler is even more complicated than installing the AVR compiler
If I might be slightly rude - if your understanding of how an Arduino build works is at the level implied by that question, what you want to do is probably NOT going to be "pretty trivial"...
(OTOH, it sounds like you have a pretty clear picture of how you want things to look, eventually. And that can be half the battle.)
There are assorted discussions on just what the "Arduino IDE" does that makes a "sketch" different than a C (actually C++) program, but the main point is that when you get the "verify" or "upload" buttons in the IDE, there is an intermediate stage where the IDE has converted the sketch into a correct C++ file, compiled all the libraries and stashed the results in a temporary directory, compiled the "core" files and stashed those results in a different tmp directory, and so on. After that, it's using a standard C++ and linker procedure to put everything together.
If you were to "intercept" those intermediate results, you could have an easily-modified "options.h" file that would customize your code and then finish the compilation using tools other than the IDE.
Another idea might be to replace MKR board with on of the boards that runs circuitPython or microPython. In that case, the "language implementation" is all on the board itself, and the files it eats are plain text python programs...
In fact I've good knowledge in programming but not at all in mechatronics that's why I have difficulty with these notions. But it's make more sense now thanks to you.
For now, I'm trying with calling arduin-cli from the app and it sounds like a good compromise without knowing perfectly the Arduino build.
By entering those parameters using some sort of interface. Since the box includes a (assumed bidirectional) radio module, that creates many opportunities for someone willing to think a bit about how to proceed.
The fact is not about LoRa module not being bidirectional is about the receiver doesn't have the necessary information to configure the emitter... The receiver's dealing with multiple emitters and doesn't know a thing about them except their id that the emitter transmit to them + there is other information entered by the user like the location of the box in a building and the transmitter doesn't need to know and have no way to know where it could be without the user
By entering those parameters using some sort of interface.
If it's just data, it should be relatively easy to upload the parameters over the same interface that you WOULD be using to upload a new set of code. Either using the bootloader that is there already (putting the data at some absolute memory location that you sketch can read), or an interface designed to listen to the serial/USB interface for something like a text file: