freemyipod r163 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r162‎ | r163 | r164 >
Date:03:01, 19 August 2010
Author:theseven
Status:new
Tags:
Comment:
Add boot stub for installer-nano2g
Modified paths:
  • /apps/installer-nano2g/bootstub (added) (history)
  • /apps/installer-nano2g/bootstub/bootstub.S (added) (history)
  • /apps/installer-nano2g/bootstub/ls.x (added) (history)

Diff [purge]

Index: apps/installer-nano2g/bootstub/bootstub.S
@@ -0,0 +1,912 @@
 2+@
 3+@
 4+@ emBIOS Loader for iPod Nano 2G
 5+@
 6+@ Copyright 2010 TheSeven
 7+@
 8+@
 9+@ This file is part of emBIOS.
 10+@
 11+@ emBIOS is free software: you can redistribute it and/or
 12+@ modify it under the terms of the GNU General Public License as
 13+@ published by the Free Software Foundation, either version 2 of the
 14+@ License, or (at your option) any later version.
 15+@
 16+@ emBIOS is distributed in the hope that it will be useful,
 17+@ but WITHOUT ANY WARRANTY; without even the implied warranty of
 18+@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 19+@ See the GNU General Public License for more details.
 20+@
 21+@ You should have received a copy of the GNU General Public License along
 22+@ with emBIOS. If not, see <http://www.gnu.org/licenses/>.
 23+@
 24+@
 25+
 26+.global _start
 27+_start:
 28+
 29+ msr cpsr_c, #0xd3
 30+ mrc p15, 0, r0,c1,c0
 31+ bic r0, r0, #1
 32+ mcr p15, 0, r0,c1,c0
 33+ mov r0, #0
 34+ mcr p15, 0, r0,c7,c5
 35+ adr lr, cacheflush_done
 36+
 37+flushcache:
 38+ mov r0, #0
 39+flushcache_loop:
 40+ mcr p15, 0, r0,c7,c14,2
 41+ add r10, r0, #0x10
 42+ mcr p15, 0, r10,c7,c14,2
 43+ add r10, r10, #0x10
 44+ mcr p15, 0, r10,c7,c14,2
 45+ add r10, r10, #0x10
 46+ mcr p15, 0, r10,c7,c14,2
 47+ adds r0, r0, #0x04000000
 48+ bne flushcache_loop
 49+ mcr p15, 0, r0,c7,c10,4
 50+ mov pc, lr
 51+
 52+cacheflush_done:
 53+ adr r0, _start
 54+ adr r1, _stubend + 4
 55+ mov r2, #0x22000000
 56+copyloop:
 57+ cmp r1, r0
 58+ ldrhi r3, [r0], #4
 59+ strhi r3, [r2], #4
 60+ bhi copyloop
 61+ str r1, [r2]
 62+ mov r0, #0x22000000
 63+ add pc, r0, #sramstart - _start
 64+sramstart:
 65+
 66+ adr lr, values1
 67+ ldmia lr!, {r0-r13}
 68+ str r1, [r0,#0x88]
 69+ str r2, [r0,#0xf0]
 70+ str r4, [r3,#0x38]
 71+ mov r1, #0
 72+ str r7, [r0]
 73+ str r1, [r0,#0x04]
 74+ str r8, [r0,#0x10]
 75+ str r1, [r0,#0x14]
 76+ str r9, [r0,#0x20]
 77+ str r1, [r0,#0x24]
 78+ str r10, [r0,#0x30]
 79+ str r1, [r0,#0x34]
 80+ str r9, [r0,#0x40]
 81+ str r1, [r0,#0x44]
 82+ str r11, [r0,#0x50]
 83+ str r1, [r0,#0x54]
 84+ str r12, [r0,#0x60]
 85+ str r1, [r0,#0x64]
 86+ str r13, [r0,#0xa0]
 87+ str r1, [r0,#0xa4]
 88+ str r5, [r0,#0xb0]
 89+ mov r3, #1
 90+ str r3, [r0,#0xb4]
 91+ str r6, [r0,#0xc0]
 92+ ldmia lr, {r4-r14}
 93+ str r1, [r0,#0xc4]
 94+ str r6, [r0,#0xd0]
 95+ str r1, [r0,#0xd4]
 96+ str r6, [r0,#0xe0]
 97+ str r1, [r0,#0xe4]
 98+ str r7, [r0,#0xf0]
 99+ str r1, [r0,#0xf4]
 100+ ldr r3, [r8,#0x24]
 101+ orr r3, r3, #3
 102+ str r3, [r8,#0x24]
 103+ ldr r3, [r8,#0x28]
 104+ bic r3, r3, #0x4000
 105+ str r3, [r8,#0x28]
 106+ mov r3, #0x3C400000
 107+ str r1, [r3]
 108+ str r12, [r8,#0x0c]
 109+ ldr r3, [r8,#0x24]
 110+ orr r3, r3, #0x54
 111+ str r3, [r8,#0x24]
 112+ mov r3, #0x2000
 113+waitpll1:
 114+ subs r3, r3, #1
 115+ bne waitpll1
 116+ ldr r3, [r8]
 117+ bic r3, r3, r5
 118+ orr r3, r3, r4
 119+ str r3, [r8]
 120+ ldr r3, [r8,#0x24]
 121+ bic r3, r3, #1
 122+ str r3, [r8,#0x24]
 123+ mov r3, #0x84
 124+ str r3, [r0,#0x68]
 125+ str r13, [r8,#0x04]
 126+ mov r3, #0xa000
 127+waitpll2:
 128+ subs r3, r3, #1
 129+ bne waitpll2
 130+ ldr r3, [r8,#0x24]
 131+ orr r3, r3, #1
 132+ str r3, [r8,#0x24]
 133+ mov r3, #0x6000
 134+waitpll3:
 135+ subs r3, r3, #1
 136+ bne waitpll3
 137+ ldr r3, [r8]
 138+ bic r3, r3, r9
 139+ orr r3, r3, r10
 140+ str r3, [r8]
 141+ ldr r3, [r8,#0x3c]
 142+ bic r3, r3, #0x400
 143+ orr r3, r3, #0x280
 144+ str r3, [r8,#0x3c]
 145+ ldr r3, [r8,#0x10]
 146+ bic r3, r3, #0x1f8
 147+ orr r3, r3, #0x37
 148+ str r3, [r8,#0x10]
 149+ mrc p15, 0, r3,c1,c0
 150+ orr r3, r3, #0xc0000000
 151+ mcr p15, 0, r3,c1,c0
 152+ str r11, [r8,#0x28]
 153+ str r14, [r8,#0x40]
 154+ sub r6, r0, #0x00800000
 155+ mov r5, #0xf700
 156+ str r5, [r6,#0x88]
 157+ mov r5, #0x1100
 158+ orr r5, r5, #0x11
 159+ str r5, [r0,#0x88]
 160+ add r4, r6, #0x00200000
 161+ str r1, [r4,#0x08]
 162+ mov r5, #0xb7
 163+ str r5, [r4]
 164+ mov r5, #0x10
 165+ str r5, [r4,#0x04]
 166+ b setuppmu
 167+
 168+pmuinitdata:
 169+ .byte 3, 0x39, 0x18, 0, 0x8c
 170+ .byte 3, 0x13, 3, 0, 0
 171+ .byte 6, 0x16, 7, 0, 5, 2, 0x6b, 0
 172+ .byte 4, 0x1e, 0x12, 1, 0, 0x10
 173+ .byte 6, 0x22, 0x2f, 1, 0, 0x10, 9, 1
 174+ .byte 6, 0x31, 0x15, 1, 0x0f, 3, 0x15, 0
 175+ .byte 1, 0x43, 0
 176+ .byte 1, 0x4e, 0
 177+ .byte 1, 0x58, 0
 178+ .byte 5, 0x07, 0xb0, 0x0f, 0xfe, 0xfc, 0xff
 179+ .byte 5, 0x0d, 0xdf, 0xaa, 0x4a, 5, 0x27
 180+ .byte 0
 181+ .align 2
 182+
 183+val_006a49a5:
 184+ .word 0x006a49a5
 185+
 186+values1:
 187+ .word 0x3CF00000 @ R0
 188+ .word 0x00001111 @ R1
 189+ .word 0x00000221 @ R2
 190+ .word 0x38200000 @ R3
 191+val_00990999:
 192+ .word 0x00990999 @ R4
 193+ .word 0x41001111 @ R5
 194+ .word 0x11114444 @ R6
 195+ .word 0x11221111 @ R7
 196+ .word 0x11001744 @ R8
 197+ .word 0x33333333 @ R9
 198+ .word 0x11113333 @ R10
 199+ .word 0x77721151 @ R11
 200+ .word 0x12111111 @ R12
 201+ .word 0x11111000 @ R13
 202+ .word 0x60007000 @ R4
 203+ .word 0x7F007F00 @ R5
 204+ .word 0x44444444 @ R6
 205+ .word 0x22222221 @ R7
 206+ .word 0x3C500000 @ R8
 207+ .word 0xFF00FF00 @ R9
 208+ .word 0x20803180 @ R10
 209+ .word 0xFFDFF7CF @ R11
 210+ .word 0x00061800 @ R12
 211+ .word 0x00021200 @ R13
 212+ .word 0xFFFFEF7E @ R14
 213+
 214+setuppmu:
 215+ mov sp, pc
 216+ bl getpowerok
 217+ beq poweroff
 218+ adr r2, pmuinitdata
 219+pmuinitloop:
 220+ ldrb r3, [r2], #1
 221+ movs r3, r3
 222+ beq pmuinitdone
 223+ ldrb r1, [r2], #1
 224+ mov r0, #0xe6
 225+ bl i2csend
 226+ b pmuinitloop
 227+pmuinitdone:
 228+ orr r12, r12, #0x00600000
 229+ mov r1, #1
 230+ ldr r0, [r12,#0x100]
 231+ bic r0, r0, #0x0f
 232+ orr r0, r0, #1
 233+ str r0, [r12,#0x100]
 234+ str r1, [r12,#0x10c]
 235+ sub r11, r12, #0x04d00000
 236+ ldr r0, [r11,#0x80]
 237+ bic r0, r0, #0x20000
 238+ str r0, [r11,#0x80]
 239+ ldr r0, [r11]
 240+ bic r0, r0, #0xc00
 241+ orr r0, r0, #0x500
 242+ str r0, [r11]
 243+ mov r0, #3
 244+ str r0, [r11,#0x04]
 245+ mov r0, #1
 246+ bl sleepms
 247+ mov r0, #0x200
 248+ orr r0, r0, #0xed
 249+ str r0, [r11,#0x08]
 250+ ldr r0, val_006a49a5
 251+ str r0, [r11,#0x10]
 252+ mov r0, #0x37
 253+ str r0, [r11,#0x0c]
 254+ ldr r1, [r11,#0x04]
 255+ bic r1, r1, #0x700
 256+ orr r0, r1, #0x200
 257+ str r0, [r11,#0x04]
 258+ orr r0, r1, #0x300
 259+ str r0, [r11,#0x04]
 260+ str r0, [r11,#0x04]
 261+ orr r0, r1, #0x100
 262+ str r0, [r11,#0x04]
 263+ orr r0, r1, #0x500
 264+ str r0, [r11,#0x04]
 265+ ldr r0, [r11,#0x08]
 266+ orr r0, r0, #0x1000
 267+ str r0, [r11,#0x08]
 268+ ldr r0, val_00990999
 269+ str r0, [r11,#0x38]
 270+ ldr r0, [r12,#0xf0]
 271+ bic r0, r0, #0xff000000
 272+ bic r0, r0, #0x00ff0000
 273+ orr r0, r0, #0x22000000
 274+ orr r0, r0, #0x00220000
 275+ str r0, [r12,#0xf0]
 276+ mov r0, #0xf0
 277+ str r0, [r12,#0xfc]
 278+ sub r10, r12, #0x00d00000
 279+ ldr r0, [r10]
 280+ mov r0, r0,lsr#20
 281+ mov r0, r0,lsl#20
 282+ str r0, [r10]
 283+ mov r1, #0x3a000
 284+ orr r1, r1, #0x980
 285+ str r1, [r10,#0x08]
 286+ orr r0, r0, #0x300000
 287+ str r0, [r10]
 288+ bl initlcd
 289+ mov r0, #0x3f
 290+ mcr p15, 0, r0,c6,c0,1 @ CS0: 4GB at offset 0 - everything
 291+ mcr p15, 0, r0,c6,c0,0 @ DS0: 4GB at offset 0 - everything
 292+ mov r0, #0x31
 293+ mcr p15, 0, r0,c6,c1,1 @ CS1: SRAM/SDRAM mirror
 294+ mcr p15, 0, r0,c6,c1,0 @ DS1: SRAM/SDRAM mirror
 295+ add r0, r0, #0x08000000
 296+ mcr p15, 0, r0,c6,c2,1 @ CS2: SDRAM
 297+ mcr p15, 0, r0,c6,c2,0 @ DS2: SDRAM
 298+ mov r0, #0x23
 299+ add r0, r0, #0x22000000
 300+ mcr p15, 0, r0,c6,c3,1 @ CS3: SRAM
 301+ mcr p15, 0, r0,c6,c3,0 @ DS3: SRAM
 302+ mov r0, #0x27
 303+ add r0, r0, #0x24000000
 304+ mcr p15, 0, r0,c6,c4,1 @ CS4: NOR flash
 305+ mcr p15, 0, r0,c6,c4,0 @ DS4: NOR flash
 306+ mcr p15, 0, r1,c6,c5,1 @ CS5: unused
 307+ mcr p15, 0, r1,c6,c5,0 @ DS5: unused
 308+ mcr p15, 0, r1,c6,c6,1 @ CS6: unused
 309+ mcr p15, 0, r1,c6,c6,0 @ DS6: unused
 310+ mcr p15, 0, r1,c6,c7,1 @ CS7: unused
 311+ mcr p15, 0, r1,c6,c7,0 @ DS7: unused
 312+ mov r0, #0x1e
 313+ mcr p15, 0, r0,c2,c0, 1 @ CS1-4: cacheable
 314+ mcr p15, 0, r0,c2,c0, 0 @ DS1-4: cacheable
 315+ mcr p15, 0, r0,c3,c0, 0 @ DS1-4: write cacheable
 316+ mov r0, #0x300
 317+ add r0, r0, #0xff
 318+ mcr p15, 0, r0,c5,c0, 1 @ CS0-4: full access
 319+ mcr p15, 0, r0,c5,c0, 0 @ DS0-4: full access
 320+ mrc p15, 0, r0,c1,c0
 321+ orr r0, r0, #5
 322+ orr r0, r0, #0x1000
 323+ mcr p15, 0, r0,c1,c0 @ Re-enable the Protection Unit and caches
 324+ ldr r0, _stubend
 325+ ldr r1, _stubend + 4
 326+ add r1, r1, r0
 327+ mov r2, #0x08000000
 328+movepayloadloop:
 329+ cmp r1, r0
 330+ ldrhi r3, [r0], #4
 331+ strhi r3, [r2], #4
 332+ bhi movepayloadloop
 333+ mov pc, #0x08000000
 334+
 335+
 336+lcd_inittab_type2:
 337+ .byte 5, 10
 338+ .byte 3, 0xa4
 339+ .byte 4, 0x01
 340+ .byte 5, 150
 341+ .byte 3, 0x01
 342+ .byte 2, 0x01
 343+ .byte 2, 0x00
 344+ .byte 3, 0x02
 345+ .byte 2, 0x03
 346+ .byte 2, 0x00
 347+ .byte 3, 0x03
 348+ .byte 2, 0x12
 349+ .byte 2, 0x30
 350+ .byte 3, 0x08
 351+ .byte 2, 0x04
 352+ .byte 2, 0x04
 353+ .byte 3, 0x0e
 354+ .byte 4, 0x10
 355+ .byte 3, 0x70
 356+ .byte 2, 0x10
 357+ .byte 2, 0x00
 358+ .byte 3, 0x71
 359+ .byte 4, 0x01
 360+ .byte 3, 0x30
 361+ .byte 4, 0x02
 362+ .byte 3, 0x31
 363+ .byte 2, 0x04
 364+ .byte 2, 0x00
 365+ .byte 3, 0x32
 366+ .byte 4, 0x07
 367+ .byte 3, 0x33
 368+ .byte 2, 0x05
 369+ .byte 2, 0x00
 370+ .byte 3, 0x34
 371+ .byte 4, 0x07
 372+ .byte 3, 0x35
 373+ .byte 2, 0x07
 374+ .byte 2, 0x03
 375+ .byte 3, 0x36
 376+ .byte 2, 0x05
 377+ .byte 2, 0x07
 378+ .byte 3, 0x37
 379+ .byte 4, 0x05
 380+ .byte 3, 0x38
 381+ .byte 2, 0x14
 382+ .byte 2, 0x04
 383+ .byte 3, 0x39
 384+ .byte 4, 0x0e
 385+ .byte 3, 0x40
 386+ .byte 2, 0x02
 387+ .byte 2, 0x02
 388+ .byte 3, 0x41
 389+ .byte 4, 0x03
 390+ .byte 3, 0x42
 391+ .byte 4, 0x00
 392+ .byte 3, 0x43
 393+ .byte 2, 0x02
 394+ .byte 2, 0x00
 395+ .byte 3, 0x44
 396+ .byte 2, 0x07
 397+ .byte 2, 0x07
 398+ .byte 3, 0x45
 399+ .byte 2, 0x04
 400+ .byte 2, 0x07
 401+ .byte 3, 0x46
 402+ .byte 2, 0x05
 403+ .byte 2, 0x05
 404+ .byte 3, 0x47
 405+ .byte 4, 0x02
 406+ .byte 3, 0x48
 407+ .byte 4, 0x04
 408+ .byte 3, 0x49
 409+ .byte 4, 0x04
 410+ .byte 3, 0x60
 411+ .byte 2, 0x02
 412+ .byte 2, 0x02
 413+ .byte 3, 0x61
 414+ .byte 4, 0x03
 415+ .byte 3, 0x62
 416+ .byte 4, 0x00
 417+ .byte 3, 0x63
 418+ .byte 2, 0x02
 419+ .byte 2, 0x00
 420+ .byte 3, 0x64
 421+ .byte 2, 0x07
 422+ .byte 2, 0x07
 423+ .byte 3, 0x65
 424+ .byte 2, 0x04
 425+ .byte 2, 0x07
 426+ .byte 3, 0x66
 427+ .byte 2, 0x05
 428+ .byte 2, 0x05
 429+ .byte 3, 0x68
 430+ .byte 4, 0x04
 431+ .byte 3, 0x69
 432+ .byte 4, 0x04
 433+ .byte 3, 0x07
 434+ .byte 4, 0x01
 435+ .byte 3, 0x18
 436+ .byte 4, 0x01
 437+ .byte 3, 0x10
 438+ .byte 2, 0x16
 439+ .byte 2, 0x90
 440+ .byte 3, 0x11
 441+ .byte 2, 0x01
 442+ .byte 2, 0x00
 443+ .byte 3, 0x12
 444+ .byte 2, 0x01
 445+ .byte 2, 0x17
 446+ .byte 3, 0x13
 447+ .byte 2, 0x0f
 448+ .byte 2, 0x80
 449+ .byte 3, 0x12
 450+ .byte 2, 0x01
 451+ .byte 2, 0x37
 452+ .byte 3, 0x20
 453+ .byte 4, 0x00
 454+ .byte 3, 0x21
 455+ .byte 4, 0x00
 456+ .byte 3, 0x50
 457+ .byte 4, 0x00
 458+ .byte 3, 0x51
 459+ .byte 4, 0xaf
 460+ .byte 3, 0x52
 461+ .byte 4, 0x00
 462+ .byte 3, 0x53
 463+ .byte 4, 0x83
 464+ .byte 3, 0x90
 465+ .byte 4, 0x03
 466+ .byte 3, 0x91
 467+ .byte 4, 0x00
 468+ .byte 3, 0x92
 469+ .byte 2, 0x01
 470+ .byte 2, 0x01
 471+ .byte 3, 0x98
 472+ .byte 2, 0x04
 473+ .byte 2, 0x00
 474+ .byte 3, 0x99
 475+ .byte 2, 0x13
 476+ .byte 2, 0x02
 477+ .byte 3, 0x9a
 478+ .byte 2, 0x02
 479+ .byte 2, 0x02
 480+ .byte 3, 0x9b
 481+ .byte 2, 0x02
 482+ .byte 2, 0x00
 483+ .byte 5, 100
 484+ .byte 3, 0x07
 485+ .byte 4, 0x21
 486+ .byte 3, 0x12
 487+ .byte 2, 0x01
 488+ .byte 2, 0x37
 489+ .byte 5, 1
 490+ .byte 3, 0x07
 491+ .byte 4, 0x21
 492+ .byte 3, 0x12
 493+ .byte 2, 0x11
 494+ .byte 2, 0x37
 495+ .byte 5, 100
 496+ .byte 3, 0x07
 497+ .byte 2, 0x02
 498+ .byte 2, 0x33
 499+ .byte 0
 500+
 501+lcd_inittab_type3:
 502+ .byte 1, 0x01
 503+ .byte 5, 5
 504+ .byte 1, 0x11
 505+ .byte 5, 120
 506+ .byte 1, 0x3a
 507+ .byte 2, 0x65
 508+ .byte 1, 0xab
 509+ .byte 1, 0x35
 510+ .byte 2, 0x00
 511+ .byte 1, 0xf2
 512+ .byte 2, 0x01
 513+ .byte 1, 0xe0
 514+ .byte 2, 0x71
 515+ .byte 2, 0x76
 516+ .byte 2, 0x25
 517+ .byte 2, 0x01
 518+ .byte 2, 0xa5
 519+ .byte 2, 0x09
 520+ .byte 2, 0x15
 521+ .byte 2, 0x11
 522+ .byte 1, 0xe1
 523+ .byte 2, 0x40
 524+ .byte 2, 0x21
 525+ .byte 2, 0x64
 526+ .byte 2, 0x13
 527+ .byte 2, 0xf3
 528+ .byte 2, 0x0b
 529+ .byte 2, 0x00
 530+ .byte 2, 0x00
 531+ .byte 1, 0xe2
 532+ .byte 2, 0x71
 533+ .byte 2, 0x65
 534+ .byte 2, 0x24
 535+ .byte 2, 0x08
 536+ .byte 2, 0x97
 537+ .byte 2, 0x01
 538+ .byte 2, 0x15
 539+ .byte 2, 0x11
 540+ .byte 1, 0xe3
 541+ .byte 2, 0x51
 542+ .byte 2, 0x01
 543+ .byte 2, 0x62
 544+ .byte 2, 0x13
 545+ .byte 2, 0xf3
 546+ .byte 2, 0x0b
 547+ .byte 2, 0x00
 548+ .byte 2, 0x00
 549+ .byte 1, 0xe4
 550+ .byte 2, 0x71
 551+ .byte 2, 0x57
 552+ .byte 2, 0x31
 553+ .byte 2, 0x01
 554+ .byte 2, 0x82
 555+ .byte 2, 0x04
 556+ .byte 2, 0x1f
 557+ .byte 2, 0x11
 558+ .byte 1, 0xe5
 559+ .byte 2, 0x64
 560+ .byte 2, 0x41
 561+ .byte 2, 0x64
 562+ .byte 2, 0x19
 563+ .byte 2, 0xb3
 564+ .byte 2, 0x09
 565+ .byte 2, 0x00
 566+ .byte 2, 0x00
 567+ .byte 1, 0x29
 568+ .byte 0
 569+
 570+lcd_inittab_type7:
 571+ .byte 1, 0x01
 572+ .byte 5, 10
 573+ .byte 1, 0xb4
 574+ .byte 2, 0x00
 575+ .byte 1, 0xb6
 576+ .byte 2, 0x01
 577+ .byte 1, 0xb7
 578+ .byte 2, 0x00
 579+ .byte 2, 0x00
 580+ .byte 2, 0x02
 581+ .byte 2, 0x00
 582+ .byte 2, 0x06
 583+ .byte 2, 0x26
 584+ .byte 2, 0x2d
 585+ .byte 2, 0x27
 586+ .byte 2, 0x55
 587+ .byte 2, 0x27
 588+ .byte 1, 0xb8
 589+ .byte 2, 0x10
 590+ .byte 1, 0xb9
 591+ .byte 2, 0x52
 592+ .byte 2, 0x12
 593+ .byte 2, 0x03
 594+ .byte 1, 0xc0
 595+ .byte 2, 0x0a
 596+ .byte 2, 0x10
 597+ .byte 2, 0x10
 598+ .byte 1, 0xc2
 599+ .byte 2, 0x14
 600+ .byte 2, 0x23
 601+ .byte 1, 0xc3
 602+ .byte 2, 0x12
 603+ .byte 2, 0x23
 604+ .byte 1, 0xc6
 605+ .byte 2, 0x48
 606+ .byte 1, 0xe0
 607+ .byte 2, 0x20
 608+ .byte 2, 0x71
 609+ .byte 2, 0x17
 610+ .byte 2, 0x09
 611+ .byte 2, 0x70
 612+ .byte 2, 0x0c
 613+ .byte 2, 0x13
 614+ .byte 2, 0x25
 615+ .byte 1, 0xe1
 616+ .byte 2, 0x37
 617+ .byte 2, 0x00
 618+ .byte 2, 0x63
 619+ .byte 2, 0x11
 620+ .byte 2, 0xd9
 621+ .byte 2, 0x00
 622+ .byte 2, 0x12
 623+ .byte 2, 0x01
 624+ .byte 1, 0xe2
 625+ .byte 2, 0x42
 626+ .byte 2, 0x42
 627+ .byte 2, 0x60
 628+ .byte 2, 0x08
 629+ .byte 2, 0xb4
 630+ .byte 2, 0x07
 631+ .byte 2, 0x0e
 632+ .byte 2, 0x90
 633+ .byte 1, 0xe3
 634+ .byte 2, 0x47
 635+ .byte 2, 0x60
 636+ .byte 2, 0x66
 637+ .byte 2, 0x09
 638+ .byte 2, 0x6a
 639+ .byte 2, 0x02
 640+ .byte 2, 0x0e
 641+ .byte 2, 0x09
 642+ .byte 1, 0xe4
 643+ .byte 2, 0x11
 644+ .byte 2, 0x40
 645+ .byte 2, 0x03
 646+ .byte 2, 0x0a
 647+ .byte 2, 0xc1
 648+ .byte 2, 0x0d
 649+ .byte 2, 0x17
 650+ .byte 2, 0x30
 651+ .byte 1, 0xe5
 652+ .byte 2, 0x00
 653+ .byte 2, 0x30
 654+ .byte 2, 0x77
 655+ .byte 2, 0x1c
 656+ .byte 2, 0xfb
 657+ .byte 2, 0x00
 658+ .byte 2, 0x13
 659+ .byte 2, 0x07
 660+ .byte 1, 0xe6
 661+ .byte 2, 0x01
 662+ .byte 1, 0x35
 663+ .byte 2, 0x00
 664+ .byte 1, 0x36
 665+ .byte 2, 0x00
 666+ .byte 1, 0xf2
 667+ .byte 2, 0x40
 668+ .byte 1, 0xf3
 669+ .byte 2, 0x50
 670+ .byte 1, 0xfb
 671+ .byte 2, 0x01
 672+ .byte 1, 0x11
 673+ .byte 5, 200
 674+ .byte 1, 0xb1
 675+ .byte 2, 0x16
 676+ .byte 2, 0x03
 677+ .byte 1, 0xb2
 678+ .byte 2, 0x17
 679+ .byte 2, 0x03
 680+ .byte 1, 0x3a
 681+ .byte 2, 0x65
 682+ .byte 1, 0x29
 683+ .byte 0
 684+
 685+.align 2
 686+
 687+lcd_initmapping:
 688+ .word lcd_inittab_type3 - lcd_initmapping_ref
 689+ .word lcd_inittab_type7 - lcd_initmapping_ref
 690+ .word lcd_inittab_type2 - lcd_initmapping_ref
 691+ .word lcd_inittab_type3 - lcd_initmapping_ref
 692+
 693+initlcd:
 694+ stmfd sp!, {r4,r5,lr}
 695+ bl detectlcd
 696+ sub r12, r12, #0x04900000
 697+ adr r5, lcd_initmapping
 698+ add r5, r5, r0,lsl#2
 699+ ldr r5, [r5]
 700+ add r5, r5, pc
 701+ mov r0, #0xc00
 702+lcd_initmapping_ref:
 703+ orr r0, r0, #1
 704+ str r0, [r12]
 705+ mov r0, #0x7f00
 706+ orr r0, r0, #0xff
 707+ str r0, [r12,#0x24]
 708+ mov r0, #0
 709+ str r0, [r12,#0x28]
 710+ mov r0, #1
 711+ bl sleepms
 712+ mov r0, #1
 713+ str r0, [r12,#0x28]
 714+ mov r0, #5
 715+ bl sleepms
 716+initlcd_loop:
 717+ adr lr, initlcd_loop
 718+ ldrb r1, [r5], #1
 719+ ldrb r0, [r5], #1
 720+ add pc, pc, r1,lsl#2
 721+ nop
 722+ ldmfd sp!, {r4,r5,pc}
 723+ b sendlcdc
 724+ b sendlcdd
 725+ b sendlcd2c
 726+ b sendlcd2d
 727+ b sleepms
 728+
 729+sendlcd2c:
 730+ ldr r4, [r12,#0x1c]
 731+ ands r4, r4, #0x10
 732+ bne sendlcd2c
 733+ mov r4, r0,lsr#8
 734+ str r4, [r12,#0x04]
 735+ and r0, r0, #0xff
 736+sendlcdc:
 737+ ldr r4, [r12,#0x1c]
 738+ ands r4, r4, #0x10
 739+ bne sendlcdc
 740+ str r0, [r12,#0x04]
 741+ mov pc, lr
 742+sendlcd2d:
 743+ ldr r4, [r12,#0x1c]
 744+ ands r4, r4, #0x10
 745+ bne sendlcd2d
 746+ mov r4, r0,lsr#8
 747+ str r4, [r12,#0x40]
 748+ and r0, r0, #0xff
 749+sendlcdd:
 750+ ldr r4, [r12,#0x1c]
 751+ ands r4, r4, #0x10
 752+ bne sendlcdd
 753+ str r0, [r12,#0x40]
 754+ mov pc, lr
 755+
 756+detectlcd:
 757+ mov r12, #0x3c000000
 758+ orr r12, r12, #0xf00000
 759+ ldr r0, [r12,#0xd0]
 760+ bic r0, r0, #0x0f
 761+ str r0, [r12,#0xd0]
 762+ ldr r0, [r12,#0xe0]
 763+ bic r0, r0, #0xf0
 764+ str r0, [r12,#0xe0]
 765+ ldr r0, [r12,#0xd4]
 766+ and r0, r0, #1
 767+ ldr r1, [r12,#0xe4]
 768+ and r1, r1, #2
 769+ orr r0, r0, r1
 770+ mov pc, lr
 771+
 772+getpowerok:
 773+ stmfd sp!, {lr}
 774+ mov r0, #0xe6
 775+ mov r1, #0x19
 776+ bl i2crecvbyte
 777+ eor r0, r0, #1
 778+ ands r0, r0, #1
 779+ ldmnefd sp!, {pc}
 780+ mov r0, #0xe6
 781+ mov r1, #0x4b
 782+ bl i2crecvbyte
 783+ ands r0, r0, #4
 784+ movne r0, #1
 785+ ldmnefd sp!, {pc}
 786+ mov r0, #0xe6
 787+ mov r1, #0x12
 788+ bl i2crecvbyte
 789+ ands r0, r0, #4
 790+ movne r0, #1
 791+ ldmfd sp!, {pc}
 792+
 793+poweroff:
 794+ mov r0, #0xe6
 795+ mov r1, #0x0c
 796+ mov r2, #0x01
 797+ bl i2csendbyte
 798+ b poweroff
 799+
 800+i2csendbyte:
 801+ mov r3, #0
 802+@fallthrough
 803+
 804+i2csend:
 805+ stmfd sp!, {r4,lr}
 806+ mov r12, #0x3C000000
 807+ add r12, r12, #0x00900000
 808+ mov r4, #0
 809+ str r4, [r12,#0x08]
 810+ str r0, [r12,#0x0c]
 811+ mov r4, #0xf0
 812+ str r4, [r12,#0x04]
 813+ mov r4, #0xf3
 814+ str r4, [r12]
 815+ bl i2cwait
 816+ str r1, [r12,#0x0c]
 817+ str r4, [r12]
 818+ bl i2cwait
 819+ movs r3, r3
 820+ moveq r0, r2
 821+i2csend_write:
 822+ ldrne r0, [r2], #1
 823+ str r0, [r12,#0x0c]
 824+ str r4, [r12]
 825+ bl i2cwait
 826+ subs r3, r3, #1
 827+ bhi i2csend_write
 828+ mov r0, #0xd0
 829+ str r0, [r12,#0x04]
 830+ str r4, [r12]
 831+i2csend_wait:
 832+ ldr r0, [r12,#0x04]
 833+ tst r0, #0x20
 834+ bne i2csend_wait
 835+ ldmfd sp!, {r4,pc}
 836+
 837+i2crecvbyte:
 838+ mov r2, #0
 839+ mov r3, #1
 840+@fallthrough
 841+
 842+i2crecv:
 843+ stmfd sp!, {r0,r4,lr}
 844+ mov r12, #0x3C000000
 845+ add r12, r12, #0x00900000
 846+ mov r4, #0
 847+ str r4, [r12,#0x08]
 848+ str r0, [r12,#0x0c]
 849+ mov r4, #0xf0
 850+ str r4, [r12,#0x04]
 851+ mov r4, #0xf3
 852+ str r4, [r12]
 853+ bl i2cwait
 854+ str r1, [r12,#0x0c]
 855+ str r4, [r12]
 856+ bl i2cwait
 857+ ldr r0, [sp]
 858+ orr r0, r0, #1
 859+ str r1, [r12,#0x0c]
 860+ mov r0, #0xb0
 861+ str r0, [r12,#0x04]
 862+ str r4, [r12]
 863+ bl i2cwait
 864+i2crecv_read:
 865+ subs r3, r3, #1
 866+ moveq r4, #0x73
 867+ str r4, [r12]
 868+ bl i2cwait
 869+ ldr r0, [r12,#0x0c]
 870+ movs r2, r2
 871+ strne r0, [r2], #1
 872+ movs r3, r3
 873+ bne i2crecv_read
 874+ mov r1, #0x90
 875+ str r1, [r12,#0x04]
 876+ mov r1, #0xf3
 877+ str r1, [r12]
 878+i2crecv_wait:
 879+ ldr r1, [r12,#0x04]
 880+ tst r1, #0x20
 881+ bne i2crecv_wait
 882+ ldmfd sp!, {r0,r4,pc}
 883+
 884+i2cwait:
 885+ ldr r0, [r12]
 886+ tst r0, #0x10
 887+ beq i2cwait
 888+ mov pc, lr
 889+
 890+
 891+sleep10ms:
 892+ mov r0, #10
 893+@ fallthrough
 894+
 895+sleepms:
 896+ mov r2, #0xc8
 897+ mul r1, r0, r2
 898+ mov r2, #0x3c000000
 899+ orr r2, r2, #0x700000
 900+ ldr r0, [r2,#0x80]
 901+ ldr r0, [r2,#0x84]
 902+ add r1, r1, r0
 903+sleepmsloop:
 904+ ldr r0, [r2,#0x80]
 905+ ldr r0, [r2,#0x84]
 906+ cmp r0, r1
 907+ bmi sleepmsloop
 908+ mov pc, lr
 909+
 910+ nop
 911+ nop
 912+
 913+_stubend:
\ No newline at end of file
Index: apps/installer-nano2g/bootstub/ls.x
@@ -0,0 +1,15 @@
 2+OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
 3+ "elf32-littlearm")
 4+OUTPUT_ARCH(arm)
 5+ENTRY(_start)
 6+
 7+SECTIONS
 8+{
 9+ . = 0x22000000;
 10+
 11+ .text :
 12+ {
 13+ *(.text)
 14+ }
 15+
 16+}