How much effort will it be to learn to deploy #rust on my #arduino vs learning enough C to get by?
-
Riley S. Faelanreplied to Yeshaya Lazarevich last edited by
@alter_kaker Then, feel free to start from Rust, and skip the C(++) entirely. I believe these days there's ready Rust toolchains that you can get, and once the compilation is done,
avrdude
won't care what language it was originally written in.If you like the Arduino IDE, check if it supports Rust for AVR8 as a downloadable extension. It has been adding a number of new languages and toolchains in the couple of recent years, as a whole bunch of new SBCs becam popular, and if somebody has prepackaged AVR8 Rust for it, it might make getting it set that much easier for you.
-
Yeshaya Lazarevichreplied to Riley S. Faelan last edited by
@riley
I prefer vscode. There's something called avr-hal that I'm trying to get to work. Running into configuration issues, we'll see how it goes -
Riley S. Faelanreplied to Yeshaya Lazarevich last edited by
@alter_kaker I have only used vscode for C#, so I don't have useful experience to share, I'm afraid.
-
Yeshaya Lazarevichreplied to Riley S. Faelan last edited by
-
Riley S. Faelanreplied to Yeshaya Lazarevich last edited by
@alter_kaker Happy hacking!
-
Yeshaya Lazarevichreplied to Riley S. Faelan last edited by
@riley
Status update: I'm back to C++ because I was having issues with the Rust SPI and SD Card libraries...I've been avoiding learning C++ since about 2000CE...
-
Riley S. Faelanreplied to Yeshaya Lazarevich last edited by
@alter_kaker I have done some work with C++. If you have any questions, I might be able to answer or suggest useful googlewords.
Also, what kind of issues were these? Perhaps these could be fixed, as well.
-
Yeshaya Lazarevichreplied to Yeshaya Lazarevich last edited by
@riley
Right now I'm running into very irritating problems. I got my program to work in procedural code, and I tried to convert a small part to OO. Now it's compiling, but always crashes or hangs, each time at a different point in the program. I don't really know how to debug something like this. -
Yeshaya Lazarevichreplied to Riley S. Faelan last edited by
@riley
It was failing to read the SD card despite the fact that the hardware was correctly connected, and the configuration was the same as what I used in the regular Arduino.I could raise some tickets and I still might, but it's kind of a hassle.
-
Yeshaya Lazarevichreplied to Yeshaya Lazarevich last edited by
@riley
@project1enigma it never ends -
@alter_kaker @riley Break down the changes to very small ones. a) plain C code but compiled in C++ mode (this might already be a relevant change). b) the other steps. Really break them down. Then git bisect them.
-
@project1enigma
Hmm. Yeah, this already works in c-like c++ code. I'll try to make the changes smaller. Thank you. I hope it'll be worth it
@riley -
@alter_kaker @riley Small iterations is always my fave. At least where there are fast enough turnarounds. Behatzlacha!
-
@project1enigma
Yes. I made a small change but I reduced it even further. Instead of writing and reading from two byte arrays, I encapsulated them in a Buffer class. Total less than 50 lines... Still crashes right at the beginning. Would you be willing to look if anything jumps out at you? This is my very first C++ class... -
@alter_kaker @riley Where do buf_a/buf_b point to?
-
@project1enigma
haha I just fixed it, they were not pointing to anywhere... Updated to initialize in the header file as arrays. @riley -
@alter_kaker @riley That's probably what you need, arrays.
-
@project1enigma
It works now, so clearly you're right . I got confused by how arrays get initialized. Does this impact ctor considerations?
@riley -
@alter_kaker @riley Unless you depend on certain initial values of the buffer, you could still omit the ctor (use the compiler defined default).
-
@alter_kaker @riley That would leave the buffers uninitialized. But the storage is allocated. That's okay as long as the first access of each cell in the arrays is a write (e.g. by File::read)