Where software hits the metal
After some years, I still feel inadequate as a programmer, since I don't have a lot of experience with low level stuff and I'm really interested in it. I got an Arduino starter kit, but still I don't feel satisfied. I would like to do some MCU programming (in assembly) from the metal -> up. That means that I don't want any software on my MCU and I would like to write absolutely everything myself. That would be considered a hobby and time is not an issue. Question: Is that even possible nowadays ? What books / articles would you recommend ? What type of MCU has absolutely no (or as little as possible) software on it (by default) ? I'm sorry if my post is inadequate in some form. Thanks, Chris.
Yes it's possible - and what's better is you can use your existing Arduino (and its handy bootloader) as a bare-metal ATmega328p development board, simply by ignoring the Arduino IDE and libraries, and directly using avr-gcc to build and avrdude to load your hex files via the bootloader. You can even use the version of these tools installed by the Arduino IDE. Of course there are countless other chips, boards, compilers and IDEs you can buy as well - but we try to keep things generic on SE sites and not delve into shopping recommendations. To address your last point, most MCUs come with very little built-in software. But some do have an on-board bootloader (either permanent or previously flashed) which can accept a program over a serial port or USB. That's a very handy feature, as it means you can use a cheap, standard "consumer" cable to interface with them, rather than a $10-$1000 hardware programmer. Generally this code runs only on startup or only in a special mode - the rest of the time, your software (or libraries you choose to link to and deploy with your code) are all that is running on the CPU. But yes, there are a few cases where someone has taken an MCU with a lot of onboard flash, and put a runtime interpreter for something like .NET on it. If you want to do bare metal programming, then those are probably not what you want.
MCUs generally have a development environment available. Some are free (such as AVR Studio). Some cost money, but may have a free version. These will include libraries to compile C programs, but they are still "bare-metal" in the sense that you have to access registers and peripherals yourself. Some of the libraries may simplify arithmetic. For example, avr.lib comes with functions that perform 16-bit arithmetic on the 8-bit machine. The compiler will insert these library functions as appropriate. You can also program directly in assembly language, but any significant program can become very large. This is one-level closer to the metal than C, since the C source code will be compiled to assembly anyway. But it is a matter of opinion if it is more "bare-metal" than C. The best way to learn is to choose a processor mounted on a development board, and download an IDE. Download the datasheet for the chip and read it thoroughly. You will be referring to it often. Sparkfun and online web sites like that sell many boards to choose from. Chip manufacturers will offer development boards as well. The advantage of the development board is that all power supply details and connections are already worked out for you. After some experience, you can design your own. The other side of "bare-metal" is making your MCU interact with other peripheral sensors and actuators like compasses, accelerometers, servos, motors, and so on. Hobby stores usually offer boards with these devices mounted as well. Look to school course web sites for projects to attempt. Many ideas like controlling a Roomba are fun to do. Hack-a-day also has many projects featured. The are lots of forums devoted to chip families where project ideas are discussed. Have fun!
What does TDO on 4th bit in ICSP SendCommand header mean? (PIC32MX, ICSP 2-wire 4-phase)
Handle GPIO in User Space ARM9 Embedded Linux AM1808
Z_SOLO zlib embedded
What is the bootloader and startup code in embedded systems? [closed]
Handle GPIOs in User space for Embedded Linux ARM9
NEON output generated by the simulator regarding (pipeline information, stalls, execution cycles) not clear
Accessing RTC(DS1307) through I2C in ATmega16
Embedded: SDHC SPI write issue
Trying to understand writing to iomuxed port
XBEE Duplex Communication
u-boot - select the correct linux image
arm cortex m3 display
No source code lines were found at current PC 0x0
Is it generally possible to uniquely identify an individual MCU (for licensing purposes) (no MAC address available)
Initrd, Ramdisk, Initramfs, uclinux