freemyipod r159 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r158‎ | r159 | r160 >
Date:16:45, 18 August 2010
Author:theseven
Status:new
Tags:
Comment:
Added emBIOS loader for iPod Nano 2G to SVN
Modified paths:
  • /embios/trunk/loader (added) (history)
  • /embios/trunk/loader/ipodnano2g (added) (history)
  • /embios/trunk/loader/ipodnano2g/Makefile (added) (history)
  • /embios/trunk/loader/ipodnano2g/SOURCES (added) (history)
  • /embios/trunk/loader/ipodnano2g/ls.x (added) (history)
  • /embios/trunk/loader/ipodnano2g/main.S (added) (history)
  • /embios/trunk/loader/ipodnano2g/version.h (added) (history)

Diff [purge]

Index: embios/trunk/loader/ipodnano2g/SOURCES
@@ -0,0 +1 @@
 2+main.c
Index: embios/trunk/loader/ipodnano2g/ls.x
@@ -0,0 +1,21 @@
 2+OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
 3+ "elf32-littlearm")
 4+OUTPUT_ARCH(arm)
 5+ENTRY(_start)
 6+
 7+SECTIONS
 8+{
 9+ . = 0x22000800;
 10+
 11+ .text : { *(.text) }
 12+
 13+ __data_start__ = . ;
 14+ .data : { *(.data) *(.rodata) }
 15+
 16+ __bss_start__ = .;
 17+ .bss : {
 18+ *(.bss) *(COMMON);
 19+ __bss_end__ = . ;
 20+ }
 21+
 22+}
