;/********************************************************************************************************************** ; * DISCLAIMER ; * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No ; * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all ; * applicable laws, including copyright laws. ; * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING ; * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, ; * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM ; * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES ; * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO ; * THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ; * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of ; * this software. By using this software, you agree to the additional terms and conditions found by accessing the ; * following link: ; * http://www.renesas.com/disclaimer ; * ; * Copyright (C) 2020, 2021 Renesas Electronics Corporation. All rights reserved. ; *********************************************************************************************************************/ ; NOTE : THIS IS A TYPICAL EXAMPLE. ; DATE : Wed, Sep 08, 2021 ;----------------------------------------------------------------------------- ; system stack ;----------------------------------------------------------------------------- STACKSIZE .set 0x200 .section ".stack.bss", bss .align 4 .ds (STACKSIZE) .align 4 _stacktop: ;----------------------------------------------------------------------------- ; section initialize table ;----------------------------------------------------------------------------- .section ".INIT_DSEC.const", const .align 4 .dw #__s.data, #__e.data, #__s.data.R .section ".INIT_BSEC.const", const .align 4 .dw #__s.bss, #__e.bss ;----------------------------------------------------------------------------- ; startup ;----------------------------------------------------------------------------- .section ".text", text .public __cstart .align 2 __cstart: mov #_stacktop, sp ; set sp register mov #__gp_data, gp ; set gp register mov #__ep_data, ep ; set ep register mov #__s.INIT_DSEC.const, r6 mov #__e.INIT_DSEC.const, r7 mov #__s.INIT_BSEC.const, r8 mov #__e.INIT_BSEC.const, r9 jarl32 __INITSCT_RH, lp ; initialize RAM area ; enable FPU $if 1 ; disable this block when not using FPU stsr 6, r10, 1 ; r10 <- PID shl 21, r10 shr 30, r10 bz .L1 ; detecting FPU stsr 5, r10, 0 ; r10 <- PSW movhi 0x0001, r0, r11 or r11, r10 ldsr r10, 5, 0 ; enable FPU movhi 0x0002, r0, r11 ldsr r11, 6, 0 ; initialize FPSR ldsr r0, 7, 0 ; initialize FPEPC .L1: $endif ; set various flags to PSW via FEPSW stsr 5, r10, 0 ; r10 <- PSW ;xori 0x0020, r10, r10 ; enable interrupt ;movhi 0x4000, r0, r11 ;or r11, r10 ; supervisor mode -> user mode ldsr r10, 3, 0 ; FEPSW <- r10 mov #_exit, lp ; lp <- #_exit mov #_main, r10 ldsr r10, 2, 0 ; FEPC <- #_main ; apply PSW and PC to start user mode feret _exit: br _exit ; end of program ;----------------------------------------------------------------------------- ; dummy section ;----------------------------------------------------------------------------- .section ".data", data .L.dummy.data: .section ".bss", bss .L.dummy.bss: .section ".const", const .L.dummy.const: .section ".text", text .L.dummy.text: ;-------------------- end of start up module -------------------;