JuiceBox Code Lcd Startup

(file: crt0.s)

.global main                   // int main(void)

.global _etext                 // -> .data initial values in ROM .global _data                  // -> .data area in RAM .global _edata                 // end of .data area .global __bss_start            // -> .bss area in RAM .global __bss_end__            // end of .bss area .global _stack                 // top of stack

// Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs .set MODE_USR, 0x10            // User Mode .set MODE_FIQ, 0x11            // FIQ Mode .set MODE_IRQ, 0x12            // IRQ Mode .set MODE_SVC, 0x13            // Supervisor Mode .set MODE_ABT, 0x17            // Abort Mode .set MODE_UND, 0x1B            // Undefined Mode .set MODE_SYS, 0x1F            // System Mode

.equ I_BIT, 0x80               // when I bit is set, IRQ is disabled .equ F_BIT, 0x40               // when F bit is set, FIQ is disabled

.text .code 32 .align 2

// Setup the operating mode & stack. // -   .global _start, start, _mainCRTStartup .func  _start

_start: start: _mainCRTStartup:

mrs  r0,cpsr                   // get PSR orr  r0,r0,#I_BIT|F_BIT        // disable IRQ and FIQ msr  cpsr,r0                   // set up status register

ldr  r0,=_stack mov  sp,r0

// Clear .bss // --

mov  r0,#0                     // get a zero ldr  r1,=__bss_start           // -> bss start ldr  r2,=__bss_end__           // -> bss end 2: cmp   r1,r2                     // check if data to clear strlo r0,[r1],#4               // clear 4 bytes blo  2b                        // loop until done

ldr  r1,=main mov  lr,pc bx   r1                       // enter main

.size  _start,. - _start .endfunc

.end

Category JuiceBox