Author: dvalin Date: To: dng Subject: Re: [DNG] Lua
On 25.10.24 11:00, onefang wrote:
...
> Obviously tcc needs to be installed, it's a tiny C compiler.
If microcontrollers are the destination, then C is the vehicle which will take you there. An overlap of toolset/community and target is a prerequisite for finding ways to produce results.
> I may tackle assembler some day. lol
Granted, once fluent in one machine language, others come more easily.
Nevertheless, there is much less need to resort to an instruction set
cheat sheet, e.g. for "register indirect + offset" limitations &
peculiarities if you make one useful hardware choice, and climb the
learning curve on that. (Yup, there's pointers again, but now a
programming mainstay, essential for e.g. stack frames.)
Back when there were no compilers for microprocessors, there was only
assembler, and coding was laborious and error prone. Results will come
with much less effort if your first micro is approached with C in hand.
Easier still is a Raspberry Pi running Linux. Add a touchscreen, and you
can wiggle IO ports from that luxurious environment.
An arduino is a cheap "bare iron" platform, where you can go to town
without any OS. IO and on-board peripheral initialisation for custom PWM
or hardware input capture, baudrates, etc. can have you delving into
the 444 page datasheet for the ATmega328P on an arduino uno, for
example. In a couple of studious years, you'll be a pro.
If your makefile tells gcc to drop a .lst file for each input source
file, you can read the assembler generated from your C input
(interspersed with the source lines, so you have a chance of following
it). Alternatively, an "avr-objdump -D app.elf app.dump" after linking,
allows you to scroll through the final app, with all relocations done,
everything in its final place.
The (AVR) Atmegas are RISC, so not a big instruction set to wrap your
mind around, and a ~ 90% subset of that runs on the ATtinys, e.g. the
ATtiny25, available in SOIC8, so 4 of them can sit on your thumbnail.
(And yet there's several channels of 10 bit ADC, and PWM, with a
dead-time generator in case you'd like to drive an H-bridge.)
It doesn't take long to learn kicad, and design your own PCBs, initially
perhaps only to make a custom daughterboard for an arduino. (They call
them "shields".) Any of several PCB houses can have 10 PCBs back to you
in a week or two, for little money. It can be a lot of fun.