⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 start12.c

📁 ucos-ii for gcc-elf-68k
💻 C
字号:
/*****************************************************
      start12.c - standard startup code
   The startup code may be optimized to special user requests
 ----------------------------------------------------
   Copyright (c) Metrowerks, Basel, Switzerland
               All rights reserved
                  Do not modify!

Note: ROM libraries are not implemented in this startup code
Note: C++ destructors of global objects are NOT yet supported in the HIWARE Object File Format.
      To use this feature, please build your application with the ELF object file format.
 *****************************************************/

#include <hidef.h>
#include <start12.h>
#include <uCOSV270.h>

/* Macros to control how the startup code handles the COP: */
/* #define _DO_FEED_COP_  : do feed the COP  */
/* #define _DO_ENABLE_COP_: do enable the COP  */
/* #define _DO_DISABLE_COP_: disable the COP */
/* Without defining any of these, the startup code does NOT handle the COP */

#pragma DATA_SEG __NEAR_SEG STARTUP_DATA /* _startupData can be accessed using 16 bit accesses. This is needed because it contains the stack top, and without stack, far data cannot be accessed */
//struct _tagStartup _startupData;  /*   read-only: */
                                  /*   _startupData is allocated in ROM and */
                                  /*   initialized by the linker */

#ifdef _HCS12_SERIALMON
      /* for Monitor based software remap the RAM & EEPROM to adhere
         to EB386. Edit RAM and EEPROM sections in PRM file to match these. */
#define ___INITRM      (*(volatile unsigned char *) 0x0010)
#define ___INITRG      (*(volatile unsigned char *) 0x0011)
#define ___INITEE      (*(volatile unsigned char *) 0x0012)
#endif


#ifdef __cplusplus
  extern "C"
#endif

/* The function _Startup must be called in order to initialize global variables and to call main */
/* You can adapt this function or call it from your startup code to implement a different startup */
/* functionality. */

/* You should also setup the needed IO registers as WINDEF (HC12A4 only) or the COP registers to run */
/* on hardware */

/* to set the reset vector several ways are possible : */
/* 1. define the function with "interrupt 0" as done below in the first case */
/* 2. add the following line to your prm file : VECTOR ADDRESS 0xfffe _Startup */
/* of course, even more posibilities exists */
/* the reset vector must be set so that the application has a defined entry point */

#define STARTUP_FLAGS_NOT_INIT_SP   (1<<1)

void _Startup(void) {

/*  purpose:    1)  initialize the stack
                2)  initialize the RAM, copy down init data etc (Init)
                3)  call main;
    parameters: NONE
    called from: _PRESTART-code generated by the Linker 
                 or directly referenced by the reset vector */
  INIT_SP_FROM_STARTUP_DESC();
  for(;;)
  	{
  	asm("jsr main");	//main() address
     } /* end loop forever */
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -