Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

Zinc initialisation process

Ben Harris edited this page May 29, 2015 · 1 revision

Zinc initialisation process

This document explains the steps involved in initialising the device before passing control to the user entry point.

Before boot

The Zinc build system will create an entry method (using PT or zinc_main), and will set the address of this method as the RESET vector address. The build system also sets the initial stack pointer address.

The Zinc build process will also create an interrupt handler method and set the address of this as the HARD_FAULT vector address and all other defined vector addresses.

At power on, or on reset

  1. The device enters reset state, sets the PC to the address of the zinc entry method, sets the SP to the initial stack address, and calls the zinc entry method.
  2. The zinc entry method initialises the DATA region of memory and initialises the stack safety values.
  3. The zinc entry method initialises the peripherals required by user entry point.
  4. The zinc entry method initialises and switches to the second stack (platform dependent, main stack is reserved for fault handler).
  5. The zinc entry method passes control to the user entry point.

On interrupt

  1. The zinc interrupt handler retrieves the exception information.
  2. If it is an interrupt, triggers the event (either calls handler using second stack, or in a 'reactive' system appends the event to the event buffer and retuns)
  3. If it is a recoverable fault, call the end user recovery function.
  4. If it is an unrecoverable fault, reset in production mode, halt on debug mode.