Hi,
Our program has unpredictable behavior on some instances. but if I add a line that should not make a difference program works.
I think this is because of optimization level. It might go away if I change optimization level from 3 to 2.
Does anyone know how to do so?
Thank you.
Change gcc optimization level
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Change gcc optimization level
HI,
Edit the Makefile in the project, the level is 2 by default (and note, you should not have instabilities at any optimization level, you risk to hide the real problem).
Giovanni
Edit the Makefile in the project, the level is 2 by default (and note, you should not have instabilities at any optimization level, you risk to hide the real problem).
Giovanni
Re: Change gcc optimization level
Thanks for the help. Yes you were right. This did not make much difference.
And I still need help. It would be great if I can get help with this.
I have following function
Here if I change following code
to following
The function would not work. With first code, STM32 detects PN532 but with second it does not.
Similarly if I remove "ghConsoleprint("h1\n");" than PN532 does not perform peer to peer detection/communication error rate increases.
I am not sure what could be the problem.
Thank you.
And I still need help. It would be great if I can get help with this.
I have following function
Code: Select all
boolean sendCommandCheckAck_fcn(uint8_t *cmd, uint8_t cmdlen, uint16_t timeout) {
uint16_t timer = 0;
uint8_t x;
// write the command
spiwritecommand_fcn(cmd, cmdlen);
// Wait for chip to say its ready!
while (readspistatus_fcn() != PN532_SPI_READY) {
if (timeout != 0) {
timer+=10;
if (timer > timeout)
return FALSE;
}
delay_ms(10);
}
ghConsoleprint("h1\n");
// read acknowledgement
if (!spi_readack_fcn()) {
return FALSE;
}
ghConsoleprint("h2\n");
timer = 0;
// Wait for chip to say its ready!
x=readspistatus_fcn();
while (x != PN532_SPI_READY) {
x=readspistatus_fcn();
if (timeout != 0) {
timer+=10;
if (timer > timeout)
return FALSE;
}
delay_ms(10);
}
return TRUE; // ack'd command
}
Here if I change following code
Code: Select all
x=readspistatus_fcn();
while (x != PN532_SPI_READY) {
x=readspistatus_fcn();
to following
Code: Select all
while (readspistatus_fcn() != PN532_SPI_READY) {
The function would not work. With first code, STM32 detects PN532 but with second it does not.
Similarly if I remove "ghConsoleprint("h1\n");" than PN532 does not perform peer to peer detection/communication error rate increases.
I am not sure what could be the problem.
Thank you.
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Change gcc optimization level
I don't recognize any of the functions you call in that code, how am I supposed to help? also, please keep requests on the appropriate forums.
Giovanni
Giovanni
Who is online
Users browsing this forum: No registered users and 24 guests