3586|0

2

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

你问我答——求助:SoCFPGA例子时候遇到的问题。 [复制链接]

例子:Altera-SoCFPGA-HardwareLib-GNU  
ALT_STATUS_CODE test_config_full(void)
{
    // Verify the MSELs are appropriate for the type of image we're using.
    ALT_FPGA_CFG_MODE_t mode = alt_fpga_cfg_mode_get();
    switch (mode)
    {
    case ALT_FPGA_CFG_MODE_PP32_FAST_AESOPT_DC:
    case ALT_FPGA_CFG_MODE_PP32_SLOW_AESOPT_DC:
    case ALT_FPGA_CFG_MODE_PP16_FAST_AESOPT_DC:
    case ALT_FPGA_CFG_MODE_PP16_SLOW_AESOPT_DC:
        printf("INFO: MSEL configured correctly for FPGA image.\n");
        break;
    default:
        printf("ERROR: Incompatible MSEL mode set. Cannot continue with FPGA programming.\n");
        return ALT_E_ERROR;
    }

    // This is the symbol name for the SOF file contents linked in.
    extern char _binary_soc_system_dc_rbf_start;
    extern char _binary_soc_system_dc_rbf_end;


    // Use the above symbols to extract the FPGA image information.
    const char *   fpga_image      = &_binary_soc_system_dc_rbf_start;
    const uint32_t fpga_image_size = &_binary_soc_system_dc_rbf_end - &_binary_soc_system_dc_rbf_start;

    // Trace the FPGA image information.
    printf("INFO: FPGA Image binary at %p.\n", fpga_image);
    printf("INFO: FPGA Image size is %u bytes.\n", (unsigned int)fpga_image_size);

    // Try the full configuration a few times.
    const uint32_t full_config_retry = 5;
    for (uint32_t i = 0; i < full_config_retry; ++i)
    {
        ALT_STATUS_CODE status;
        status = alt_fpga_configure(fpga_image, fpga_image_size);
        if (status == ALT_E_SUCCESS)
        {
            printf("INFO: alt_fpga_configure() successful on the %u of %u retry(s).\n",
                   (unsigned int)(i + 1),
                   (unsigned int)full_config_retry);
            return ALT_E_SUCCESS;
        }
    }

    printf("ERROR: FPGA failed to program after %u attempt(s).\n", (unsigned int)full_config_retry);

    return ALT_E_ERROR;
}


请问:红色部分代码是如何实现与FPGA的代码链接的?
是不是这样链接了后,在C语言中,就可以直接调用FPGA端的程序了?
此帖出自FPGA/CPLD论坛
点赞 关注
 

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表