<code id='2fj7k'><strong id='2fj7k'></strong></code>

    <i id='2fj7k'><div id='2fj7k'><ins id='2fj7k'></ins></div></i>
      1. <tr id='2fj7k'><strong id='2fj7k'></strong><small id='2fj7k'></small><button id='2fj7k'></button><li id='2fj7k'><noscript id='2fj7k'><big id='2fj7k'></big><dt id='2fj7k'></dt></noscript></li></tr><ol id='2fj7k'><table id='2fj7k'><blockquote id='2fj7k'><tbody id='2fj7k'></tbody></blockquote></table></ol><u id='2fj7k'></u><kbd id='2fj7k'><kbd id='2fj7k'></kbd></kbd>
      2. <i id='2fj7k'></i>

      3. <fieldset id='2fj7k'></fieldset>
        <acronym id='2fj7k'><em id='2fj7k'></em><td id='2fj7k'><div id='2fj7k'></div></td></acronym><address id='2fj7k'><big id='2fj7k'><big id='2fj7k'></big><legend id='2fj7k'></legend></big></address>

          <span id='2fj7k'></span>

          <dl id='2fj7k'></dl>

          <ins id='2fj7k'></ins>

          Uboot对非Linux kernel的引导

          • 时间:
          • 浏览:11
          • 来源:124软件资讯网


            实现了uboot对非linux kernel的指导 。虽然有一个IH_TYPE_STANDALONE ,可是没有实现  。nnd.只能自己想措施 。实现详细见下面  。

            1、两个下令

            set bootcmd tftp 84000000 uImage\;bootm 84000000

            set bootdelay 1

            2、非linux kernel的指导实现要领:

            一共三个函数: jump ,selectboot 和 system_boot

            把jump放在需要跳转的地方 ,参数就是要跳转的地址 。然后返回 ,重启系统  。select放在main的开头  。通过判断ram的特定地址的特定信息实现跳转  。

            system_boot实现系统的重新启动

            #define FDMA_SRAM_TOP_ADDRESS 0xB9229800
            #define MAGIC_NUM 0x71097100
            #define DEAD_PATTERN 0xBAD0BADF
            #define ST40_CPG_REGS_BASE 0xFFC00000#define
            ST40_CPG_WTCNT (ST40_CPG_REGS_BASE + 0x08)
            #define ST40_CPG_WTCSR (ST40_CPG_REGS_BASE + 0x0C)
            #define ST40_CPG_WTCSR2 (ST40_CPG_REGS_BASE + 0x1C)
            void Jump(unsigned int address)
            {
            STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*1, MAGIC_NUM);
            STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*2, address);
            STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*3, ~address);
            STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*4, ~MAGIC_NUM);
            STSYS_WriteRegDev16LE(ST40_CPG_WTCNT, 0x5AF0);
            STSYS_WriteRegDev16LE(ST40_CPG_WTCSR, 0xA547);
            STSYS_WriteRegDev16LE(ST40_CPG_WTCSR2, 0xAA00);
            STSYS_WriteRegDev16LE(ST40_CPG_WTCSR, 0xA5C7); for(;;);
            }
            void SelectBoot(void)
            {
            unsigned int MagicNum = 0;
            unsigned int NotMagicNum = 0;
            unsigned int JumpAddress = 0;
            unsigned int NotJumpAddress = 0; void (*entry)(void);
            //if((STSYS_ReadRegDev16LE(ST40_CPG_WTCSR2) & 0xFF) != 0x0)
            {
            MagicNum = STSYS_ReadRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*1);
            JumpAddress = STSYS_ReadRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*2);
            NotJumpAddress = STSYS_ReadRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*3);
            NotMagicNum = STSYS_ReadRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*4);
            if((MagicNum == MAGIC_NUM)
            && (MagicNum == (~NotMagicNum))
            && (JumpAddress == (~NotJumpAddress)))
            {
            entry = (void (*)(void))JumpAddress;
            STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*1, DEAD_PATTERN);
            STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*2, DEAD_PATTERN);
            STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*3, DEAD_PATTERN);
            STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS - 4*4, DEAD_PATTERN);
            #if 0
            STSYS_WriteRegDev16LE(ST40_CPG_WTCNT, 0x5AF0);
            STSYS_WriteRegDev16LE(ST40_CPG_WTCSR, 0xA543);
            STSYS_WriteRegDev16LE(ST40_CPG_WTCSR2, 0xAA01);
            STSYS_WriteRegDev16LE(ST40_CPG_WTCSR, 0xA5C7);
            #endif entry(); while(1);
            }
            }
            }void system_reboot(void)
            {
            ulong sr;
            asm ("stc sr, %0":"=r" (sr));
            sr |= (1 << 28);
            asm ("ldc %0, sr": :"r" (sr));
            asm volatile ("trapa #0");
            }