# .c to .hex file conversion without using any IDE

I am new to microcontroller programming. I have a program written in C or assembly language which I need to convert into a .HEX file to flash into the 8051 microcontroller. I do not want to use an IDE (Keil for example) and want to perform this conversion only using terminal commands incorporating some kind of compiler or executing any other program through terminal. I have read some other answers that address similar issues but they make use of IDE. Please help me with this issue and let me know if there is anything else I should know.

• Try a web search for a toolchain for your processor, eg maybe sdcc? Beware you will probably have to change the source a little and support files a lot when changing toolchains. Oct 13, 2020 at 5:39
• first question: do you already know how this works with your IDE? If you do, find out what your IDE does "under the hood" (namely, it does what you want to do). If not, learn it. Oct 13, 2020 at 5:40
• For which compiler do you have a license? Oct 13, 2020 at 5:50
• instructables.com/…
– Codo
Oct 13, 2020 at 6:13
• Yes, free assemblers and C compilers exist for 8051 architectures. Yes, they can be executed from command line, that is how IDEs execute the compilers too. Oct 13, 2020 at 8:03

Source code in C for 8051 is always compiler specific. One reason is the crazy addressing space (data, idata, pdata, xdata, and no, I am not making this up).
If you needed a command line tool for whatever reason (automation comes to mind) either call the IDE (most of them can compile projects via command line) or write a Makefile to be used with make command line tool.