`用于RTEMS驱动程序定义中的阵列设置的初始化程序太多(`Too many initializers` for for array setup in RTEMS driver definition)

编程入门 行业动态 更新时间:2024-10-11 03:16:05
`用于RTEMS驱动程序定义中的阵列设置的初始化程序太多(`Too many initializers` for for array setup in RTEMS driver definition)

背景

我正在使用RTEMS并尝试设置本机NFS客户端。 虽然我已正确包含此功能,但驱动程序没有足够的动态驱动程序条目。 您可以在此处查找更多信息。

履行

为了设置额外的动态驱动程序,需要将NULL元素添加到大型免费驱动程序表中。 请参阅以下内容:

#define NULL_DRIVER_TABLE_ENTRY \ { NULL, NULL, NULL, NULL, NULL, NULL} #ifdef CONFIGURE_INIT rtems_driver_address_table Device_drivers[] = { #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS CONFIGURE_BSP_PREREQUISITE_DRIVERS, #endif #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS, #endif ... #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS CONFIGURE_APPLICATION_EXTRA_DRIVERS, #endif #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER NULL_DRIVER_TABLE_ENTRY #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \ !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS) NULL_DRIVER_TABLE_ENTRY #endif }; #endif

问题

可能非常简单的问题是,当我构建这个时,我得到以下错误:

confdefs.h:568: error: too many initializers for 'rtems_driver_address_table'

Background

I am using RTEMS and trying to set up a native NFS client. Although i have included this correctly there are not enough dynamic driver entries available for the Driver. You can seek more information here.

Implementation

In order to set up the extra dynamic drivers one needs to add NULL elements to a large table of free drivers. See the following:

#define NULL_DRIVER_TABLE_ENTRY \ { NULL, NULL, NULL, NULL, NULL, NULL} #ifdef CONFIGURE_INIT rtems_driver_address_table Device_drivers[] = { #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS CONFIGURE_BSP_PREREQUISITE_DRIVERS, #endif #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS, #endif ... #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS CONFIGURE_APPLICATION_EXTRA_DRIVERS, #endif #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER NULL_DRIVER_TABLE_ENTRY #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \ !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \ !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS) NULL_DRIVER_TABLE_ENTRY #endif }; #endif

Problem

The problem which may be exceptionally simple is that when i build this i get the following error:

confdefs.h:568: error: too many initializers for 'rtems_driver_address_table'

From looking here this appears to be a problem compiling with an unspecified number of table elements. What I don't understand is that this is currently working in that if I specify the NULL_DRIVER_TABLE_ENTRY with 7 NULLs (the number i need), it will fail, but with 6 NULLs it works perfectly fine?

As far as i can tell there is no definition as to the size of this table or its elements? Any ideas?

最满意答案

所以这是一个愚蠢的错误......

这个表的工作方式是NULL表项:

#define NULL_DRIVER_TABLE_ENTRY \ { NULL, NULL, NULL, NULL, NULL, NULL}

实际上是数组中与rtems_driver_address_table对应的rtems_driver_address_table 。 这个驱动程序有6个元素,我试图有7.这个解决方案是添加一个额外的空条目,如下所示:

rtems_driver_address_table Device_drivers[] = { ... #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER NULL_DRIVER_TABLE_ENTRY, NULL_DRIVER_TABLE_ENTRY // Add extra entry here! ... };

So this was a silly mistake...

The way this table works is that the NULL table entry:

#define NULL_DRIVER_TABLE_ENTRY \ { NULL, NULL, NULL, NULL, NULL, NULL}

Is actually an entry in the array which corresponds to an rtems_driver_address_table. This driver has 6 elements and i was trying to have 7. The solution to this was to add an extra null entry as follows:

rtems_driver_address_table Device_drivers[] = { ... #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER NULL_DRIVER_TABLE_ENTRY, NULL_DRIVER_TABLE_ENTRY // Add extra entry here! ... };

更多推荐

本文发布于:2023-08-08 01:19:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466660.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:太多   阵列   初始化   驱动程序   定义

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!