How is burned firmware code executed by a microprocessor?

Discussion in 'General Electronics Chat' started by SummerPassword, Aug 12, 2014.

  1. SummerPassword

    Thread Starter New Member

    Aug 12, 2014
    Let's use simple Intel and "generic PC" memory-mapping/engineered boards to get the gist of this.
    BIOS/firmware is hardwired to a certain address; an address from which is immediately fetched/executed by the CPU on startup. This is the tricky part:

    Is the first instruction hardwired to the CPU by memory and first executed, enabling a furthering chain of code/data execution from the first instruction itself? Or does the first instruction do something else different entirely?

    Basically, when you turn the computer on and everything is fine, the first instruction for the microprocessor is mapped and "hardwired" to the CPU? Can anyone please:

    1.Elaborate on what "hardwired" means in this context.

    2.Explain how the process of "hardwiring" enables a finite amount of binary/electronic code burned on a semiconductor 8 inches away from the CPU gets executed the second it is turned on, and how the rest of the code gets executed after and in what order, setup, etc.?

    3.How does BIOS code put its burned data from the semiconductor into RAM addresses joined by the opcodes for the CPU, and how does BIOS "intervene" and get between other processes that may be executing in parallel (examples: software interrupts, setting BARs, accessing hardware and the like etc.)?

    Because look at it this way: the format/configuration of electrical voltages that make up that first instruction are local to the BIOS/firmware semiconductor. How is this arranged to work with the CPU consecutively?
    Last edited: Aug 12, 2014
  2. MaxHeadRoom


    Jul 18, 2013
    Not sure if this is the correct answer for you, in a microprocessor, there is a A CPU together with a program counter, tied to the system clock, the P.counter starts by fetching the first data or instruction loaded into the firmware or programmed memory and based on the instruction set of the μp, certain action is taken, and the P.counter steps to the next location in memory and retrieves the instruction or data recorded there and acts on it, the process continues to the end of the programmed memory.
    Maybe an over simplification but its essentially this process.
  3. kubeek

    AAC Fanatic!

    Sep 20, 2005
    For example AVRs first execute an instruction from memory location 0 - program counter is simply reset to 0. This instruction usually is a jump to the start of the actual program.

    Some architectures might have different addressing structures, so it could be got example address 0x200000 which I believe is the start of flash in stm32f1xx ARMs. But again it could be some different address because of bootloader, or flash being divided into segments with different "privileges".
  4. MrChips


    Oct 2, 2009
    Some microcontrollers begin executing instructions at a fixed memory location.
    Others use a RESET VECTOR in the INTERRUPT VECTOR TABLE where the last entry in the table is the address that is to be loaded into the PROGRAM COUNTER.

    The microprocessor is wired to the memory address and data buses. Data is fetched from the code memory to the processor for execution. The speed of the data fetch operation is limited to the access rate of the memory, which can be in nano-seconds.