zoukankan      html  css  js  c++  java
  • 在Main函数之前发生的事 ZEDBOARD,ZYNQ7000

    What happened before running into main function on zedboard?

    Use the zedboard hardware platform to create a Xilinx project and named it print_demo as shown following:

    Look into the main function, nothing has been done in the init_platform() function.

    Where is the uart init invoking in such a complexing hardware driver files?

    Under the project explorer view, select the print_demo_bsp>ps7_cortexa9_0>libsrc>standalone_v3_08_a>src>asm_vectors.s

    Double click to read the contents of asm_vectors.s:

    .section .vectors

    _vector_table:

    B    _boot

    B    Undefined

    B    SVCHandler

    B    PrefetchAbortHandler

    B    DataAbortHandler

    NOP    /* Placeholder for address exception vector*/

    B    IRQHandler

    B    FIQHandler

    _vector_table locates the exception entry point, and the cortex a9 processor execute the first sentence B    _boot

    New we go to the definition of _boot (boot.S):

    /* this initializes the various processor modes */

     

    _prestart:

    _boot:

    #if XPAR_CPU_ID==0

    /* only allow cpu0 through */

        mrc    p15,0,r1,c0,c0,5

        and    r1, r1, #0xf

        cmp    r1, #0

        beq    OKToRun

    EndlessLoop0:

        wfe

        b    EndlessLoop0

     

    #elif XPAR_CPU_ID==1

    /* only allow cpu1 through */

        mrc    p15,0,r1,c0,c0,5

        and    r1, r1, #0xf

        cmp    r1, #1

        beq    OKToRun

    EndlessLoop1:

        wfe

        b    EndlessLoop1

    #endif

     

    The label OKToRun located in the same file:

    OKToRun:

        /* set VBAR to the _vector_table address in linker script */

        ldr    r0, =vector_base

        mcr    p15, 0, r0, c12, c0, 0

        …    …

        b    _start                /* jump to C startup code */

        and    r0, r0, r0                /* no op */

     

    _start label located in the xil_crt0.S :

    start:

        bl __cpu_init        /* Initialize the CPU first (BSP provides this) */

        mov    r0, #0

        …    …

        /* Initialize STDOUT */

        bl    Init_Uart

        …    …

        /* Let her rip */

        bl    main

    We have noticed that the bsp program run the Init_Uart before going into main function.

    The Init_Uart function locates in the uart.c file:

    #define UART_BAUDRATE    115200

    Buadrate is determined by the macro. Change it to 9600 if 9600 baudrate is desired.

    NOTICE: ANY change in those files locate in the bsp project>ps7_cortexa9_0 will be ignored as the contents will regenerate once building the project. If need to re-invode the init_uart function again in the main function to make a change.

  • 相关阅读:
    php底层HashTable的实现
    【问底】徐汉彬:PHP7和HHVM的性能之争
    linux查找系统中占用磁盘空间最大的文件
    深入理解Yii2.0(yii学习的经典博客)
    梦想天空(关注前端开发技术 html5+css3)
    风雪之隅(Laruence PHP开发组成员, Zend兼职顾问, Yaf, Yar, Yac, Opcache等项目作者、维护者.)
    阿里云收集服务器性能指标的python脚本
    简单5步,释放Mac磁盘空间
    我是如何自学Android,资料分享(2015 版)
    查询tensorflow中的函数用法
  • 原文地址:https://www.cnblogs.com/dragen/p/3116742.html
Copyright © 2011-2022 走看看