Writing in assembler reduces the code size and the execution time. But suppose I have enough memory and enough time. Can I use just C code and boot the device? I mean, from power on, directly run C code. I'm specifically interested in ARM processors.
Actually you can make a C-only firmware for ARM's Cortex-M3 microcontrollers. Because its vector table includes an entry for the stack pointer, its value will be initialized by the processor and you can use compiled code straight away from the reset. You still need to set up the peripherals and initialize the C library environment, but you don't have to do it in assembler. Cortex-M3 also automatically saves volatile registers on interrupt handler entry so they can also be written straight in C.
That said, most compiler vendors still provide startup written in assembler since it offers the most control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With