root/loader/sx280hs/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     // light up green LED
  17     *(int*)0xd20b0994 = 0x4d0002;
  18     // LED done
  19 
  20     asm volatile ( // fc095c80 102b/102c
  21 /*    "movs    r0, #0x78\n"
  22     "mcr     p15, 0, r0, c1, c0\n"
  23     "movs    r0, #0\n"
  24     "mcr     p15, 0, r0, c7, c10, 4\n"
  25     "mcr     p15, 0, r0, c7, c5\n"
  26     "mcr     p15, 0, r0, c7, c6\n"
  27     "movw    r0, #0x4006\n"
  28     "mcr     p15, 0, r0, c9, c1\n"
  29     "mcr     p15, 0, r0, c9, c1, 1\n"
  30     "mrc     p15, 0, r0, c1, c0\n"
  31     "orr.w   r0, r0, #0x50000\n"
  32     "mcr     p15, 0, r0, c1, c0\n"
  33     "movw    r1, #0x4ffc\n"
  34     "ldr     r0, =0x12345678\n"
  35     "str     r0, [r1, #0]\n"
  36     //"ldr     r0, =0xfc020000\n"*/
  37     "mov     r1, %1\n"
  38     "mov     r0, %0\n"
  39     "ldr     r2, =0xfc12dd3b\n" // address is OK for 102b and 102c
  40     "blx     r2\n"              // caching related routine called at fw startup
  41     "mov     r0, %0\n"
  42     "add     r0, r0, #1\n"
  43     "bx      r0\n"
  44     : : "r"(MEMISOSTART), "r"(((blob_chdk_core_size+3)>>2)<<2) : "memory","r0","r1","r2","r3","r4"
  45     );
  46     while(1);
  47 }
  48 

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