gpt4 book ai didi

u-boot - 如何调试uBoot?

转载 作者:行者123 更新时间:2023-12-04 12:48:56 25 4
gpt4 key购买 nike

我试图让 Uboot 在飞思卡尔 mx28evk 板上运行。它编译得很好并给了我一个图像,我可以将它复制到 SD 卡。

当我打开电路板时,串行调试控制台没有任何输出,甚至没有错误消息。我可以确认该板与卡上的另一个工作图像一起工作正常。

找出导致问题的原因的适当下一步是什么?我可以查找 uBoot 分区上的任何模式或魔数(Magic Number)以确认它是有效的 uBoot?

最佳答案

假设你已经配置了U-Boot版本如u-boot-2013.07mx28evk_config配置并构建了 u-boot.sb使用诸如 arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 之类的工具链的 Makefile 目标,并将目标转换为 .sd文件使用 ./tools/mxsboot sd u-boot.sb u-boot.sd ,那么最可能的问题是您的 PMU 或 SDRAM 配置有误。这些配置中的错误很可能会导致 重置循环 重置发生的地方 在您到达 U-Boot 横幅打印输出之前 .

确保您已按照 the Denx U-Boot doc/README.mx28evk file 中的指定设置了 EVK 开关。 :设置开机模式拨码开关为:

  • 启动模式选择:1 0 0 1(从 SD 卡插槽 0 - U42 启动)
  • JTAG PSWITCH 复位:向右(禁用复位)
  • 电池来源:向下
  • 墙壁 5V:向上
  • VDD 5V:向左(关闭)
  • 按住按钮:向下(关闭)

  • 调试此类问题所需的下一步是输入串行输出 , 在 SPL SRAM 代码中。先把 putc arch/arm/cpu/arm926ejs/mxs/spl_boot.c:mxs_common_spl_init() 中的声明.例如:
    void mxs_common_spl_init(const iomux_cfg_t *iomux_setup,
    const unsigned int iomux_size)
    {
    struct mxs_spl_data *data = (struct mxs_spl_data *)
    ((CONFIG_SYS_TEXT_BASE - sizeof(struct mxs_spl_data)) & ~0xf);

    debug_putc('a');

    uint8_t bootmode = mxs_get_bootmode_index();

    debug_putc('b');

    mxs_iomux_setup_multiple_pads(iomux_setup, iomux_size);

    debug_putc('c');

    mxs_power_init();

    debug_putc('d');

    mxs_mem_init();

    debug_putc('e');

    data->mem_dram_size = mxs_mem_get_size();

    data->boot_mode_idx = bootmode;

    mxs_power_wait_pswitch();
    }
    putc我用于此目的是从飞思卡尔 i.MX28 bootlet 代码中借用的:
    void debug_putc(char ch)
    {
    int loop = 0;
    while (((*(volatile hw_uartdbgfr_t *) ((0x80000000 + 0x74000) + 0x18)).U)&0x00000020)
    {
    loop++;
    if (loop > 10000)
    break;
    };
    ((*(volatile hw_uartdbgdr_t *) ((0x80000000 + 0x74000) + 0x0)).U = (ch));
    }

    您需要的类型是:
    typedef unsigned int   reg32_t;
    typedef unsigned short reg16_t;
    typedef unsigned char reg8_t;

    typedef union
    {
    reg32_t U;
    struct
    {
    unsigned DIV_EMI : 6;
    unsigned RSRVD1 : 2;
    unsigned DIV_XTAL : 4;
    unsigned RSRVD2 : 4;
    unsigned DCC_RESYNC_ENABLE : 1;
    unsigned BUSY_DCC_RESYNC : 1;
    unsigned RSRVD3 : 8;
    unsigned BUSY_SYNC_MODE : 1;
    unsigned BUSY_REF_CPU : 1;
    unsigned BUSY_REF_EMI : 1;
    unsigned BUSY_REF_XTAL : 1;
    unsigned SYNC_MODE_EN : 1;
    unsigned CLKGATE : 1;
    } B;
    } hw_clkctrl_emi_t;

    typedef union
    {
    reg32_t U;
    struct
    {
    unsigned TRG : 5;
    unsigned RSRVD1 : 3;
    unsigned BO_OFFSET : 3;
    unsigned RSRVD2 : 1;
    unsigned LINREG_OFFSET : 2;
    unsigned RSRVD3 : 2;
    unsigned DISABLE_FET : 1;
    unsigned ENABLE_LINREG : 1;
    unsigned DISABLE_STEPPING : 1;
    unsigned PWDN_BRNOUT : 1;
    unsigned RSRVD4 : 12;
    } B;
    } hw_power_vddactrl_t;


    typedef union
    {
    reg32_t U;
    struct
    {
    reg8_t DATA;
    unsigned FE : 1;
    unsigned PE : 1;
    unsigned BE : 1;
    unsigned OE : 1;
    unsigned RESERVED : 4;
    reg16_t UNAVAILABLE;
    } B;
    } hw_uartdbgdr_t;

    typedef union
    {
    reg32_t U;
    struct
    {
    unsigned CTS : 1;
    unsigned DSR : 1;
    unsigned DCD : 1;
    unsigned BUSY : 1;
    unsigned RXFE : 1;
    unsigned TXFF : 1;
    unsigned RXFF : 1;
    unsigned TXFE : 1;
    unsigned RI : 1;
    unsigned RESERVED : 7;
    reg16_t UNAVAILABLE;
    } B;
    } hw_uartdbgfr_t;

    void debug_putc(char c);

    我把类型放在 arch/arm/cpu/arm926ejs/mxs/mxs_init.hputcspl_boot.c 中实现.我也倾向于放很多 putc spl_power_init.c 中的声明和 spl_mem_init.c .

    请注意 PMU 编程错误 spl_power_init.c可能会导致重置,该重置只会在您到达 spl_mem_init.c 后才会显示。 .不要让这个假冒你出来。

    关于u-boot - 如何调试uBoot?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10649536/

    25 4 0