.section .vectors,"ax" b __irq_wrapper .globl _reset _reset: movi r0, 65 export r0, 0 /* Clear bss */ movi r0,_lo(__bss_start) #if defined(__CMODEL_LARGE__) || defined(__CMODEL_MEDIUM__) movi r13,_hi(__bss_start) #endif #ifdef __CMODEL_LARGE__ movi r14,_higher(__bss_start) movi r15,_highest(__bss_start) #endif movi r1,0 3: cmpi r0,_lo(__bss_end) #if defined(__CMODEL_LARGE__) || defined(__CMODEL_MEDIUM__) bnz 1f cmpi r13,_hi(__bss_end) #endif #ifdef __CMODEL_LARGE__ bnz 1f cmpi r14,_higher(__bss_end) cmpi r15,_highest(__bss_end) #endif bz setup_stack_pointer 1: sspi r1,r0 addi r0,1 #if defined(__CMODEL_LARGE__) || defined(__CMODEL_MEDIUM__) addic r13,0 #endif #ifdef __CMODEL_LARGE__ addic r14,0 addic r15,0 #endif b 3b movi r0, 66 export r0, 0 setup_stack_pointer: #if defined (__CMODEL_SMALL__) movi r14,__stack #elif defined(__CMODEL_MEDIUM__) movi r8,_lo(__stack) movi r9,_hi(__stack) #elif defined(__CMODEL_LARGE__) movi r24,_lo(__stack) movi r25,_hi(__stack) movi r26,_higher(__stack) movi r27,_highest(__stack) #endif movi r0, 67 export r0, 0 setup_frame_pointer: #if defined (__CMODEL_SMALL__) movi r15,0 #elif defined(__CMODEL_MEDIUM__) movi r10,0 movi r11,0 #elif defined(__CMODEL_LARGE__) movi r28,0 movi r29,0 movi r30,0 movi r31,0 #endif movi r0, 68 export r0, 0 enable_interrupts: movi r0,0xff /* wcsr im,r0*/ .byte 0x02 .byte 0xc0 .byte 0x0f seti movi r0, 69 export r0, 0 call main