TSEC: Difference between revisions

Motezazer (talk | contribs)
The bootloader does not use the RTC but the timer
Line 228: Line 228:
   
   
  u32 boot_res = 0;
  u32 boot_res = 0;
  u32 time = 0;
 
// The bootloader allows the TSEC two seconds from this point to do its job
  u32 maximum_time = read_timer() + 2000000;  
   
   
  while (!boot_res)
  while (!boot_res)
Line 235: Line 237:
     boot_res = *(u32 *)FALCON_SCRATCH1;
     boot_res = *(u32 *)FALCON_SCRATCH1;
      
      
     // Read from RTC_MILLISECONDS
     // Read from TIMERUS_CNTR_1US (microseconds from boot)
     time = rtc_read();
     u32 current_time = read_timer();
      
      
     // Booting is taking too long
     // Booting is taking too long
     if (time > 2000000)
     if (current_time > maximum_time)
       panic();
       panic();
  }
  }