To explain more of what firmware is from the inside sense.
Firmware, is code that executes on very specific hardware, meaning it's op codes are specific to the hardware it's written for, it can be a family of chips or interfaces or meant for just one item.
Essentially what firmware does is this;
Has hardwired instructions for a given processor to undertake and execute, this is called a "bootstrap". Which the most bootable computers have this in their BIOS.
Initialize said hardware via the instruction in the firmware.
Load in / up the jump table.
Make the access to registers on a given device accessible.
Hand off control to the exiting routine once the BIOS has been used after a cold (powered off state) or warm start (normal reboot or reset pin has been used).
Most BIOSes (firmware) are designed for a specific chipset in mind and root out all the functions of those and flesh out any data that something could be attached to a given busline in a computer or embedded device.
Hard discs are a good example of a storage solution that in and of itself is an embedded device, that too has a BIOS on it and has a form of firmware on a chip.
Essentially, all firmware is, is a bunch of instructions that another processor does to get functionality out of a said device. It's software that is loaded into a physical device, upon losing power, it will be there when the device regains power.
Technically, you can use any programming or scripting language to create binary files. You just have to know how the processor you are going to be targeting works, the actual op codes, the internal register (let alone what they're for), to learn binary and hexadecimal number systems and how to create an assembler that can save your code in assembly language. After that is complete then you can task another program to convert it into binary, then save it as a .bin or .hex file.
If you want to know how Ada, C, C++, D and other programming languages convert their "tokens" which is their native code that is chopped up into pseudo op-codes into machine language. There are several books that I recommend you read, some are quite elementary and are centered around very specific processors but it's good to learn on. I will give you one book for the time being, because I don't want to drown you or anyone else that reading this in information.
- Crafting A Compiler with 'C' by Charles N. Fischer & Richard J. LeBlanc, Jr.
- Do visit this site, it's based on the x86 chipset found in the IBM PC;
That is the introduction to assembly language programming on PCs at the very beginning. It talks about handling interrupts (hardware and software interrupts) and many other topics, it explains more in depth what a BIOS actually does and how to work with it.
Unlike assembly language and machine language, you can get away with a lot more in Ada, C, C++, D, if you don't know your hardware specifics. In assembly and machine language, if you don't know what you're doing, either something bad will happen or the code won't work. I prefer the latter case, not working vs. something bad.
Note: About the answer above, about flash RAM, there is no such thing, there are flash ROMs but not flash RAMs. Flash ROMs have the firmware in them, the RAMs that are battery or capacitor backed, or have another flash ROM that contains parameters for the BIOS's options you've set.
There is code in firmware on how to store or clear the data memory (versus the program memory / firmware itself), if it's a flash ROM or a RAM chip. On PCs if you BIOS password gets garbled or you don't remember it (or someone is messing with you), you can open the case and find the two pins called, "CMOS CLR / CMOS CLEAR / BIOS RESET / BIOS RST", shorting those two pins together also clears the memory, all you would need to do after that is to hit the reset button, when the two pins are still shorted. That clears the password and allows you full access to your PC BIOS (assuming you have a newer computer from 1990s on).
On new PCs, you have flash memory for the firmware and you have battery backed SRAM (doesn't constantly need to be refreshed like DRAM chips, it's based on an older technology).