This is the companion page to the Bugs & Suggestions forum. The aim of this page is to provide a useful way to track the status of bugs/suggestions once they have been generally accepted as valid.
To add your vote to get a suggestion implemented or a bug fixed, edit this page and add
<<user YOURUSERNAME>>
to the last column. To add a bug/suggestion, it is a good idea to first post in the Bugs & Suggestions forum, to make sure that a bug for example is a confirmed problem.
Thanks for pointing that out, that's really really dumb. (Not mbeds's fault but the standard is the standard.)
It also means that the secs range comment is also wrong because it ranges from (0-60 with 60 = leap second).
I hope everyone had great April Fools' day!
Thanks for pointing that out, that's really really dumb. (Not mbeds's fault but the standard is the standard.)
It also means that the secs range comment is also wrong because it ranges from (0-60 with 60 = leap second).
I hope everyone had great April Fools' day!
I got this error message everytime i try to open any one of the programs drop down menu from the compiler tab.
Appreciate the help.
I got this error message everytime i try to open any one of the programs drop down menu from the compiler tab.
{{/media/uploads/stunner08/mbedissue.jpg}} Appreciate the help.
Did you try to disable ie plugins? In theast i had similar problems with a divx plugin that inserted code into every page i opened. Disabling this plugin fixed it.
wvd_vegt
hi,
Did you try to disable ie plugins? In theast i had similar problems with a divx plugin that inserted code into every page i opened. Disabling this plugin fixed it.
wvd_vegt
Hello,
I'm pretty sure I've found a bug with the compiler that is changing a valid "while" loop to a "while(1)" and thus freezing a program.
#include "mbed.h"
Serial pc(USBTX, USBRX);
// A class which contains a timeout
class SomeClassWithTimeOut {
public:
// Constructor sets the timeout period
SomeClassWithTimeOut(int tPeriod) : _tPeriod(tPeriod) {
};
// Start the timer and wait for the interupt
void StartTimer(void) {
int i = 0;
tFinished = false;
t.attach(this, &SomeClassWithTimeOut::tTimedOut, _tPeriod);
// ****THE COMPILER APPEARS TO CHANGE THE NEXT LINE TO while(1)****
// ****AS THE LOOP IS NEVER BROKEN......***************************
while (!tFinished) {
// Wait for timeout
// ****....UNLESS THE FOLLOWING pc.printf(""); LINE IS INSERTED****
// pc.printf("");
// ****BIZARRE!****************************************************
i++;
}
pc.printf("%i\n", i);
};
// The timeout has finished so set tFinished
void tTimedOut(void) {
tFinished = true;
pc.printf("Timed Out!\n");
};
// Boolean to indicate whether a timeout has finished
bool tFinished;
protected:
// Timeout period
int _tPeriod;
// Timeout
Timeout t;
};
int main() {
// New instance of class with timeout period of 1 second
SomeClassWithTimeOut t1(1);
// Counter used to count timeouts
int t1Counter = 0;
while (1) {
// Reset flag and start timeout
t1.StartTimer();
// Increment timeout counter
t1Counter++;
pc.printf("The timer has timed out %i times\n", t1Counter);
}
}
The program gets stuck in the while loop on line 18. I know that the variable tFinished is set to 1 as the pc.printf("Timed Out\n") message appears on the terminal.
The really strange thing is that if I un-comment the printf command on line 21, the program runs perfectly. It seems like the compiler messes with the while loop unless the printf command is in there.
Any suggestions?
Hello,
I'm pretty sure I've found a bug with the compiler that is changing a valid "while" loop to a "while(1)" and thus freezing a program.
<<code>>
#include "mbed.h"
Serial pc(USBTX, USBRX);
// A class which contains a timeout
class SomeClassWithTimeOut {
public:
// Constructor sets the timeout period
SomeClassWithTimeOut(int tPeriod) : _tPeriod(tPeriod) {
};
// Start the timer and wait for the interupt
void StartTimer(void) {
int i = 0;
tFinished = false;
t.attach(this, &SomeClassWithTimeOut::tTimedOut, _tPeriod);
// ****THE COMPILER APPEARS TO CHANGE THE NEXT LINE TO while(1)****
// ****AS THE LOOP IS NEVER BROKEN......***************************
while (!tFinished) {
// Wait for timeout
// ****....UNLESS THE FOLLOWING pc.printf(""); LINE IS INSERTED****
// pc.printf("");
// ****BIZARRE!****************************************************
i++;
}
pc.printf("%i\n", i);
};
// The timeout has finished so set tFinished
void tTimedOut(void) {
tFinished = true;
pc.printf("Timed Out!\n");
};
// Boolean to indicate whether a timeout has finished
bool tFinished;
protected:
// Timeout period
int _tPeriod;
// Timeout
Timeout t;
};
int main() {
// New instance of class with timeout period of 1 second
SomeClassWithTimeOut t1(1);
// Counter used to count timeouts
int t1Counter = 0;
while (1) {
// Reset flag and start timeout
t1.StartTimer();
// Increment timeout counter
t1Counter++;
pc.printf("The timer has timed out %i times\n", t1Counter);
}
}
<</code>>
The program gets stuck in the while loop on line 18. I know that the variable tFinished is set to 1 as the pc.printf("Timed Out\n") message appears on the terminal.
The really strange thing is that if I un-comment the printf command on line 21, the program runs perfectly. It seems like the compiler messes with the while loop unless the printf command is in there.
Any suggestions?
I know that the variable tFinished is set to 1 as the pc.printf("Timed Out\n") message appears on the terminal.
The really strange thing is that if I un-comment the printf command on line 21, the program runs perfectly. It seems like the compiler messes with the while loop unless the printf command is in there.
Any suggestions?
All the C compilers would optimize this source code in the same way. When a variable can be modified by an external Thread/ISR you should specifically tell the compiler to not optimize it through the volatile keyword:
Edit: Thank you Andy, I was slow editing my answer... ;-)
<<quote timbobazza>>
I know that the variable tFinished is set to 1 as the pc.printf("Timed Out\n") message appears on the terminal.
The really strange thing is that if I un-comment the printf command on line 21, the program runs perfectly. It seems like the compiler messes with the while loop unless the printf command is in there.
Any suggestions?
<</quote>>
All the C compilers would optimize this source code in the same way. When a variable can be modified by an external Thread/ISR you should specifically tell the compiler to not optimize it through the ##volatile## keyword:
<<code>>
volatile bool tFinished;
<</code>>
For more information you can read the [[http://en.wikipedia.org/wiki/Volatile_variable|wikipedia volatile entry]].
HTH,
Emilio
Edit: Thank you Andy, I was slow editing my answer... ;-)
Emilio, hey, cool man. I just took the "fast solution" with a one liner. I only beat you because you spent more time giving a thorough and usable answer :)
Emilio, hey, cool man. I just took the "fast solution" with a one liner. I only beat you because you spent more time giving a thorough and usable answer :)
Please login to post comments.