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

📄 startup.c

📁 wince 6 r2 bsp template
💻 C
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
#include <windows.h>

#if defined (x86)
// x86 kernel defines its entry point as KernelInitialize
extern void KernelInitialize();
#else
extern void KernelStart();
#endif

#if defined (SHx)
// SH kernel defines its entry point as KernelStart without C-style linkage
// So here we mirror it as an assembly-style call
#pragma comment(linker, "/ALTERNATENAME:_KernelStart=KernelStart")
#endif


#if defined (x86) || defined (ARM)
// ---------------------------------------------------------------------------
// OEMAddressTable: REQUIRED for x86 and ARM, UNUSED for other CPUs
//
// OEMAddressTable defines a table that maps a 4 GB physical address space
// to the kernel's 512-MB uncached virtual address space for a device. Each
// entry in the table consists of the virtual base address to map to, the
// physical base address to map from, and the number (size) of bytes to map.
// For x86, the size is defined in bytes.  For ARM, the size is defined in
// MegaBytes. An entry of all zeroes is the required terminator for the
// OEMAddressTable.
//
// Because OEMAddressTable is part of the lowest level of initialization
// before the MMU is initialized, it is typically implemented in assembly
// code.  It is common for OEMAddressTable to be implemented in an assembly
// file such as startup.s or oemaddrtab_cfg.inc.  You should replace this
// file with such a file and modify the SOURCES file in this directory to
// match.

struct OEMAddressTableEntry {
  DWORD virtualAddressStart;
  DWORD physicalAddressStart;
  DWORD size;
} OEMAddressTable[] = {

#if defined(x86)
  // Map virtual addresses starting at 2 GB,
  // To physical addresses starting at 0,
  // Set the size to 64 MB (we map 64MB worth of addresses),
  0x80000000, 0, 0x04000000,

#elif defined(ARM)
  // Map virtual addresses starting at 2 GB,
  // To physical addresses starting at 0,
  // Set the size to 64 MB (we map 64MB worth of addresses),
  0x80000000, 0, 64,

#endif

  //Terminate the OEMAddress Table with an entry of all 0's.
  0, 0, 0
};

#endif

// ---------------------------------------------------------------------------
// StartUp: REQUIRED
//
// This function is the first function that is called in Windows CE after the
// bootloader runs.  It is the entry point of oal.exe (also known as nk.exe),
// which is the kernel process.  Traditionally it is named StartUp, but its
// name can be changed provided it matches the EXEENTRY in the SOURCES file
// where oal.exe is linked.
// 
// This function is repsonsible for performing hardware initialization of the
// CPU, memory controller, clocks, serial port, and caches / TLBs.  For ARM
// and x86 CPUs it is responsible for loading the OEMAddressTable into memory
// for use by the KernelStart function.
//
// Because StartUp implements the lowest level of initialization before the
// MMU is initialized, it is typically implemented in assembly code.  It is
// common for StartUp to be implemented in an assembly file such as startup.s
// or startup.asm.  You should replace this file with such a file and modify
// the SOURCES file in this directory to match.
//
void StartUp(void)
{
  // replace this file with assembly code that jumps to KernelStart
#if defined (x86)
  KernelInitialize();
#else
  KernelStart();
#endif
}

⌨️ 快捷键说明

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