by uticus · 3y ago · 0 comments
Now, replacing a MicroPython written in C, with a MicroPython written in Rust? I can easily see that.
* I know some consider C high level, especially if you are writing Assembly.
Setting up the clock tree, configuring pins/port functions, enabling peripheral clocks, interrupts (which ones and their priority levels), fixing erratas, etc. All of that should at the end of the day come down to a couple loads/stores to some memory mapped registers, and these registers are usually "wide" where they contain N bits to set N things - so if you design a C (or rust) api something like this:
enable_clock(int clock_id);
You wont get optimal code for: enable_clock(FOO);
enable_clock(BAR);
Because if FOO and BAR are both enabled by setting bit 3 and 7 in register X you get two loads, two bitwise or's and two stores when a single store with a single constant would have sufficed.So fire up a GUI program that lets you click on "enable FOO, enable BAR", "set main clock to crystal oscillator at N MHz, enable PLL x4, etc", have that generate optimal code and go from there.
there's no good way to collaborate, compare, etc with a low-code format.
While Python has taken over BASIC's role from those days.