.include "/usr/local/toolchain/unilib/r8c/include/r5f2136cy.inc" .text .global _start .type _start, @function _start: fclr i ;disable interrupts ldc #_stack, sp mov.b #0x0b, PRCR ;protection mode register mov.b #0x01, FRA0 ; enable HS OSC nop nop nop nop mov.b #0x03, FRA0 ; switch to HS OSC .ifdef CM4 mov.b #0x05, CM4 ; select HS OSC .endif .ifdef PMCSEL mov.b #PMCSEL_EN, PMCSEL ; select comm pin layout .endif mov.w #__data_image,a0 mov.w #__data_section_start,a1 mov.w #__data_section_size,r1 _cpy_data: cmp.w #0,r1 jeq _cpy_data_e mov.b [a0],r0l mov.b r0l,[a1] add.w #1,a0 add.w #1,a1 sub.w #1,r1 jmp.b _cpy_data _cpy_data_e: mov.w #__bss_start,a0 mov.w #__bss_size,r0 _clr_bss: cmp.w #0,r0 jeq _clr_bss_e mov.b #0,[a0] add.w #1,a0 sub.w #1,r0 jmp.b _clr_bss _clr_bss_e: ; mov.b #1,PD3 ; set green LED for debug ; mov.b #1,PORT3 jsr.w _main ; go to main in main.c _fatal: jmp.b _fatal