News for hackers. Stuff that matters.
Re:What? More 8-Bit Microcontrollers? by Findecanor on Friday July 01, 2022 @05:40AM (#31944234)
That AVR has 8-bit registers isn't much of a benefit today. While it might make the AVR's core small, it requires more instructions to operate on 16-bit or 32-bit values — which a lot of code has to. For instance, an "int" in AVR C is 16 bits and because C does "integer promotion", it requires 16-bit semantics even when both operands are char. Despite having wider registers, I believe RISC-V cores could be made quite small too because of how lean its ISA is.

As a hobbyist, I use AVR mostly because it is 5V-capable and electrically robust, so it can interface with vintage peripherals without requiring signal-level converters or additional ESD protection. It would be nice to see more competition in this space, for sure.

Re:What? More 8-Bit Microcontrollers? by gsliepen on Friday July 01, 2022 @08:51AM (#31945676)
While the C standard does say that integer promotion happens, if the result is being cast back to char again, a C compiler will see that it doesn't need to operate on 16 bits and is allowed to optimize the result back to 8 bit operations. See for example: https://godbolt.org/z/zM8reeqrc
Re:What? More 8-Bit Microcontrollers? by hajile on Friday July 01, 2022 @10:36AM (#31946965)
I feel like 16-bit MCs aren't popular because they aren't popular.

They offer a straight-up 2x performance increase in most applications and something like a 4-10x performance increase with 32-bit numbers (not to mention the space savings from fewer instructions).

Despite this, the 16-bit MCs all seem to be rather niche. I'd love for an open RISC-V variant that could fill this gap and allow sourcing of the same ISA from multiple companies.