\ No newline at end of file
Index: embios/trunk/loader/ipodnano2g/main.S
@@ -0,0 +1,1646 @@
 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+
 27+#include "build/version.h"
 28+
 29+
 30+.global _start
 31+_start:
 32+
 33+ msr cpsr_c, #0xd3
 34+ mrc p15, 0, r0,c1,c0
 35+ bic r0, r0, #1
 36+ mcr p15, 0, r0,c1,c0
 37+ mov r0, #0
 38+ mcr p15, 0, r0,c7,c5
 39+ adr lr, cacheflush_done
 40+
 41+flushcache:
 42+ mov r0, #0
 43+flushcache_loop:
 44+ mcr p15, 0, r0,c7,c14,2
 45+ add r10, r0, #0x10
 46+ mcr p15, 0, r10,c7,c14,2
 47+ add r10, r10, #0x10
 48+ mcr p15, 0, r10,c7,c14,2
 49+ add r10, r10, #0x10
 50+ mcr p15, 0, r10,c7,c14,2
 51+ adds r0, r0, #0x04000000
 52+ bne flushcache_loop
 53+ mcr p15, 0, r0,c7,c10,4
 54+ mov pc, lr
 55+
 56+cacheflush_done:
 57+ adr lr, values1
 58+ ldmia lr!, {r0-r13}
 59+ str r1, [r0,#0x88]
 60+ str r2, [r0,#0xf0]
 61+ str r4, [r3,#0x38]
 62+ mov r1, #0
 63+ str r7, [r0]
 64+ str r1, [r0,#0x04]
 65+ str r8, [r0,#0x10]
 66+ str r1, [r0,#0x14]
 67+ str r9, [r0,#0x20]
 68+ str r1, [r0,#0x24]
 69+ str r10, [r0,#0x30]
 70+ str r1, [r0,#0x34]
 71+ str r9, [r0,#0x40]
 72+ str r1, [r0,#0x44]
 73+ str r11, [r0,#0x50]
 74+ str r1, [r0,#0x54]
 75+ str r12, [r0,#0x60]
 76+ str r1, [r0,#0x64]
 77+ str r13, [r0,#0xa0]
 78+ str r1, [r0,#0xa4]
 79+ str r5, [r0,#0xb0]
 80+ mov r3, #1
 81+ str r3, [r0,#0xb4]
 82+ str r6, [r0,#0xc0]
 83+ ldmia lr, {r4-r14}
 84+ str r1, [r0,#0xc4]
 85+ str r6, [r0,#0xd0]
 86+ str r1, [r0,#0xd4]
 87+ str r6, [r0,#0xe0]
 88+ str r1, [r0,#0xe4]
 89+ str r7, [r0,#0xf0]
 90+ str r1, [r0,#0xf4]
 91+ ldr r3, [r8,#0x24]
 92+ orr r3, r3, #3
 93+ str r3, [r8,#0x24]
 94+ ldr r3, [r8,#0x28]
 95+ bic r3, r3, #0x4000
 96+ str r3, [r8,#0x28]
 97+ mov r3, #0x3C400000
 98+ str r1, [r3]
 99+ str r12, [r8,#0x0c]
 100+ ldr r3, [r8,#0x24]
 101+ orr r3, r3, #0x54
 102+ str r3, [r8,#0x24]
 103+ mov r3, #0x2000
 104+waitpll1:
 105+ subs r3, r3, #1
 106+ bne waitpll1
 107+ ldr r3, [r8]
 108+ bic r3, r3, r5
 109+ orr r3, r3, r4
 110+ str r3, [r8]
 111+ ldr r3, [r8,#0x24]
 112+ bic r3, r3, #1
 113+ str r3, [r8,#0x24]
 114+ mov r3, #0x84
 115+ str r3, [r0,#0x68]
 116+ str r13, [r8,#0x04]
 117+ mov r3, #0xa000
 118+waitpll2:
 119+ subs r3, r3, #1
 120+ bne waitpll2
 121+ ldr r3, [r8,#0x24]
 122+ orr r3, r3, #1
 123+ str r3, [r8,#0x24]
 124+ mov r3, #0x6000
 125+waitpll3:
 126+ subs r3, r3, #1
 127+ bne waitpll3
 128+ ldr r3, [r8]
 129+ bic r3, r3, r9
 130+ orr r3, r3, r10
 131+ str r3, [r8]
 132+ ldr r3, [r8,#0x3c]
 133+ bic r3, r3, #0x400
 134+ orr r3, r3, #0x280
 135+ str r3, [r8,#0x3c]
 136+ ldr r3, [r8,#0x10]
 137+ bic r3, r3, #0x1f8
 138+ orr r3, r3, #0x37
 139+ str r3, [r8,#0x10]
 140+ mrc p15, 0, r3,c1,c0
 141+ orr r3, r3, #0xc0000000
 142+ mcr p15, 0, r3,c1,c0
 143+ str r11, [r8,#0x28]
 144+ str r14, [r8,#0x40]
 145+ sub r6, r0, #0x00800000
 146+ mov r5, #0xf700
 147+ str r5, [r6,#0x88]
 148+ mov r5, #0x1100
 149+ orr r5, r5, #0x11
 150+ str r5, [r0,#0x88]
 151+ add r4, r6, #0x00200000
 152+ str r1, [r4,#0x08]
 153+ mov r5, #0xb7
 154+ str r5, [r4]
 155+ mov r5, #0x10
 156+ str r5, [r4,#0x04]
 157+ b setuppmu
 158+
 159+pmuinitdata:
 160+ .byte 3, 0x39, 0x18, 0, 0x8c
 161+ .byte 3, 0x13, 3, 0, 0
 162+ .byte 6, 0x16, 7, 0, 5, 2, 0x6b, 0
 163+ .byte 4, 0x1e, 0x12, 1, 0, 0x10
 164+ .byte 6, 0x22, 0x2f, 1, 0, 0x10, 9, 1
 165+ .byte 6, 0x31, 0x15, 1, 0x0f, 3, 0x15, 0
 166+ .byte 1, 0x43, 0
 167+ .byte 1, 0x4e, 0
 168+ .byte 1, 0x58, 0
 169+ .byte 5, 0x07, 0xb0, 0x0f, 0xfe, 0xfc, 0xff
 170+ .byte 5, 0x0d, 0xdf, 0xaa, 0x4a, 5, 0x27
 171+ .byte 0
 172+ .align 2
 173+
 174+val_006a49a5:
 175+ .word 0x006a49a5
 176+
 177+values1:
 178+ .word 0x3CF00000 @ R0
 179+ .word 0x00001111 @ R1
 180+ .word 0x00000221 @ R2
 181+ .word 0x38200000 @ R3
 182+val_00990999:
 183+ .word 0x00990999 @ R4
 184+ .word 0x41001111 @ R5
 185+ .word 0x11114444 @ R6
 186+ .word 0x11221111 @ R7
 187+ .word 0x11001744 @ R8
 188+ .word 0x33333333 @ R9
 189+ .word 0x11113333 @ R10
 190+ .word 0x77721151 @ R11
 191+ .word 0x12111111 @ R12
 192+ .word 0x11111000 @ R13
 193+ .word 0x60007000 @ R4
 194+ .word 0x7F007F00 @ R5
 195+ .word 0x44444444 @ R6
 196+ .word 0x22222221 @ R7
 197+ .word 0x3C500000 @ R8
 198+ .word 0xFF00FF00 @ R9
 199+ .word 0x20803180 @ R10
 200+ .word 0xFFDFF7CF @ R11
 201+ .word 0x00061800 @ R12
 202+ .word 0x00021200 @ R13
 203+ .word 0xFFFFEF7E @ R14
 204+
 205+setuppmu:
 206+ mov sp, pc
 207+ bl getpowerok
 208+ beq poweroff
 209+ adr r2, pmuinitdata
 210+pmuinitloop:
 211+ ldrb r3, [r2], #1
 212+ movs r3, r3
 213+ beq pmuinitdone
 214+ ldrb r1, [r2], #1
 215+ mov r0, #0xe6
 216+ bl i2csend
 217+ b pmuinitloop
 218+pmuinitdone:
 219+ orr r12, r12, #0x00600000
 220+ mov r1, #1
 221+ ldr r0, [r12,#0x100]
 222+ bic r0, r0, #0x0f
 223+ orr r0, r0, #1
 224+ str r0, [r12,#0x100]
 225+ str r1, [r12,#0x10c]
 226+ sub r11, r12, #0x04d00000
 227+ ldr r0, [r11,#0x80]
 228+ bic r0, r0, #0x20000
 229+ str r0, [r11,#0x80]
 230+ ldr r0, [r11]
 231+ bic r0, r0, #0xc00
 232+ orr r0, r0, #0x500
 233+ str r0, [r11]
 234+ mov r0, #3
 235+ str r0, [r11,#0x04]
 236+ mov r0, #1
 237+ bl sleepms
 238+ mov r0, #0x200
 239+ orr r0, r0, #0xed
 240+ str r0, [r11,#0x08]
 241+ ldr r0, val_006a49a5
 242+ str r0, [r11,#0x10]
 243+ mov r0, #0x37
 244+ str r0, [r11,#0x0c]
 245+ ldr r1, [r11,#0x04]
 246+ bic r1, r1, #0x700
 247+ orr r0, r1, #0x200
 248+ str r0, [r11,#0x04]
 249+ orr r0, r1, #0x300
 250+ str r0, [r11,#0x04]
 251+ str r0, [r11,#0x04]
 252+ orr r0, r1, #0x100
 253+ str r0, [r11,#0x04]
 254+ orr r0, r1, #0x500
 255+ str r0, [r11,#0x04]
 256+ ldr r0, [r11,#0x08]
 257+ orr r0, r0, #0x1000
 258+ str r0, [r11,#0x08]
 259+ ldr r0, val_00990999
 260+ str r0, [r11,#0x38]
 261+ ldr r0, [r12,#0xf0]
 262+ bic r0, r0, #0xff000000
 263+ bic r0, r0, #0x00ff0000
 264+ orr r0, r0, #0x22000000
 265+ orr r0, r0, #0x00220000
 266+ str r0, [r12,#0xf0]
 267+ mov r0, #0xf0
 268+ str r0, [r12,#0xfc]
 269+ sub r10, r12, #0x00d00000
 270+ ldr r0, [r10]
 271+ mov r0, r0,lsr#20
 272+ mov r0, r0,lsl#20
 273+ str r0, [r10]
 274+ mov r1, #0x3a000
 275+ orr r1, r1, #0x980
 276+ str r1, [r10,#0x08]
 277+ orr r0, r0, #0x300000
 278+ str r0, [r10]
 279+ bl initlcd
 280+ mov r0, #0x3f
 281+ mcr p15, 0, r0,c6,c0,1 @ CS0: 4GB at offset 0 - everything
 282+ mcr p15, 0, r0,c6,c0,0 @ DS0: 4GB at offset 0 - everything
 283+ mov r0, #0x31
 284+ mcr p15, 0, r0,c6,c1,1 @ CS1: SRAM/SDRAM mirror
 285+ mcr p15, 0, r0,c6,c1,0 @ DS1: SRAM/SDRAM mirror
 286+ add r0, r0, #0x08000000
 287+ mcr p15, 0, r0,c6,c2,1 @ CS2: SDRAM
 288+ mcr p15, 0, r0,c6,c2,0 @ DS2: SDRAM
 289+ mov r0, #0x23
 290+ add r0, r0, #0x22000000
 291+ mcr p15, 0, r0,c6,c3,1 @ CS3: SRAM
 292+ mcr p15, 0, r0,c6,c3,0 @ DS3: SRAM
 293+ mov r0, #0x27
 294+ add r0, r0, #0x24000000
 295+ mcr p15, 0, r0,c6,c4,1 @ CS4: NOR flash
 296+ mcr p15, 0, r0,c6,c4,0 @ DS4: NOR flash
 297+ mcr p15, 0, r1,c6,c5,1 @ CS5: unused
 298+ mcr p15, 0, r1,c6,c5,0 @ DS5: unused
 299+ mcr p15, 0, r1,c6,c6,1 @ CS6: unused
 300+ mcr p15, 0, r1,c6,c6,0 @ DS6: unused
 301+ mcr p15, 0, r1,c6,c7,1 @ CS7: unused
 302+ mcr p15, 0, r1,c6,c7,0 @ DS7: unused
 303+ mov r0, #0x1e
 304+ mcr p15, 0, r0,c2,c0, 1 @ CS1-4: cacheable
 305+ mcr p15, 0, r0,c2,c0, 0 @ DS1-4: cacheable
 306+ mcr p15, 0, r0,c3,c0, 0 @ DS1-4: write cacheable
 307+ mov r0, #0x300
 308+ add r0, r0, #0xff
 309+ mcr p15, 0, r0,c5,c0, 1 @ CS0-4: full access
 310+ mcr p15, 0, r0,c5,c0, 0 @ DS0-4: full access
 311+ mrc p15, 0, r0,c1,c0
 312+ orr r0, r0, #5
 313+ orr r0, r0, #0x1000
 314+ mcr p15, 0, r0,c1,c0 @ Re-enable the Protection Unit and caches
 315+ mov r11, #0x22000000
 316+ orr r11, r11, #0x10000
 317+ mov r0, r11
 318+ mov r3, #0x2d00
 319+ orr r3, r3, #0x60
 320+ sub r2, r1, #1
 321+fillbuff:
 322+ str r2, [r0], #4
 323+ subs r3, r3, #1
 324+ bne fillbuff
 325+ mov r0, r11
 326+ adr r3, text
 327+ bl rendertext
 328+ add r0, r11, #0xb00
 329+ bl rendertext
 330+ add r0, r11, #0x2100
 331+ bl rendertext
 332+ mov r0, #0
 333+ mov r1, #175
 334+ mov r2, #0
 335+ mov r3, #131
 336+ str r11, [sp]
 337+ bl displaylcd
 338+ mov r0, #0xe6
 339+ mov r1, #0x2b
 340+ mov r2, #4
 341+ bl i2csendbyte
 342+ mov r0, #0xe6
 343+ mov r1, #0x28
 344+ mov r2, #10
 345+ bl i2csendbyte
 346+ mov r0, #0xe6
 347+ mov r1, #0x29
 348+ mov r2, #1
 349+ bl i2csendbyte
 350+ orr r12, r12, #0xcf00000
 351+ ldr r0, [r12,#0xe4]
 352+ tst r0, #0x40
 353+ beq recoverymode
 354+ b decompress
 355+
 356+
 357+rendertext:
 358+ stmfd sp!, {r4-r6,lr}
 359+rendertext_next:
 360+ ldrb r12, [r3], #1
 361+ cmp r12, #0
 362+ beq rendertext_done
 363+ cmn r2, #1
 364+ beq rendertext_nobg
 365+ mov r6, r0
 366+ mov r4, #8
 367+rendertext_bgrow:
 368+ mov r5, #6
 369+rendertext_bgcol:
 370+ cmn r2, #2
 371+ strneh r2, [r6], #2
 372+ bne rendertext_noblend
 373+ ldrh lr, [r6]
 374+ tst lr, #1
 375+ orrne lr, lr, #0x10000
 376+ mov lr, lr,lsr#1
 377+ bic lr, lr, #0x1000
 378+ bic lr, lr, #0x84
 379+ strh lr, [r6], #2
 380+rendertext_noblend:
 381+ subs r5, r5, #1
 382+ bne rendertext_bgcol
 383+ add r6, r6, #340
 384+ subs r4, r4, #1
 385+ bne rendertext_bgrow
 386+rendertext_nobg:
 387+ adr r5, font
 388+ sub r12, r12, #0x20
 389+ cmp r12, #0x5f
 390+ addcc r5, r12,lsl#2
 391+ addcc r5, r12
 392+ mov r12, #5
 393+rendertext_col:
 394+ mov r6, r0
 395+ ldrb r4, [r5], #1
 396+rendertext_row:
 397+ tst r4, #1
 398+ strneh r1, [r6]
 399+ add r6, r6, #352
 400+ movs r4, r4,lsr#1
 401+ bne rendertext_row
 402+ add r0, r0, #2
 403+ subs r12, r12, #1
 404+ bne rendertext_col
 405+ add r0, r0, #2
 406+ b rendertext_next
 407+rendertext_done:
 408+ ldmfd sp!, {r4-r6,pc}
 409+
 410+
 411+text:
 412+ .ascii "emBIOS Loader v"
 413+ .ascii VERSION
 414+ .ascii " r"
 415+ .ascii VERSION_SVN
 416+ .ascii "\0"
 417+ .ascii "Switch HOLD on for recovery\0"
 418+ .ascii "Loading emBIOS...\0"
 419+
 420+
 421+font:
 422+ .byte 0, 0, 0, 0, 0
 423+ .byte 0, 0, 95, 0, 0
 424+ .byte 0, 7, 0, 7, 0
 425+ .byte 20, 127, 20, 127, 20
 426+ .byte 36, 42, 127, 42, 18
 427+ .byte 35, 19, 8, 100, 98
 428+ .byte 54, 73, 85, 34, 80
 429+ .byte 5, 3, 0, 0, 0
 430+ .byte 28, 34, 65, 0, 0
 431+ .byte 0, 0, 65, 34, 28
 432+ .byte 20, 8, 62, 8, 20
 433+ .byte 8, 8, 62, 8, 8
 434+ .byte 0, -96, 96, 0, 0
 435+ .byte 8, 8, 8, 8, 8
 436+ .byte 0, 96, 96, 0, 0
 437+ .byte 32, 16, 8, 4, 2
 438+ .byte 62, 81, 73, 69, 62
 439+ .byte 0, 66, 127, 64, 0
 440+ .byte 66, 97, 81, 73, 70
 441+ .byte 33, 65, 69, 75, 49
 442+ .byte 24, 20, 18, 127, 16
 443+ .byte 39, 69, 69, 69, 57
 444+ .byte 60, 74, 73, 73, 48
 445+ .byte 1, 113, 9, 5, 3
 446+ .byte 54, 73, 73, 73, 54
 447+ .byte 6, 73, 73, 41, 30
 448+ .byte 0, 54, 54, 0, 0
 449+ .byte 0, 86, 54, 0, 0
 450+ .byte 8, 20, 34, 65, 0
 451+ .byte 20, 20, 20, 20, 20
 452+ .byte 0, 65, 34, 20, 8
 453+ .byte 2, 1, 81, 9, 6
 454+ .byte 50, 73, 121, 65, 62
 455+ .byte 124, 18, 17, 18, 124
 456+ .byte 127, 73, 73, 73, 62
 457+ .byte 62, 65, 65, 65, 34
 458+ .byte 127, 65, 65, 34, 28
 459+ .byte 127, 73, 73, 73, 65
 460+ .byte 127, 9, 9, 9, 1
 461+ .byte 62, 65, 73, 73, 58
 462+ .byte 127, 8, 8, 8, 127
 463+ .byte 0, 65, 127, 65, 0
 464+ .byte 32, 64, 65, 63, 1
 465+ .byte 127, 8, 20, 34, 65
 466+ .byte 127, 64, 64, 64, 64
 467+ .byte 127, 2, 12, 2, 127
 468+ .byte 127, 4, 8, 16, 127
 469+ .byte 62, 65, 65, 65, 62
 470+ .byte 127, 9, 9, 9, 6
 471+ .byte 62, 65, 81, 33, 94
 472+ .byte 127, 9, 25, 41, 70
 473+ .byte 38, 73, 73, 73, 50
 474+ .byte 1, 1, 127, 1, 1
 475+ .byte 63, 64, 64, 64, 63
 476+ .byte 31, 32, 64, 32, 31
 477+ .byte 127, 32, 24, 32, 127
 478+ .byte 99, 20, 8, 20, 99
 479+ .byte 3, 4, 120, 4, 3
 480+ .byte 97, 81, 73, 69, 67
 481+ .byte 0, 127, 65, 65, 0
 482+ .byte 2, 4, 8, 16, 32
 483+ .byte 0, 65, 65, 127, 0
 484+ .byte 4, 2, 1, 2, 4
 485+ .byte 64, 64, 64, 64, 64
 486+ .byte 1, 2, 4, 0, 0
 487+ .byte 32, 84, 84, 84, 120
 488+ .byte 127, 68, 68, 68, 56
 489+ .byte 56, 68, 68, 68, 40
 490+ .byte 56, 68, 68, 68, 127
 491+ .byte 56, 84, 84, 84, 24
 492+ .byte 8, 126, 9, 1, 2
 493+ .byte 8, 84, 84, 84, 60
 494+ .byte 127, 4, 4, 4, 120
 495+ .byte 0, 68, 125, 64, 0
 496+ .byte 32, 64, 64, 61, 0
 497+ .byte 127, 16, 40, 68, 0
 498+ .byte 0, 65, 127, 64, 0
 499+ .byte 124, 4, 24, 4, 120
 500+ .byte 124, 8, 4, 4, 120
 501+ .byte 56, 68, 68, 68, 56
 502+ .byte 124, 20, 20, 20, 24
 503+ .byte 8, 20, 20, 20, 124
 504+ .byte 124, 8, 4, 4, 8
 505+ .byte 72, 84, 84, 84, 32
 506+ .byte 4, 63, 68, 64, 32
 507+ .byte 60, 64, 64, 32, 124
 508+ .byte 28, 32, 64, 32, 28
 509+ .byte 60, 64, 56, 64, 60
 510+ .byte 68, 40, 16, 40, 68
 511+ .byte 12, 80, 80, 80, 60
 512+ .byte 68, 100, 84, 76, 68
 513+ .byte 0, 8, 54, 65, 0
 514+ .byte 0, 0, 119, 0, 0
 515+ .byte 0, 65, 54, 8, 0
 516+ .byte 2, 1, 2, 4, 2
 517+
 518+
 519+lcd_inittab_type2:
 520+ .byte 5, 10
 521+ .byte 3, 0xa4
 522+ .byte 4, 0x01
 523+ .byte 5, 150
 524+ .byte 3, 0x01
 525+ .byte 2, 0x01
 526+ .byte 2, 0x00
 527+ .byte 3, 0x02
 528+ .byte 2, 0x03
 529+ .byte 2, 0x00
 530+ .byte 3, 0x03
 531+ .byte 2, 0x12
 532+ .byte 2, 0x30
 533+ .byte 3, 0x08
 534+ .byte 2, 0x04
 535+ .byte 2, 0x04
 536+ .byte 3, 0x0e
 537+ .byte 4, 0x10
 538+ .byte 3, 0x70
 539+ .byte 2, 0x10
 540+ .byte 2, 0x00
 541+ .byte 3, 0x71
 542+ .byte 4, 0x01
 543+ .byte 3, 0x30
 544+ .byte 4, 0x02
 545+ .byte 3, 0x31
 546+ .byte 2, 0x04
 547+ .byte 2, 0x00
 548+ .byte 3, 0x32
 549+ .byte 4, 0x07
 550+ .byte 3, 0x33
 551+ .byte 2, 0x05
 552+ .byte 2, 0x00
 553+ .byte 3, 0x34
 554+ .byte 4, 0x07
 555+ .byte 3, 0x35
 556+ .byte 2, 0x07
 557+ .byte 2, 0x03
 558+ .byte 3, 0x36
 559+ .byte 2, 0x05
 560+ .byte 2, 0x07
 561+ .byte 3, 0x37
 562+ .byte 4, 0x05
 563+ .byte 3, 0x38
 564+ .byte 2, 0x14
 565+ .byte 2, 0x04
 566+ .byte 3, 0x39
 567+ .byte 4, 0x0e
 568+ .byte 3, 0x40
 569+ .byte 2, 0x02
 570+ .byte 2, 0x02
 571+ .byte 3, 0x41
 572+ .byte 4, 0x03
 573+ .byte 3, 0x42
 574+ .byte 4, 0x00
 575+ .byte 3, 0x43
 576+ .byte 2, 0x02
 577+ .byte 2, 0x00
 578+ .byte 3, 0x44
 579+ .byte 2, 0x07
 580+ .byte 2, 0x07
 581+ .byte 3, 0x45
 582+ .byte 2, 0x04
 583+ .byte 2, 0x07
 584+ .byte 3, 0x46
 585+ .byte 2, 0x05
 586+ .byte 2, 0x05
 587+ .byte 3, 0x47
 588+ .byte 4, 0x02
 589+ .byte 3, 0x48
 590+ .byte 4, 0x04
 591+ .byte 3, 0x49
 592+ .byte 4, 0x04
 593+ .byte 3, 0x60
 594+ .byte 2, 0x02
 595+ .byte 2, 0x02
 596+ .byte 3, 0x61
 597+ .byte 4, 0x03
 598+ .byte 3, 0x62
 599+ .byte 4, 0x00
 600+ .byte 3, 0x63
 601+ .byte 2, 0x02
 602+ .byte 2, 0x00
 603+ .byte 3, 0x64
 604+ .byte 2, 0x07
 605+ .byte 2, 0x07
 606+ .byte 3, 0x65
 607+ .byte 2, 0x04
 608+ .byte 2, 0x07
 609+ .byte 3, 0x66
 610+ .byte 2, 0x05
 611+ .byte 2, 0x05
 612+ .byte 3, 0x68
 613+ .byte 4, 0x04
 614+ .byte 3, 0x69
 615+ .byte 4, 0x04
 616+ .byte 3, 0x07
 617+ .byte 4, 0x01
 618+ .byte 3, 0x18
 619+ .byte 4, 0x01
 620+ .byte 3, 0x10
 621+ .byte 2, 0x16
 622+ .byte 2, 0x90
 623+ .byte 3, 0x11
 624+ .byte 2, 0x01
 625+ .byte 2, 0x00
 626+ .byte 3, 0x12
 627+ .byte 2, 0x01
 628+ .byte 2, 0x17
 629+ .byte 3, 0x13
 630+ .byte 2, 0x0f
 631+ .byte 2, 0x80
 632+ .byte 3, 0x12
 633+ .byte 2, 0x01
 634+ .byte 2, 0x37
 635+ .byte 3, 0x20
 636+ .byte 4, 0x00
 637+ .byte 3, 0x21
 638+ .byte 4, 0x00
 639+ .byte 3, 0x50
 640+ .byte 4, 0x00
 641+ .byte 3, 0x51
 642+ .byte 4, 0xaf
 643+ .byte 3, 0x52
 644+ .byte 4, 0x00
 645+ .byte 3, 0x53
 646+ .byte 4, 0x83
 647+ .byte 3, 0x90
 648+ .byte 4, 0x03
 649+ .byte 3, 0x91
 650+ .byte 4, 0x00
 651+ .byte 3, 0x92
 652+ .byte 2, 0x01
 653+ .byte 2, 0x01
 654+ .byte 3, 0x98
 655+ .byte 2, 0x04
 656+ .byte 2, 0x00
 657+ .byte 3, 0x99
 658+ .byte 2, 0x13
 659+ .byte 2, 0x02
 660+ .byte 3, 0x9a
 661+ .byte 2, 0x02
 662+ .byte 2, 0x02
 663+ .byte 3, 0x9b
 664+ .byte 2, 0x02
 665+ .byte 2, 0x00
 666+ .byte 5, 100
 667+ .byte 3, 0x07
 668+ .byte 4, 0x21
 669+ .byte 3, 0x12
 670+ .byte 2, 0x01
 671+ .byte 2, 0x37
 672+ .byte 5, 1
 673+ .byte 3, 0x07
 674+ .byte 4, 0x21
 675+ .byte 3, 0x12
 676+ .byte 2, 0x11
 677+ .byte 2, 0x37
 678+ .byte 5, 100
 679+ .byte 3, 0x07
 680+ .byte 2, 0x02
 681+ .byte 2, 0x33
 682+ .byte 0
 683+
 684+lcd_inittab_type3:
 685+ .byte 1, 0x01
 686+ .byte 5, 5
 687+ .byte 1, 0x11
 688+ .byte 5, 120
 689+ .byte 1, 0x3a
 690+ .byte 2, 0x65
 691+ .byte 1, 0xab
 692+ .byte 1, 0x35
 693+ .byte 2, 0x00
 694+ .byte 1, 0xf2
 695+ .byte 2, 0x01
 696+ .byte 1, 0xe0
 697+ .byte 2, 0x71
 698+ .byte 2, 0x76
 699+ .byte 2, 0x25
 700+ .byte 2, 0x01
 701+ .byte 2, 0xa5
 702+ .byte 2, 0x09
 703+ .byte 2, 0x15
 704+ .byte 2, 0x11
 705+ .byte 1, 0xe1
 706+ .byte 2, 0x40
 707+ .byte 2, 0x21
 708+ .byte 2, 0x64
 709+ .byte 2, 0x13
 710+ .byte 2, 0xf3
 711+ .byte 2, 0x0b
 712+ .byte 2, 0x00
 713+ .byte 2, 0x00
 714+ .byte 1, 0xe2
 715+ .byte 2, 0x71
 716+ .byte 2, 0x65
 717+ .byte 2, 0x24
 718+ .byte 2, 0x08
 719+ .byte 2, 0x97
 720+ .byte 2, 0x01
 721+ .byte 2, 0x15
 722+ .byte 2, 0x11
 723+ .byte 1, 0xe3
 724+ .byte 2, 0x51
 725+ .byte 2, 0x01
 726+ .byte 2, 0x62
 727+ .byte 2, 0x13
 728+ .byte 2, 0xf3
 729+ .byte 2, 0x0b
 730+ .byte 2, 0x00
 731+ .byte 2, 0x00
 732+ .byte 1, 0xe4
 733+ .byte 2, 0x71
 734+ .byte 2, 0x57
 735+ .byte 2, 0x31
 736+ .byte 2, 0x01
 737+ .byte 2, 0x82
 738+ .byte 2, 0x04
 739+ .byte 2, 0x1f
 740+ .byte 2, 0x11
 741+ .byte 1, 0xe5
 742+ .byte 2, 0x64
 743+ .byte 2, 0x41
 744+ .byte 2, 0x64
 745+ .byte 2, 0x19
 746+ .byte 2, 0xb3
 747+ .byte 2, 0x09
 748+ .byte 2, 0x00
 749+ .byte 2, 0x00
 750+ .byte 1, 0x29
 751+ .byte 0
 752+
 753+lcd_inittab_type7:
 754+ .byte 1, 0x01
 755+ .byte 5, 10
 756+ .byte 1, 0xb4
 757+ .byte 2, 0x00
 758+ .byte 1, 0xb6
 759+ .byte 2, 0x01
 760+ .byte 1, 0xb7
 761+ .byte 2, 0x00
 762+ .byte 2, 0x00
 763+ .byte 2, 0x02
 764+ .byte 2, 0x00
 765+ .byte 2, 0x06
 766+ .byte 2, 0x26
 767+ .byte 2, 0x2d
 768+ .byte 2, 0x27
 769+ .byte 2, 0x55
 770+ .byte 2, 0x27
 771+ .byte 1, 0xb8
 772+ .byte 2, 0x10
 773+ .byte 1, 0xb9
 774+ .byte 2, 0x52
 775+ .byte 2, 0x12
 776+ .byte 2, 0x03
 777+ .byte 1, 0xc0
 778+ .byte 2, 0x0a
 779+ .byte 2, 0x10
 780+ .byte 2, 0x10
 781+ .byte 1, 0xc2
 782+ .byte 2, 0x14
 783+ .byte 2, 0x23
 784+ .byte 1, 0xc3
 785+ .byte 2, 0x12
 786+ .byte 2, 0x23
 787+ .byte 1, 0xc6
 788+ .byte 2, 0x48
 789+ .byte 1, 0xe0
 790+ .byte 2, 0x20
 791+ .byte 2, 0x71
 792+ .byte 2, 0x17
 793+ .byte 2, 0x09
 794+ .byte 2, 0x70
 795+ .byte 2, 0x0c
 796+ .byte 2, 0x13
 797+ .byte 2, 0x25
 798+ .byte 1, 0xe1
 799+ .byte 2, 0x37
 800+ .byte 2, 0x00
 801+ .byte 2, 0x63
 802+ .byte 2, 0x11
 803+ .byte 2, 0xd9
 804+ .byte 2, 0x00
 805+ .byte 2, 0x12
 806+ .byte 2, 0x01
 807+ .byte 1, 0xe2
 808+ .byte 2, 0x42
 809+ .byte 2, 0x42
 810+ .byte 2, 0x60
 811+ .byte 2, 0x08
 812+ .byte 2, 0xb4
 813+ .byte 2, 0x07
 814+ .byte 2, 0x0e
 815+ .byte 2, 0x90
 816+ .byte 1, 0xe3
 817+ .byte 2, 0x47
 818+ .byte 2, 0x60
 819+ .byte 2, 0x66
 820+ .byte 2, 0x09
 821+ .byte 2, 0x6a
 822+ .byte 2, 0x02
 823+ .byte 2, 0x0e
 824+ .byte 2, 0x09
 825+ .byte 1, 0xe4
 826+ .byte 2, 0x11
 827+ .byte 2, 0x40
 828+ .byte 2, 0x03
 829+ .byte 2, 0x0a
 830+ .byte 2, 0xc1
 831+ .byte 2, 0x0d
 832+ .byte 2, 0x17
 833+ .byte 2, 0x30
 834+ .byte 1, 0xe5
 835+ .byte 2, 0x00
 836+ .byte 2, 0x30
 837+ .byte 2, 0x77
 838+ .byte 2, 0x1c
 839+ .byte 2, 0xfb
 840+ .byte 2, 0x00
 841+ .byte 2, 0x13
 842+ .byte 2, 0x07
 843+ .byte 1, 0xe6
 844+ .byte 2, 0x01
 845+ .byte 1, 0x35
 846+ .byte 2, 0x00
 847+ .byte 1, 0x36
 848+ .byte 2, 0x00
 849+ .byte 1, 0xf2
 850+ .byte 2, 0x40
 851+ .byte 1, 0xf3
 852+ .byte 2, 0x50
 853+ .byte 1, 0xfb
 854+ .byte 2, 0x01
 855+ .byte 1, 0x11
 856+ .byte 5, 200
 857+ .byte 1, 0xb1
 858+ .byte 2, 0x16
 859+ .byte 2, 0x03
 860+ .byte 1, 0xb2
 861+ .byte 2, 0x17
 862+ .byte 2, 0x03
 863+ .byte 1, 0x3a
 864+ .byte 2, 0x65
 865+ .byte 1, 0x29
 866+ .byte 0
 867+
 868+
 869+recoverytext:
 870+ .ascii "Entered recovery mode\0"
 871+ .ascii "Connect via USB\0"
 872+
 873+
 874+.align 1
 875+
 876+
 877+.code 16
 878+thumb_nrv2e_d8:
 879+ mov r7,r2
 880+ mov r4,#1; neg r5,r4 @ r5= -1 initial condition
 881+ lsl r4,#31 @ 1<<31: refill next time
 882+ mov r6,#5
 883+ lsl r6,#8 @ 0x500 @ nrv2e M2_MAX_OFFSET
 884+ b top_n2e
 885+
 886+nrv2e_done:
 887+ bx r7
 888+
 889+get1_n2e: @ In: Carry set [from adding 0x80000000 (1<<31) to itself]
 890+ ldrb r4,[r0] @ zero-extend next byte
 891+ adc r4,r4 @ double and insert CarryIn as low bit
 892+ add r0,#1
 893+ lsl r4,#24 @ move to top byte, and set CarryOut from old bit 8
 894+ mov pc,lr @ return, stay in current (THUMB) mode
 895+
 896+lit_n2e:
 897+ ldrb r3,[r0]; add r0,#1
 898+ strb r3,[r2]; add r2,#1
 899+top_n2e:
 900+ add r4,r4; mov lr,pc; beq get1_n2e; bcs lit_n2e
 901+ mov r1,#1; b getoff_n2e
 902+
 903+off_n2e:
 904+ sub r1,#1
 905+ add r4,r4; mov lr,pc; beq get1_n2e; adc r1,r1
 906+getoff_n2e:
 907+ add r4,r4; mov lr,pc; beq get1_n2e; adc r1,r1
 908+ add r4,r4; mov lr,pc; beq get1_n2e; bcc off_n2e
 909+
 910+ sub r3,r1,#3 @ set Carry
 911+ mov r1,#0 @ Carry unaffected
 912+ blo offprev_n2e @ r1 was 2; tests Carry only
 913+ lsl r3,#8
 914+ ldrb r5,[r0]; add r0,#1 @ low 7+1 r4
 915+ orr r5,r3
 916+ mvn r5,r5; beq nrv2e_done @ r5= ~r5
 917+ asr r5,#1; bcs lenlast_n2e
 918+ b lenmore_n2e
 919+
 920+offprev_n2e:
 921+ add r4,r4; mov lr,pc; beq get1_n2e; bcs lenlast_n2e
 922+lenmore_n2e:
 923+ mov r1,#1
 924+ add r4,r4; mov lr,pc; beq get1_n2e; bcs lenlast_n2e
 925+len_n2e:
 926+ add r4,r4; mov lr,pc; beq get1_n2e; adc r1,r1
 927+ add r4,r4; mov lr,pc; beq get1_n2e; bcc len_n2e
 928+ add r1,#6-2
 929+ b gotlen_n2e
 930+
 931+lenlast_n2e:
 932+ add r4,r4; mov lr,pc; beq get1_n2e; adc r1,r1 @ 0,1,2,3
 933+ add r1,#2
 934+gotlen_n2e: @ 'cmn': add the inputs, set condition codes, discard the sum
 935+ cmn r6,r5; bcs near_n2e @ within M2_MAX_OFFSET
 936+ add r1,#1 @ too far away, so minimum match length is 3
 937+near_n2e:
 938+ ldrb r3,[r2] @ force cacheline allocate
 939+copy_n2e:
 940+ ldrb r3,[r2,r5]
 941+ strb r3,[r2]; add r2,#1
 942+ sub r1,#1; bne copy_n2e
 943+ b top_n2e
 944+
 945+
 946+.code 32
 947+.align 2
 948+
 949+
 950+decompress:
 951+ mov r0, #0x24000000
 952+ add r0, r0, #0xa000
 953+ mov r2, #0x08000000
 954+ adr r12, thumb_nrv2e_d8 + 1
 955+ bx r12
 956+
 957+
 958+recoverymode:
 959+ add r0, r11, #0x2100
 960+ mov r1, #0
 961+ mov r2, #0xff00
 962+ orr r2, r2, #0xff
 963+ adr r3, recoverytext
 964+ bl rendertext
 965+ add r0, r11, #0x2c00
 966+ bl rendertext
 967+ mov r0, #0
 968+ mov r1, #175
 969+ mov r2, #0
 970+ mov r3, #131
 971+ str r11, [sp]
 972+ bl displaylcd
 973+ mov r12, #0
 974+ mov r11, #1
 975+MOV R8, #0x38800000
 976+MOV R9, #0x3C400000
 977+ADD R1, R9, #0x00100000 @ Enable USB clocks
 978+LDR R0, [R1,#0x28]
 979+BIC R0, R0, #0x4000
 980+STR R0, [R1,#0x28]
 981+LDR R0, [R1,#0x40]
 982+BIC R0, R0, #0x800
 983+STR R0, [R1,#0x40]
 984+
 985+LDR R0, [R8,#0xE00] @ PHY clock enable
 986+BIC R0, R0, #3
 987+STR R0, [R8,#0xE00]
 988+
 989+LDR SP, [R8,#0x804]
 990+ORR R0, SP, #2
 991+STR R0, [R8,#0x804] @ USB2 Gadget: Soft disconnect
 992+
 993+BL sleep10ms
 994+MOV R9, #0x3C400000
 995+STR R12, [R9] @ USB2 PHY: Power on
 996+STR R11, [R9,#0x1C] @ USB2 PHY: Undocumented
 997+MOV R0, #0xE00
 998+ORR R0, R0, #0x3F
 999+STR R0, [R9,#0x44] @ USB2 PHY: Undocumented
 1000+LDR R0, [R9,#0x04]
 1001+BIC R0, R0, #3
 1002+STR R0, [R9,#0x04] @ USB2 PHY: Clock is 48MHz
 1003+LDR R4, [R9,#0x08]
 1004+ORR R1, R4, #1
 1005+STR R1, [R9,#0x08] @ USB2 PHY: Assert Software Reset
 1006+BL sleep10ms
 1007+STR R12, [R9,#0x08] @ USB2 PHY: Deassert Software Reset
 1008+BL sleep10ms
 1009+
 1010+STR R11, [R8,#0x10] @ USB2 Gadget: Assert Core Software Reset
 1011+waitcorereset:
 1012+LDR R0, [R8,#0x10] @ USB2 Gadget: Wait for Core to reset
 1013+TST R0, #1
 1014+BNE waitcorereset
 1015+TST R0, #0x80000000 @ USB2 Gadget: Wait for AHB IDLE
 1016+BEQ waitcorereset
 1017+
 1018+MOV R0, #0xB6
 1019+STR R0, [R8,#0x24] @ USB2 Gadget: RX FIFO size: 728 bytes
 1020+ORR R0, R0, #0x840000
 1021+STR R0, [R8,#0x28] @ USB2 Gadget: Non-periodic TX FIFO size: 528 bytes
 1022+MOV R0, #0x26
 1023+STR R0, [R8,#0x08] @ USB2 Gadget: DMA Enable, Burst Length: 4, Mask Interrupts
 1024+MOV R0, #0x1400
 1025+ADD R0, R0, #8
 1026+STR R0, [R8,#0x0C] @ USB2 Gadget: PHY IF is 16bit, Turnaround 5
 1027+STR SP, [R8,#0x804] @ USB2 Gadget: Soft reconnect
 1028+
 1029+@ fallthrough
 1030+
 1031+mainloop:
 1032+ LDR R3, [R8,#0x14] @ Global USB interrupts
 1033+ TST R3, #0x00001000 @ BUS reset
 1034+ BEQ noreset
 1035+ MOV R2, #0x500
 1036+ STR R2, [R8,#0x804]
 1037+ MOV R2, #4
 1038+ STR R2, [R8,#0x800] @ USB2 Gadget: Device Address 0, STALL on non-zero length status stage
 1039+ MOV R2, #0x8000
 1040+ STR R2, [R8,#0x900] @ USB2 Gadget: Endpoint 0 IN Control: ACTIVE
 1041+ STR R2, [R8,#0xB00] @ USB2 Gadget: Endpoint 0 OUT Control: ACTIVE
 1042+ SUB R5, R12, #1
 1043+ STR R5, [R8,#0x908] @ USB2 Gadget: Endpoint 0 IN Interrupt: ALL
 1044+ STR R5, [R8,#0xB08] @ USB2 Gadget: Endpoint 0 OUT Interrupt: ALL
 1045+ LDR R2, val_20080040
 1046+ STR R2, [R8,#0xB10] @ USB2 Gadget: Endpoint 0 OUT Transfer Size: 64 Bytes, 1 Packet, 1 Setup Packet
 1047+ MOV R2, #0x22000000
 1048+ ORR R2, R2, #0x10000
 1049+ STR R2, [R8,#0xB14] @ USB2 Gadget: Endpoint 0 OUT DMA Address: 0x22010000
 1050+ LDR R2, [R8,#0xB00]
 1051+ ORR R2, R2, #0x84000000
 1052+ STR R2, [R8,#0xB00] @ USB2 Gadget: Endpoint 0 OUT Control: ENABLE CLEARNAK
 1053+ LDR R2, val_00088210
 1054+ STR R2, [R8,#0x960] @ USB2 Gadget: Endpoint 3 IN Control: ACTIVE BULK, 528 byte packets
 1055+ STR R2, [R8,#0xB80] @ USB2 Gadget: Endpoint 4 OUT Control: ACTIVE BULK, 528 byte packets
 1056+ STR R5, [R8,#0x968] @ USB2 Gadget: Endpoint 3 IN Interrupt: ALL
 1057+ STR R5, [R8,#0xB88] @ USB2 Gadget: Endpoint 4 OUT Interrupt: ALL
 1058+ LDR R2, val_00080210
 1059+ STR R2, [R8,#0xB90] @ USB2 Gadget: Endpoint 4 OUT Transfer Size: 528 Bytes, 1 Packet
 1060+ MOV R2, #0x22000000
 1061+ ORR R2, R2, #0x12000
 1062+ STR R2, [R8,#0xB94] @ USB2 Gadget: Endpoint 4 OUT DMA Address: 0x22012000
 1063+ LDR R2, [R8,#0xB80]
 1064+ ORR R2, R2, #0x94000000
 1065+ STR R2, [R8,#0xB80] @ USB2 Gadget: Endpoint 4 OUT Control: ENABLE CLEARNAK DATA0
 1066+ STR R5, [R8,#0x810] @ USB2 Gadget: IN Endpoint Interrupt Mask: ALL
 1067+ STR R5, [R8,#0x814] @ USB2 Gadget: OUT Endpoint Interrupt Mask: ALL
 1068+ STR R5, [R8,#0x81C] @ USB2 Gadget: Enable interrupts on all endpoints
 1069+ noreset:
 1070+ TST R3, #0x00040000 @ IN endpoint event
 1071+ BEQ noinevent
 1072+ LDR R4, [R8,#0x908] @ Just ACK them all...
 1073+ STR R4, [R8,#0x908]
 1074+ LDR R4, [R8,#0x968]
 1075+ STR R4, [R8,#0x968]
 1076+ noinevent:
 1077+ TST R3, #0x00080000 @ OUT endpoint event
 1078+ BEQ nooutevent
 1079+ LDR R4, [R8,#0xB08]
 1080+ MOVS R4, R4 @ Event on OUT EP0
 1081+ BEQ noep0out
 1082+ TST R4, #8 @ SETUP phase done
 1083+ BEQ controldone
 1084+ BL flushcache
 1085+ MOV R5, #0x22000000
 1086+ ORR R5, R5, #0x10000
 1087+ LDRB R6, [R5,#0x01] @ Get request type
 1088+ CMP R6, #0
 1089+ BEQ GET_STATUS
 1090+ CMP R6, #1
 1091+ BEQ CLEAR_FEATURE
 1092+ CMP R6, #3
 1093+ BEQ SET_FEATURE
 1094+ CMP R6, #5
 1095+ BEQ SET_ADDRESS
 1096+ CMP R6, #6
 1097+ BEQ GET_DESCRIPTOR
 1098+ CMP R6, #8
 1099+ BEQ GET_CONFIGURATION
 1100+ CMP R6, #9
 1101+ BEQ SET_CONFIGURATION
 1102+ ctrlstall:
 1103+ LDR R1, [R8,#0x900]
 1104+ ORR R1, R1, #0x00200000
 1105+ STR R1, [R8,#0x900] @ Stall IN EP0
 1106+ LDR R1, [R8,#0xB00]
 1107+ ORR R1, R1, #0x00200000
 1108+ STR R1, [R8,#0xB00] @ Stall OUT EP0
 1109+ controldone:
 1110+ LDR R1, val_20080040
 1111+ STR R1, [R8,#0xB10] @ OUT EP0: 64 Bytes, 1 Packet, 1 Setup Packet
 1112+ MOV R1, #0x22000000
 1113+ ORR R1, R1, #0x10000
 1114+ STR R1, [R8,#0xB14] @ OUT EP0: DMA address
 1115+ LDR R1, [R8,#0xB00]
 1116+ ORR R1, R1, #0x84000000
 1117+ STR R1, [R8,#0xB00] @ OUT EP0: Enable ClearNAK
 1118+ noep0out:
 1119+ STR R4, [R8,#0xB08] @ ACK it, whatever it was...
 1120+ LDR R4, [R8,#0xB88]
 1121+ MOVS R4, R4 @ Event on OUT EP4
 1122+ BEQ noep1out
 1123+ TST R4, #1 @ XFER complete
 1124+ BEQ datadone
 1125+ BL flushcache
 1126+ MOV R0, #0x22000000
 1127+ ORR LR, R0, #0x800
 1128+ ORR R0, R0, #0x12000
 1129+ LDR R1, [R0]
 1130+ LDR R2, [R0,#0x04]
 1131+ CMP R1, #0 @ EXECUTE, no feedback
 1132+ MCREQ p15, 0, R12,c7,c5 @ Flush ICache
 1133+ LDREQ SP, [R0,#0x08]
 1134+ MOVEQ PC, R2
 1135+ CMP R1, #1 @ READ
 1136+ BNE noread
 1137+ LDR R1, [R0,#0x08]
 1138+ MOV R6, R1,LSL#2
 1139+ MOV R0, #0x22000000
 1140+ ORR R0, R0, #0x13000
 1141+ ORR R0, R0, #0x10
 1142+ copydata:
 1143+ LDR R5, [R2], #4
 1144+ STR R5, [R0], #4
 1145+ SUBS R1, R1, #1
 1146+ BNE copydata
 1147+ ADD R1, R6, #0x10
 1148+ B sendsuccesscustomsize
 1149+ noread:
 1150+ CMP R1, #2 @ WRITE
 1151+ BNE sendunknownfunc
 1152+ LDR R1, [R0,#0x08]
 1153+ ADD R0, R0, #0x10
 1154+ copydata2:
 1155+ LDR R5, [R0], #4
 1156+ STR R5, [R2], #4
 1157+ SUBS R1, R1, #1
 1158+ BNE copydata2
 1159+ BL flushcache
 1160+ MOV R1, #0x10
 1161+ @ fallthrough
 1162+ sendsuccesscustomsize:
 1163+ MOV R2, #0x22000000
 1164+ ORR R2, R2, #0x13000
 1165+ STMIA R2, {R11, R12}
 1166+ @ fallthrough
 1167+ sendlast2zero:
 1168+ STR R12, [R2,#0x08]
 1169+ STR R12, [R2,#0x0C]
 1170+ @ fallthrough
 1171+ datasend:
 1172+ BL flushcache
 1173+ LDR R0, val_00088210
 1174+ STR R0, [R8,#0x960] @ EP3 IN: ACTIVE BULK, 528 byte packets
 1175+ ORR R1, R1, #0x20000000 @ 1 Packet at a time
 1176+ ORR R1, R1, #0x00080000 @ 1 Packet
 1177+ STR R1, [R8,#0x970] @ EP3 IN: 1 Packet, 1 Packet at a time, Size as in R1
 1178+ STR R2, [R8,#0x974] @ EP3 IN: DMA address
 1179+ LDR R1, [R8,#0x960]
 1180+ ORR R1, R1, #0x84000000
 1181+ STR R1, [R8,#0x960] @ EP3 IN: Enable ClearNAK
 1182+ datadone:
 1183+ LDR R1, val_00080210
 1184+ STR R1, [R8,#0xB90] @ OUT EP4: 528 Bytes, 1 Packet
 1185+ MOV R1, #0x22000000
 1186+ ORR R1, R1, #0x12000
 1187+ STR R1, [R8,#0xB94] @ Out EP4: DMA address
 1188+ LDR R1, [R8,#0xB80]
 1189+ ORR R1, R1, #0x84000000
 1190+ STR R1, [R8,#0xB80] @ Out EP4: Enable ClearNAK
 1191+ noep1out:
 1192+ STR R4, [R8,#0xB88] @ ACK it, whatever it was...
 1193+ nooutevent:
 1194+ STR R3, [R8,#0x14] @ ACK it, whatever it was...
 1195+B mainloop
 1196+
 1197+sendunknownfunc:
 1198+ MOV R0, #2
 1199+ MOV R1, #0x10
 1200+ MOV R2, #0x08400000
 1201+ STMIA R2, {R0, R12}
 1202+B sendlast2zero
 1203+
 1204+GET_DESCRIPTOR:
 1205+ LDRB R7, [R5,#3] @ Descriptor type
 1206+ CMP R7, #1
 1207+ ADREQ R0, devicedescriptor
 1208+ BEQ senddescriptor
 1209+ CMP R7, #2
 1210+ ADREQ R0, configurationdescriptor
 1211+ MOVEQ R1, #0x20
 1212+ BEQ senddescriptorcustomsize
 1213+ CMP R7, #3
 1214+ BNE ctrlstall
 1215+ LDRB R7, [R5,#2] @ String descriptor index
 1216+ CMP R7, #0
 1217+ ADREQ R0, langstringdescriptor
 1218+ BEQ senddescriptor
 1219+ CMP R7, #1
 1220+ CMPNE R7, #2
 1221+ ADREQ R0, devnamestringdescriptor
 1222+ BNE ctrlstall
 1223+@ fallthrough
 1224+
 1225+senddescriptor:
 1226+ LDRB R1, [R0] @ Descriptor length
 1227+@ fallthrough
 1228+
 1229+senddescriptorcustomsize:
 1230+ LDRH R5, [R5,#0x06] @ Requested length
 1231+ CMP R5, R1
 1232+ MOVLO R1, R5
 1233+ MOV R2, #0x22000000
 1234+ ORR R2, R2, #0x11000
 1235+ ADD R6, R1, R2
 1236+ copydescriptor:
 1237+ LDR R5, [R0], #4
 1238+ STR R5, [R2], #4
 1239+ CMP R2, R6
 1240+ BCC copydescriptor
 1241+B ctrlsend
 1242+
 1243+GET_STATUS:
 1244+ LDRB R1, [R5]
 1245+ CMP R1, #0x80
 1246+ MOV R0, #0x22000000
 1247+ ORR R0, R0, #0x11000
 1248+ STREQ R11, [R0]
 1249+ STRNE R12, [R0]
 1250+ MOV R1, #0x00000002
 1251+B ctrlsend
 1252+
 1253+CLEAR_FEATURE:
 1254+ LDRB R2, [R5]
 1255+ CMP R2, #2
 1256+ LDREQ R2, [R5,#2]
 1257+ BICEQ R2, R2, #0x00800000
 1258+ CMPEQ R2, #0x00010000
 1259+@ fallthrough
 1260+
 1261+SET_CONFIGURATION:
 1262+ LDREQ R2, [R8,#0x960]
 1263+ ORREQ R2, R2, #0x10000000
 1264+ STREQ R2, [R8,#0x960] @ EP3 IN: Set DATA0 PID
 1265+ LDREQ R2, [R8,#0xB80]
 1266+ ORREQ R2, R2, #0x10000000
 1267+ STREQ R2, [R8,#0xB80] @ EP4 OUT: Set DATA0 PID
 1268+B SET_FEATURE @ zero-length ACK
 1269+
 1270+SET_ADDRESS:
 1271+ LDRH R2, [R5,#0x02] @ new address
 1272+ LDR R1, [R8,#0x800]
 1273+ BIC R1, R1, #0x000007F0
 1274+ ORR R1, R1, R2,LSL#4
 1275+ STR R1, [R8,#0x800] @ set new address
 1276+@ fallthrough
 1277+
 1278+SET_FEATURE:
 1279+ MOV R1, #0 @ zero-length ACK
 1280+B ctrlsend
 1281+
 1282+GET_CONFIGURATION:
 1283+ MOV R1, #0x00000001
 1284+ STR R1, [R0]
 1285+@ fallthrough
 1286+
 1287+ctrlsend:
 1288+ BL flushcache
 1289+ MOV R0, #0x22000000 @ Buffer to be sent
 1290+ ORR R0, R0, #0x11000
 1291+ MOV R2, #0x00009800
 1292+ STR R2, [R8,#0x900] @ EP0 IN: ACTIVE
 1293+ ORR R1, R1, #0x00080000 @ 1 Packet
 1294+ STR R1, [R8,#0x910] @ EP0 IN: 1 Packet, Size as in R1
 1295+ STR R0, [R8,#0x914] @ EP0 IN: DMA address
 1296+ LDR R1, [R8,#0x900]
 1297+ ORR R1, R1, #0x84000000
 1298+ STR R1, [R8,#0x900] @ EP0 IN: Enable ClearNAK
 1299+B controldone
 1300+
 1301+val_00080210:
 1302+.word 0x00080210
 1303+
 1304+val_00088210:
 1305+.word 0x00088210
 1306+
 1307+val_20080040:
 1308+.word 0x20080040
 1309+
 1310+devicedescriptor:
 1311+.word 0x02000112
 1312+.word 0x40FFFFFF
 1313+.word 0xE112FFFF
 1314+.word 0x02010001
 1315+.word 0x00010100
 1316+
 1317+configurationdescriptor:
 1318+.word 0x00200209
 1319+.word 0xC0000101
 1320+.word 0x00040932
 1321+.word 0xFFFF0200
 1322+.word 0x050700FF
 1323+.word 0x02100204
 1324+.word 0x83050701
 1325+.word 0x01021002
 1326+
 1327+langstringdescriptor:
 1328+.word 0x04090304
 1329+
 1330+devnamestringdescriptor:
 1331+.byte 0x38
 1332+.byte 3
 1333+.ascii "e\0m\0B\0I\0O\0S\0 \0L\0o\0a\0d\0e\0r\0 \0R\0e\0c\0o\0v\0e\0r\0y\0 \0I\0N\0\062\0G\0"
 1334+
 1335+
 1336+lcd_initmapping:
 1337+ .word lcd_inittab_type3 - lcd_initmapping_ref
 1338+ .word lcd_inittab_type7 - lcd_initmapping_ref
 1339+ .word lcd_inittab_type2 - lcd_initmapping_ref
 1340+ .word lcd_inittab_type3 - lcd_initmapping_ref
 1341+
 1342+initlcd:
 1343+ stmfd sp!, {r4,r5,lr}
 1344+ bl detectlcd
 1345+ sub r12, r12, #0x04900000
 1346+ adr r5, lcd_initmapping
 1347+ add r5, r5, r0,lsl#2
 1348+ ldr r5, [r5]
 1349+ add r5, r5, pc
 1350+ mov r0, #0xc00
 1351+lcd_initmapping_ref:
 1352+ orr r0, r0, #1
 1353+ str r0, [r12]
 1354+ mov r0, #0x7f00
 1355+ orr r0, r0, #0xff
 1356+ str r0, [r12,#0x24]
 1357+ mov r0, #0
 1358+ str r0, [r12,#0x28]
 1359+ mov r0, #1
 1360+ bl sleepms
 1361+ mov r0, #1
 1362+ str r0, [r12,#0x28]
 1363+ mov r0, #5
 1364+ bl sleepms
 1365+initlcd_loop:
 1366+ adr lr, initlcd_loop
 1367+ ldrb r1, [r5], #1
 1368+ ldrb r0, [r5], #1
 1369+ add pc, pc, r1,lsl#2
 1370+ nop
 1371+ ldmfd sp!, {r4,r5,pc}
 1372+ b sendlcdc
 1373+ b sendlcdd
 1374+ b sendlcd2c
 1375+ b sendlcd2d
 1376+ b sleepms
 1377+
 1378+sendlcd2c:
 1379+ ldr r4, [r12,#0x1c]
 1380+ ands r4, r4, #0x10
 1381+ bne sendlcd2c
 1382+ mov r4, r0,lsr#8
 1383+ str r4, [r12,#0x04]
 1384+ and r0, r0, #0xff
 1385+sendlcdc:
 1386+ ldr r4, [r12,#0x1c]
 1387+ ands r4, r4, #0x10
 1388+ bne sendlcdc
 1389+ str r0, [r12,#0x04]
 1390+ mov pc, lr
 1391+sendlcd2d:
 1392+ ldr r4, [r12,#0x1c]
 1393+ ands r4, r4, #0x10
 1394+ bne sendlcd2d
 1395+ mov r4, r0,lsr#8
 1396+ str r4, [r12,#0x40]
 1397+ and r0, r0, #0xff
 1398+sendlcdd:
 1399+ ldr r4, [r12,#0x1c]
 1400+ ands r4, r4, #0x10
 1401+ bne sendlcdd
 1402+ str r0, [r12,#0x40]
 1403+ mov pc, lr
 1404+
 1405+detectlcd:
 1406+ mov r12, #0x3c000000
 1407+ orr r12, r12, #0xf00000
 1408+ ldr r0, [r12,#0xd0]
 1409+ bic r0, r0, #0x0f
 1410+ str r0, [r12,#0xd0]
 1411+ ldr r0, [r12,#0xe0]
 1412+ bic r0, r0, #0xf0
 1413+ str r0, [r12,#0xe0]
 1414+ ldr r0, [r12,#0xd4]
 1415+ and r0, r0, #1
 1416+ ldr r1, [r12,#0xe4]
 1417+ and r1, r1, #2
 1418+ orr r0, r0, r1
 1419+ mov pc, lr
 1420+
 1421+displaylcd:
 1422+ stmfd sp!, {r0,r1,r4,lr}
 1423+ bl displaylcd_sync
 1424+ bl detectlcd
 1425+ sub r12, r12, #0x04900000
 1426+ cmp r0, #2
 1427+ bne displaylcd_othertypes
 1428+ mov r0, #0x50
 1429+ bl sendlcd2c
 1430+ ldr r0, [sp]
 1431+ bl sendlcd2d
 1432+ mov r0, #0x51
 1433+ bl sendlcd2c
 1434+ ldr r0, [sp,#0x04]
 1435+ bl sendlcd2d
 1436+ mov r0, #0x52
 1437+ bl sendlcd2c
 1438+ mov r0, r2
 1439+ bl sendlcd2d
 1440+ mov r0, #0x53
 1441+ bl sendlcd2c
 1442+ mov r0, r3
 1443+ bl sendlcd2d
 1444+ mov r0, #0x20
 1445+ bl sendlcd2c
 1446+ ldr r0, [sp]
 1447+ bl sendlcd2d
 1448+ mov r0, #0x21
 1449+ bl sendlcd2c
 1450+ mov r0, r2
 1451+ bl sendlcd2d
 1452+ mov r0, #0x22
 1453+ bl sendlcd2c
 1454+ b displaylcd_blit
 1455+displaylcd_othertypes:
 1456+ mov r0, #0x2a
 1457+ bl sendlcdc
 1458+ ldr r0, [sp]
 1459+ bl sendlcd2d
 1460+ ldr r0, [sp,#0x04]
 1461+ bl sendlcd2d
 1462+ mov r0, #0x2b
 1463+ bl sendlcdc
 1464+ mov r0, r2
 1465+ bl sendlcd2d
 1466+ mov r0, r3
 1467+ bl sendlcd2d
 1468+ mov r0, #0x2c
 1469+ bl sendlcdc
 1470+displaylcd_blit:
 1471+ ldmia sp, {r0,r1}
 1472+ sub r1, r0
 1473+ add r1, r1, #1
 1474+ sub r3, r2
 1475+ add r3, r3, #1
 1476+ mul r2, r1, r3
 1477+ ldr r1, [sp,#0x10]
 1478+ cmp r1, #0x40000000
 1479+ bne displaylcd_dma
 1480+displaylcd_pixel:
 1481+ ldr r0, [sp,#0x14]
 1482+ bl sendlcd2d
 1483+ subs r2, r2, #1
 1484+ bne displaylcd_pixel
 1485+ ldmfd sp!, {r0,r1,r4,pc}
 1486+displaylcd_dma:
 1487+ mov r3, #0x38000000
 1488+ add r3, r3, #0x400000
 1489+ mov r0, #0x20000000
 1490+ orr r0, r0, #0x180000
 1491+ str r0, [r3,#0x104]
 1492+ str r1, [r3,#0x100]
 1493+ mov r0, r2,lsr#1
 1494+ sub r0, r0, #1
 1495+ str r0, [r3,#0x108]
 1496+ bl flushcache
 1497+ mov r0, #4
 1498+ str r0, [r3,#0x114]
 1499+ ldmfd sp!, {r0,r1,r4,pc}
 1500+
 1501+displaylcd_sync:
 1502+ mov r1, #0x38000000
 1503+ add r1, r1, #0x400000
 1504+displaylcd_sync_wait:
 1505+ ldr r0, [r1,#0x184]
 1506+ tst r0, #0x40000
 1507+ bne displaylcd_sync_wait
 1508+ mov pc, lr
 1509+
 1510+
 1511+getpowerok:
 1512+ stmfd sp!, {lr}
 1513+ mov r0, #0xe6
 1514+ mov r1, #0x19
 1515+ bl i2crecvbyte
 1516+ eor r0, r0, #1
 1517+ ands r0, r0, #1
 1518+ ldmnefd sp!, {pc}
 1519+ mov r0, #0xe6
 1520+ mov r1, #0x4b
 1521+ bl i2crecvbyte
 1522+ ands r0, r0, #4
 1523+ movne r0, #1
 1524+ ldmnefd sp!, {pc}
 1525+ mov r0, #0xe6
 1526+ mov r1, #0x12
 1527+ bl i2crecvbyte
 1528+ ands r0, r0, #4
 1529+ movne r0, #1
 1530+ ldmfd sp!, {pc}
 1531+
 1532+poweroff:
 1533+ mov r0, #0xe6
 1534+ mov r1, #0x0c
 1535+ mov r2, #0x01
 1536+ bl i2csendbyte
 1537+ b poweroff
 1538+
 1539+i2csendbyte:
 1540+ mov r3, #0
 1541+@fallthrough
 1542+
 1543+i2csend:
 1544+ stmfd sp!, {r4,lr}
 1545+ mov r12, #0x3C000000
 1546+ add r12, r12, #0x00900000
 1547+ mov r4, #0
 1548+ str r4, [r12,#0x08]
 1549+ str r0, [r12,#0x0c]
 1550+ mov r4, #0xf0
 1551+ str r4, [r12,#0x04]
 1552+ mov r4, #0xf3
 1553+ str r4, [r12]
 1554+ bl i2cwait
 1555+ str r1, [r12,#0x0c]
 1556+ str r4, [r12]
 1557+ bl i2cwait
 1558+ movs r3, r3
 1559+ moveq r0, r2
 1560+i2csend_write:
 1561+ ldrne r0, [r2], #1
 1562+ str r0, [r12,#0x0c]
 1563+ str r4, [r12]
 1564+ bl i2cwait
 1565+ subs r3, r3, #1
 1566+ bhi i2csend_write
 1567+ mov r0, #0xd0
 1568+ str r0, [r12,#0x04]
 1569+ str r4, [r12]
 1570+i2csend_wait:
 1571+ ldr r0, [r12,#0x04]
 1572+ tst r0, #0x20
 1573+ bne i2csend_wait
 1574+ ldmfd sp!, {r4,pc}
 1575+
 1576+i2crecvbyte:
 1577+ mov r2, #0
 1578+ mov r3, #1
 1579+@fallthrough
 1580+
 1581+i2crecv:
 1582+ stmfd sp!, {r0,r4,lr}
 1583+ mov r12, #0x3C000000
 1584+ add r12, r12, #0x00900000
 1585+ mov r4, #0
 1586+ str r4, [r12,#0x08]
 1587+ str r0, [r12,#0x0c]
 1588+ mov r4, #0xf0
 1589+ str r4, [r12,#0x04]
 1590+ mov r4, #0xf3
 1591+ str r4, [r12]
 1592+ bl i2cwait
 1593+ str r1, [r12,#0x0c]
 1594+ str r4, [r12]
 1595+ bl i2cwait
 1596+ ldr r0, [sp]
 1597+ orr r0, r0, #1
 1598+ str r1, [r12,#0x0c]
 1599+ mov r0, #0xb0
 1600+ str r0, [r12,#0x04]
 1601+ str r4, [r12]
 1602+ bl i2cwait
 1603+i2crecv_read:
 1604+ subs r3, r3, #1
 1605+ moveq r4, #0x73
 1606+ str r4, [r12]
 1607+ bl i2cwait
 1608+ ldr r0, [r12,#0x0c]
 1609+ movs r2, r2
 1610+ strne r0, [r2], #1
 1611+ movs r3, r3
 1612+ bne i2crecv_read
 1613+ mov r1, #0x90
 1614+ str r1, [r12,#0x04]
 1615+ mov r1, #0xf3
 1616+ str r1, [r12]
 1617+i2crecv_wait:
 1618+ ldr r1, [r12,#0x04]
 1619+ tst r1, #0x20
 1620+ bne i2crecv_wait
 1621+ ldmfd sp!, {r0,r4,pc}
 1622+
 1623+i2cwait:
 1624+ ldr r0, [r12]
 1625+ tst r0, #0x10
 1626+ beq i2cwait
 1627+ mov pc, lr
 1628+
 1629+
 1630+sleep10ms:
 1631+ mov r0, #10
 1632+@ fallthrough
 1633+
 1634+sleepms:
 1635+ mov r2, #0xc8
 1636+ mul r1, r0, r2
 1637+ mov r2, #0x3c000000
 1638+ orr r2, r2, #0x700000
 1639+ ldr r0, [r2,#0x80]
 1640+ ldr r0, [r2,#0x84]
 1641+ add r1, r1, r0
 1642+sleepmsloop:
 1643+ ldr r0, [r2,#0x80]
 1644+ ldr r0, [r2,#0x84]
 1645+ cmp r0, r1
 1646+ bmi sleepmsloop
 1647+ mov pc, lr
Index: embios/trunk/loader/ipodnano2g/version.h
@@ -0,0 +1,36 @@
 2+//
 3+//
 4+// Copyright 2010 TheSeven
 5+//
 6+//
 7+// This file is part of emBIOS.
 8+//
 9+// emBIOS is free software: you can redistribute it and/or
 10+// modify it under the terms of the GNU General Public License as
 11+// published by the Free Software Foundation, either version 2 of the
 12+// License, or (at your option) any later version.
 13+//
 14+// emBIOS is distributed in the hope that it will be useful,
 15+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 17+// See the GNU General Public License for more details.
 18+//
 19+// You should have received a copy of the GNU General Public License along
 20+// with emBIOS. If not, see <http://www.gnu.org/licenses/>.
 21+//
 22+//
 23+
 24+
 25+#ifndef __VERSION_H__
 26+#define __VERSION_H__
 27+
 28+
 29+#define VERSION "0.0.1pre"
 30+#define VERSION_MAJOR 0
 31+#define VERSION_MINOR 0
 32+#define VERSION_PATCH 1
 33+#define VERSION_SVN "$REVISION$"
 34+#define VERSION_SVN_INT $REVISIONINT$
 35+
 36+
 37+#endif
\ No newline at end of file
Index: embios/trunk/loader/ipodnano2g/Makefile
@@ -0,0 +1,102 @@
 2+NAME := embiosldr-ipodnano2g
 3+BOOTADDR = 24008000
 4+
 5+TOOLSDIR ?= ../../../../tools/
 6+
 7+CROSS ?= arm-none-eabi-
 8+CC := $(CROSS)gcc
 9+AS := $(CROSS)as
 10+LD := $(CROSS)ld
 11+OBJCOPY := $(CROSS)objcopy
 12+UCLPACK := ucl2e10singleblk
 13+CRYPTDFU := python $(TOOLSDIR)/ipodcrypt.py nano2g-cryptdfu
 14+
 15+CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -ffunction-sections -fdata-sections -mcpu=arm940t
 16+LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
 17+
 18+preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
 19+preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
 20+
 21+REVISION := $(shell svnversion .)
 22+REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
 23+
 24+SRC := $(call preprocesspaths,SOURCES,-I. -I..)
 25+OBJ := $(SRC:%.c=build/%.o)
 26+OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
 27+
 28+all: $(NAME)
 29+
 30+-include $(OBJ:%=%.dep)
 31+
 32+$(NAME): build/$(NAME).dfu
 33+
 34+build/$(NAME).dfu: build/$(NAME).bin
 35+ @echo [CDFU] $<
 36+ @$(CRYPTDFU) $^ $@
 37+
 38+build/$(NAME).bin: build/$(NAME).elf
 39+ @echo [OC] $<
 40+ @$(OBJCOPY) -O binary $^ $@
 41+
 42+build/$(NAME).elf: ls.x $(OBJ)
 43+ @echo [LD] $@
 44+ @$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
 45+
 46+build/%.o: %.c build/version.h
 47+ @echo [CC] $<
 48+ifeq ($(shell uname),WindowsNT)
 49+ @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
 50+else
 51+ @-mkdir -p $(dir $@)
 52+endif
 53+ @$(CC) -c $(CFLAGS) -o $@ $<
 54+ @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
 55+ @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
 56+ifeq ($(shell uname),WindowsNT)
 57+ @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
 58+else
 59+ @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
 60+endif
 61+ @rm -f $@.dep.tmp
 62+
 63+build/%.o: %.S build/version.h
 64+ @echo [CC] $<
 65+ifeq ($(shell uname),WindowsNT)
 66+ @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
 67+else
 68+ @-mkdir -p $(dir $@)
 69+endif
 70+ @$(CC) -c $(CFLAGS) -o $@ $<
 71+ @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
 72+ @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
 73+ifeq ($(shell uname),WindowsNT)
 74+ @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
 75+else
 76+ @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
 77+endif
 78+ @rm -f $@.dep.tmp
 79+
 80+build/__embios_%.o: $(EMBIOSDIR)/export/%.S
 81+ @echo [CC] $<
 82+ifeq ($(shell uname),WindowsNT)
 83+ @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
 84+else
 85+ @-mkdir -p $(dir $@)
 86+endif
 87+ @$(CC) -c $(CFLAGS) -o $@ $<
 88+
 89+build/version.h: version.h .svn/entries build
 90+ @echo [PP] $<
 91+ifeq ($(shell uname),WindowsNT)
 92+ @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
 93+else
 94+ @sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
 95+endif
 96+
 97+build:
 98+ @mkdir $@
 99+
 100+clean:
 101+ rm -rf build
 102+
 103+.PHONY: all clean $(NAME)
Index: embios/trunk/loader/ipodnano2g
Property changes on: embios/trunk/loader/ipodnano2g
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
 104+build