spot the bug

A place to discuss software and code that isn't automotive related. Free and open source preferred but not compulsory.
Post Reply
User avatar
EssEss
LQFP112 - Up with the play
Posts: 244
Joined: Thu Sep 10, 2009 9:23 am
Location: Dayton, OH

spot the bug

Post by EssEss »

Code: Select all

// @warning rolls may occur
static inline void atomic_inc( atomic_t *pValue )
{
  unsigned long msr = atomic_start();
  *pValue++;
  atomic_end( msr );
}
if you need a hint, I think -wall in gcc may give that to you (not tested, simply a guess).

this stands as a good example of why you need to turn on all warnings and turn them into errors
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: spot the bug

Post by Fred »

Yep, I fixed a bug in the throttle control code here yesterday by irradicating all the warnings. float cast to unsigned int. correct procedure is to signed int, then unsigned as this is defined. thing works much more smoothly now.

I'm sorry, but I can't read the above code at all. It is incrementing a pointer, though, not the value pointed to, I guess that is the issue? I hate typedefs...
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
EssEss
LQFP112 - Up with the play
Posts: 244
Joined: Thu Sep 10, 2009 9:23 am
Location: Dayton, OH

Re: spot the bug

Post by EssEss »

yep - thats it
User avatar
SleepyKeys
LQFP144 - On Top Of The Game
Posts: 549
Joined: Mon Feb 11, 2008 10:52 pm
Location: Arizona
Contact:

Re: spot the bug

Post by SleepyKeys »

Yep, I have been using that option while coding binutils.
You snooze, you lose!
Huer
DIP8 - Involved
Posts: 27
Joined: Mon Feb 18, 2019 4:54 pm

Re: spot the bug

Post by Huer »

I don't like typedef's either. One of the things that irritates me with the arduino ide. Which brings something I have been thinking about. What is everyone's ide of choice? I like Keil but it doesn't support a lot of stuff. Eclipse and atmel studio are cool, but I kinda don't like VS.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: spot the bug

Post by Fred »

Eclipse for C work on this stuff, though it has been a while. Mostly in Vim recently.

VSCode is pretty decent, amazingly, considering it's from M$ :-D
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Huer
DIP8 - Involved
Posts: 27
Joined: Mon Feb 18, 2019 4:54 pm

Re: spot the bug

Post by Huer »

I installed that. Takes a while to load but looks nice. I haven't played with it too much. Out of all of them the goofy Arduino IDE seems to load up the fastest, even though it's java hell.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: spot the bug

Post by Fred »

For me, an IDE taking a while to start and burning some RAM isn't a big deal as long as it does good things and is reasonably responsive when you're in it and using it *all day*. Not sure about C in VSCode but someone probably did something for it. Maybe I should give it a whirl, but the C stuff in eclipse is GREAT and I can say that with a decade of CDT experience.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Huer
DIP8 - Involved
Posts: 27
Joined: Mon Feb 18, 2019 4:54 pm

Re: spot the bug

Post by Huer »

I'm still IDE hunting. I'm looking for something that is good for old microcontrollers.. Like I have this old Ford EEC-IV brain with an intel 8061 mpu. I can't even find a real datasheet for it. I like this old stuff and want to play with it, but none of my toys do it. If I was doing IOT stuff, everything would be easy.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: spot the bug

Post by Fred »

IDEs support languages, not tools. Tools support CPUs, and variants of them. If you can find a command line tool to do C or ASM for that CPU then you should be able to make eclipse CDT work with it, AFAIK.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Post Reply