root/loader/sx710hs/main.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. my_restart

   1 #include "../generic/check_compat.c"
   2 
   3 extern long *blob_chdk_core;
   4 extern long blob_chdk_core_size;
   5 
   6 void __attribute__((noreturn)) my_restart()
   7 {
   8     check_compat();
   9 
  10     long *dst = (long*)MEMISOSTART;
  11     const long *src = blob_chdk_core;
  12     long length = (blob_chdk_core_size + 3) >> 2;
  13 
  14     core_copy(src, dst, length);
  15 
  16     /*
  17     // light up green LED
  18     *(volatile int*)0xd20b0994 = 0x4d0002;
  19     // blinker
  20     while(1) {
  21         int i;
  22         *(volatile int*)0xd20b0994 = 0x4d0002;
  23         for(i=0;i<1000000;i++) {
  24             asm volatile(
  25             "nop\n"
  26             );
  27         }
  28         *(volatile int*)0xd20b0994 = 0x4c0003;
  29         for(i=0;i<1000000;i++) {
  30             asm volatile(
  31             "nop\n"
  32             );
  33         }
  34     }
  35     */
  36 
  37     // on G7X allows boot on short press without fiddling variables in startup code
  38     // does not appear to have any effect on sx710
  39 //    *(volatile unsigned *)(0x4ffc)=0x12345678;
  40     asm volatile ( 
  41     "mov     r1, %1\n"
  42     "mov     r0, %0\n"
  43     "ldr     r2, =0xfc11f607\n" // function called in startup after ROM->RAM code copy, sx710 100a and 101a
  44     "blx     r2\n"
  45 
  46     // start execution at MEMISOSTART in thumb mode
  47     "mov     r0, %0\n"
  48     "add     r0, r0, #1\n"
  49     "bx      r0\n"
  50     : : "r"(MEMISOSTART), "r"(((blob_chdk_core_size+3)>>2)<<2) : "memory","r0","r1","r2","r3","r4"
  51     );
  52     while(1);
  53 }
  54 

/* [<][>][^][v][top][bottom][index][help] */