Archive for the ‘Firmware’ Category

How to ARM Linux

During last few years I’ve never found a good excessive topic covering most of the areas to get Linux runnnig from scratch. I remember myself doing a lot of investigation about correct building of a [crosscompiler][crosscompiler], studying [bootloader][bootloader] internals, and so on… I’m definitely sure – if I had a person that could point me in right direction, then all the development should finish much earlier.

Consider this article as my personal note and feel free using it your own way.

Read the rest of this entry »

Set up AVR timer interrupt

/* initialize timer interrupt */
void init_isr_timers() {
  /* OC1A/OC1B disconnected */
  TCCR1A = 0;
  /* CTC mode, top in OCR1A / Timer clock = CLK/1024 */
  TCCR1B = (1<<WGM12)|(1<<CS12)|(1<<CS10);
  /* set OCR1A top value for 20Hz (10 periods in one second) */
  /*   0x0168 for CPU @ 7.3728MHz */
  OCR1A = 0x0168;
  /* enable Timer/Counter 1 interrupt */
  TIMSK = (1<<OCIE1A);
}

/* timer/counter 1 interrupt handler */
ISR(TIMER1_COMPA_vect) {
  /* Ohhh, lovely! :) */
}

int main() {
  /* initialize timer interrupt */
  init_isr_timers();
  /* enable interrupts */
  sei();
 
  /* main loop */
  for(;;) {}
}