473,809 Members | 2,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mysterious error while compiling device driver

hi all
I am working with linux environment and i compiled device driver
programs using native compiler "gcc".In one of my macro i have these
lines

#if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too low!
#endif

while compiling,it gives error like this
"error : # error HARDIRQ_BITS is too low"

The error doesnt mean any particular type of error.
plz Help me to eliminate this error...

Oct 3 '07 #1
14 1677
yeah wrote:
hi all
I am working with linux environment and i compiled device driver
programs using native compiler "gcc".In one of my macro i have these
lines

#if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too low!
#endif

while compiling,it gives error like this
"error : # error HARDIRQ_BITS is too low"

The error doesnt mean any particular type of error.
plz Help me to eliminate this error...
Whatever the nonstandard macro HARDIRQ_BITS is defined as seems to be to
low, unless your code is lying to you. Defining it to be a large enough
value will make the error message go away. What other behavior that
might introduce is another question.
Oct 3 '07 #2
yeah:
#if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too low!
#endif

The logic seems very strange here. I would have expected:

#if (1u << HARDIRQ_BITS) MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too high!
#endif

while compiling,it gives error like this
"error : # error HARDIRQ_BITS is too low"

The error doesnt mean any particular type of error.
plz Help me to eliminate this error...

Purchase a fully-functional human brain with an intelligence rating
higher than 5. With such a device, I think you'd clearly see that
either:

1: HARDIRQ_BITS is too small
2: MAX_HARDIRQS_PE R_CPU is too big

(...that's assuming your logic is right)

And I'd advocate not to do bitshifting on signed integers, I'd prefer
"1u << ".

Martin

Oct 3 '07 #3
yeah wrote:
hi all
I am working with linux environment and i compiled device driver
programs using native compiler "gcc".In one of my macro i have these
lines

#if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too low!
#endif

while compiling,it gives error like this
"error : # error HARDIRQ_BITS is too low"

The error doesnt mean any particular type of error.
Of course it means a particular type of error. But it's not really one
which we as a newsgroup are particularly well-placed to help you resolve.
plz Help me to eliminate this error...
I'm sure someone will be along to castigate me for this, but to
paraphrase the great Obi-Wan Kenobi "this is not the newsgroup you are
looking for".

In fact it's doubtful that a newsgroup is the right place to look at all.

How about contacting the originator of the code? (I assume you didn't
write it as otherwise you'd know what the error implied).

Alternatively, a brief scan with Google indicates that there's a fair
amount of information about this stuff on the web.
Oct 3 '07 #4
Martin Wells <wa****@eircom. netwrote:
yeah:
>#if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too low!
#endif


The logic seems very strange here. I would have expected:

#if (1u << HARDIRQ_BITS) MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too high!
#endif

That depends on what the rest of the code does. My guess
is that test is to see that HARDIRQ_BITS is large enough to
keep track of all the possible HARDIRQS, in which case the
logic is right.

>
>while compiling,it gives error like this
"error : # error HARDIRQ_BITS is too low"

The error doesnt mean any particular type of error.
plz Help me to eliminate this error...


Purchase a fully-functional human brain with an intelligence rating
higher than 5. With such a device, I think you'd clearly see that
either:

1: HARDIRQ_BITS is too small
2: MAX_HARDIRQS_PE R_CPU is too big

(...that's assuming your logic is right)

And I'd advocate not to do bitshifting on signed integers, I'd prefer
"1u << ".

Martin
--
<Insert your favourite quote here.>
Erik Trulsson
er******@studen t.uu.se
Oct 3 '07 #5
On Oct 3, 1:08 pm, Martin Wells <war...@eircom. netwrote:
yeah:
#if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too low!
#endif

The logic seems very strange here. I would have expected:

#if (1u << HARDIRQ_BITS) MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too high!
#endif
while compiling,it gives error like this
"error : # error HARDIRQ_BITS is too low"
The error doesnt mean any particular type of error.
plz Help me to eliminate this error...

Purchase a fully-functional human brain with an intelligence rating
higher than 5. With such a device, I think you'd clearly see that
either:

1: HARDIRQ_BITS is too small
2: MAX_HARDIRQS_PE R_CPU is too big

(...that's assuming your logic is right)

And I'd advocate not to do bitshifting on signed integers, I'd prefer
"1u << ".

Martin

hi martin:

First understand that the error is not while running but during the
compilation.
So no matter whether the condition is true or false.

thanks

Oct 3 '07 #6
yeah wrote:
On Oct 3, 1:08 pm, Martin Wells <war...@eircom. netwrote:
>yeah:
#if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too low!
#endif

The logic seems very strange here. I would have expected:

#if (1u << HARDIRQ_BITS) MAX_HARDIRQS_PE R_CPU
# error HARDIRQ_BITS is too high!
#endif
while compiling,it gives error like this
"error : # error HARDIRQ_BITS is too low"
The error doesnt mean any particular type of error.
plz Help me to eliminate this error...

Purchase a fully-functional human brain with an intelligence rating
higher than 5. With such a device, I think you'd clearly see that
either:

1: HARDIRQ_BITS is too small
2: MAX_HARDIRQS_PE R_CPU is too big

(...that's assuming your logic is right)

And I'd advocate not to do bitshifting on signed integers, I'd prefer
"1u << ".

hi martin:

First understand that the error is not while running but during the
compilation. So no matter whether the condition is true or false.
Martin perfectly understands the code. It you who is not understanding. A
conforming compiler is required to abort translation when it encounters an
active #error directive.

In the case of this code the conditional following the #if directive
apparently is true, hence the #error directive is selected and hence
translation stops.

Your solution involves understanding exactly what the conditional means,
semantically, and doing what is necessary to prevent the statement from
resolving to true. This involves information specific to your system and
the program in question and we cannot give any answer from the perspective
of Standard C.

Also it's better to supply a string literal to the #error directive than a
sequence of token like you've done above.

Oct 3 '07 #7
yeah:
hi martin:

First understand that the error is not while running but during the
compilation.
So no matter whether the condition is true or false.

thanks

My troll-o-meter is starting to beep a little... but I'll give you one
last try.

If you don't understand the following, then I think you should take up
gardening.

#define ROWS 5
#define COLS 6

#if COLS ROWS
# error "Can't have more columns than rows!"
#endif

This is EXACTLY what's happening in your code.

Martin

Oct 3 '07 #8
santosh said:
A conforming compiler is required to abort translation when it encounters
an active #error directive.
Only in C99. Astonishingly, this is *not* required in C90. (Nevertheless,
C90 compilers are free to stop translation if they wish, and I don't know
of any that don't.)

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 3 '07 #9
On Oct 4, 1:24 am, Richard Heathfield <r...@see.sig.i nvalidwrote:
santosh said:
A conforming compiler is required to abort translation when it encounters
an active #error directive.

Only in C99. Astonishingly, this is *not* required in C90. (Nevertheless,
C90 compilers are free to stop translation if they wish, and I don't know
of any that don't.)
The one I'm using currently reports the #error but then
continues to translate the rest of the file. It does
report a failure code to the caller though, so the 'make'
system stops the build after that.

The command is:
arm-linux-unknown-gnu-gcc-3.4.4 -c -std=c89 -Os -Wall

and a handful of other warnings and CPU-specific code
generation flags.

Oct 3 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
7218
by: Wouter van Ooijen | last post by:
I want to use Python to interface with an USB HID device (not a keyboard or mouse, just something that uses the HID driver to avoid the need for a specific driver). Is this possible in pure Python on Windows, or even better, in a portable way? Wouter van Ooijen -- ------------------------------------ http://www.voti.nl PICmicro chips, programmers, consulting
2
6981
by: nbhalala | last post by:
Hello Friends, Hi Myself Naresh (B.E. Comp. Eng) from Mumbai... I'm a Linux Device Driver Writer... I would like to learn writing Driver of "USB Devices"...BUT before that I'm presently working on "PCI ETHERNET NETWORK ADAPTER (RTL8139)" for that - reading it's Datasheet and trying to write simple backbone Driver BUT for that friend I need your Help... Resources I have/using -
12
13776
by: Steve | last post by:
I wrote a simple virtual device driver int15.sys, Is C# support load the device driver from AP?
8
13254
by: Tony Liu | last post by:
I am having a "Null Device is Missing" compile error when compiling a c++ project. The documentation from MSDN said it could be caused by low system resource or the user account does not have the prillivage. But I am plenty of system resources and I logged in as Admin. Anyone know how to solve this? Thanks in advance
7
4453
by: Ritu | last post by:
Hi All, Can any body please tell me how i can write a device driver using CSharp. Thanks, Ritu
0
1546
by: am | last post by:
Hi, I have an USB hardware device that came with some (poor) software. I would like to write my own software to use the hardware in dotnet. There are no COM dll's to reference from the original software. I have read a lot in newsgroups and everywhere it is stated that "you need a device-driver" - well I got the device-driver (.sys file in windows/system32 folder)
8
74590
by: Pedro Pinto | last post by:
When compiling my program i got this error: Error: 'for' loop initial declaration used outside c99 mode What is it and how can i solve it? Thanks in advance! Regards
1
1828
by: ushasivaram | last post by:
hi, while compiling my build in REDHAT 9 i got the following error saying as: /modules/opensrc/openssl-0.9.8d/ssl sslhttp.c -o ../../../../../modules/system/ENTR-V4/lx/obj/sslhttp.o In file included from sslhttp.c:64: ../../porting/lx/driver/fleet/fleetcmn.h:489:30: warning: crypto/cryptodev.h: No such file or directoryIn file included from sslhttp.c:64: ../../porting/lx/driver/fleet/fleetcmn.h:512: field `d_sess' has incomplete type...
3
1892
by: Rajan Arora | last post by:
Hi, I am trying to get the data out of an instrument through its GPIB port and using python code. I am able to perfectly control the operation of the instrument with my code. But I have not figured out a way as yet to get the data of the GPIB. I thin that it will go through 2 steps: 1) instrument transfers data to its output buffer 2) Read from the output buffer. When i try read() command it gives me an IO timeout error.
0
10635
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10378
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7653
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.