查看: 3007|回复: 3

[其他] 求救求救……请帮忙看看这个程序……

[复制链接]

该用户从未签到

1

主题

2

帖子

0

新手上路

Rank: 1

积分
0
最后登录
1970-1-1
发表于 2011-11-27 17:48:02 | 显示全部楼层 |阅读模式
各位好,第一次接触单片机……
原来是搞转产的……但是由于人手不足就把我推上去搞程序~~~~(>_Source != 0L || info->Target != 0L || info->Size != 0; ++info)
    __copy_rom_section( (char *)info->Target,(char *)info->Source, info->Size);
       
}
/*
 *    Exit handler called from the exit routine, if your OS needs
 *    to do something special for exit handling just replace this
 *    routines with what the OS needs to do ...
 */
asm __declspec(register_abi) void _ExitProcess(void)
{
 illegal
 rts
}
/*
 *    Routine to clear out blocks of memory should give good
 *    performance regardless of 68k or ColdFire part.
 */
static __declspec(register_abi) void clear_mem(char *dst, unsigned long n)
{
 unsigned long i;
 long *lptr;
 if (n >= 32)
 {
  /* align start address to a 4 byte boundary */
  i = (- (unsigned long) dst) & 3;
  if (i)
  {
   n -= i;
   do
    *dst++ = 0;
   while (--i);
  }
  /* use an unrolled loop to zero out 32byte blocks */
  i = n >> 5;
  if (i)
  {
   lptr = (long *)dst;
   dst += i * 32;
   do
   {
    *lptr++ = 0;
    *lptr++ = 0;
    *lptr++ = 0;
    *lptr++ = 0;
    *lptr++ = 0;
    *lptr++ = 0;
    *lptr++ = 0;
    *lptr++ = 0;
   }
   while (--i);
  }
  i = (n & 31) >> 2;
  /* handle any 4 byte blocks left */
  if (i)
  {
   lptr = (long *)dst;
   dst += i * 4;
   do
    *lptr++ = 0;
   while (--i);
  }
  n &= 3;
 }
 /* handle any byte blocks left */
 if (n)
  do
   *dst++ = 0;
  while (--n);
}
/*
 *    Startup routine for embedded application ...
 */
asm __declspec(register_abi) void _startup(void)
{
 /* disable interrupts */
    move.w        #0x2700,sr
 /* Pre-init SP, in case memory for stack is not valid it should be setup using
    MEMORY_INIT before __initialize_hardware is called
 */
 lea __SP_AFTER_RESET,a7;
    /* initialize memory */
    MEMORY_INIT
 /* initialize any hardware specific issues */
    jsr           __initialize_hardware  
 
 /* setup the stack pointer */
    lea           _SP_INIT,a7
 /* setup A6 dummy stackframe */
    movea.l       #0,a6
    link          a6,#0
 /* setup A5 */
    lea           _SDA_BASE,a5

 /* zero initialize the .bss section */
    lea           _END_BSS, a0
    lea           _START_BSS, a1
    suba.l        a1, a0
    move.l        a0, d0
    beq           __skip_bss__
    lea           _START_BSS, a0
    /* call clear_mem with base pointer in a0 and size in d0 */
    jsr           clear_mem
__skip_bss__:
 /* zero initialize the .sbss section */
    lea           _END_SBSS, a0
    lea           _START_SBSS, a1
    suba.l        a1, a0
    move.l        a0, d0
    beq           __skip_sbss__
    lea           _START_SBSS, a0
    /* call clear_mem with base pointer in a0 and size in d0 */
    jsr           clear_mem
__skip_sbss__:
 /* copy all ROM sections to their RAM locations ... */
#if SUPPORT_ROM_TO_RAM
 /*
  * _S_romp is a null terminated array of
  * typedef struct RomInfo {
     *      unsigned long Source;
     *      unsigned long Target;
     *      unsigned long  Size;
     *  } RomInfo;
     *
     * Watch out if you're rebasing using _PICPID_DELTA
     */
    lea           _S_romp, a0
    move.l        a0, d0
    beq           __skip_rom_copy__           
    jsr           __copy_rom_sections_to_ram
#else
 /*
   * There's a single block to copy from ROM to RAM, perform
   * the copy directly without using the __S_romp structure
   */
    lea           __DATA_RAM, a0
    lea           __DATA_ROM, a1
   
    cmpa          a0,a1
    beq           __skip_rom_copy__
             
    move.l        #__DATA_END, d0
    sub.l         a0, d0
                 
    jsr           __copy_rom_section
#endif
__skip_rom_copy__:
 
 /* call C++ static initializers (__sinit__(void)) */
 jsr     __call_static_initializers
 jsr       __initialize_system
 /* call main(int, char **) */
 pea     __argv
 clr.l    -(sp)    /* clearing a long is ok since it's caller cleanup */
 jsr     main
 addq.l  #8, sp
 
 unlk    a6
 
 /* now call exit(0) to terminate the application */
 clr.l    -(sp)
 jsr     exit
 addq.l  #4, sp
 /* should never reach here but just in case */
 illegal
 rts
 /* exit will never return */
__argv:
    dc.l          0
}
 
我知道答案 目前已有2人回答
回复

使用道具 举报

该用户从未签到

27

主题

418

帖子

0

新手上路

Rank: 1

积分
228
最后登录
1970-1-1
发表于 2011-11-27 23:54:48 | 显示全部楼层

回复:求救求救……请帮忙看看这个程序……

呃,这个代码看不出啥来
回复 支持 反对

使用道具 举报

  • TA的每日心情
    难过
    2021-12-15 16:01
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    305

    主题

    4701

    帖子

    0

    中级会员

    Rank: 3Rank: 3

    积分
    377
    最后登录
    2023-8-16
    发表于 2011-11-28 10:43:48 | 显示全部楼层

    RE:求救求救……请帮忙看看这个程序……

    下面的是启动文件,main这个只是简单的配置了系统时钟,还有应该是有2个灯来显示当前的状态。
    该会员没有填写今日想说内容.
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    6

    主题

    52

    帖子

    0

    注册会员

    Rank: 2

    积分
    172
    最后登录
    1970-1-1
    发表于 2011-11-30 15:17:27 | 显示全部楼层

    RE:求救求救……请帮忙看看这个程序……

    貌似就初始化了个时钟,IO口啥的,看看名称大概了解一下吧,从没整过的看这个还真不容易
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /3 下一条

    Archiver|手机版|小黑屋|恩智浦技术社区

    GMT+8, 2025-7-22 02:34 , Processed in 0.091231 second(s), 24 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.

    快速回复 返回顶部 返回列表