I am new to this Arduino community I noticed on youtube that while the prototype is complete people purchase new ATmega328p chips and flash bootloaders into them using in-system-programmers so that the chip could actually understand and interpret the instructions that are written in the high-level language if I am right(No I was wrong, it's actually the compiler that sits on Arduino). so I thought what if we could burn the atmega328p bootloader into any other microcontroller. So that we could program it in Arduino programming language(C/C++). Is this possible? sorry if I am dumb, but I wanted to know. And can anyone tell me whether could we use ATmega328p for production purposes(consumer electronics)? Thanks in advance.
The answer needs to have multiple parts:
Yes, in principle you can create a bootloader for any microcontroller, which acts like the Arduino's.
Please be aware that there are different bootloaders, not just the common STK500 compatible one. Each of these bootloaders implements a certain protocol to transfer the binary code to the target system.
Additionally, some protocols also include commands to restart the microcontroller, to set configuration registers, and maybe more.
You need to read the bootloader's documentation to become familiar with its capabilities.
But it is your decision whether such a bootloader on a non-AVR system or an non-Arduino-AVR system is good for you.
No, the bootloader does not enable the microcontroller to "understand" the high-level language.
The standard Arduino IDE uses the specific compiler for the target microcontroller to translate the C++ source code to machine language. The resulting binary commonly runs on this target microcontroller only.
The bootloader just implements the protocol. In general, it is completely unaware of the meaning of the transferred data.
Microcontrollers in general use different processors with possibly different machine languages, contain different kinds of memory of different sizes, include different sets of different peripherals. But you know this for sure. You need to write and compile your source code for the specific part you're targeting.
Yes, you can use ATmega328P for a consumer product, as Michel already said.
You need to take the common measures that you take with any part of your product, though.
You cannot just load a sketch into any microcontroller, because every microcontroller has different memory layout, peripherals, ways of uploading, FLASH size etc.
You can use the atMega (or any microcontroller) for production purposes though. Of course each MCU type has operation conditions (like min/max temperature), so in e.g. automotive or military environments not all MCUs are allowed to be used, but for consumer electronics, afaik all MCUs can be used (meaning they will pass by themselves the needed certifications, which may not be true for components added and the circuit/enclosure resulting out of it).