Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
12 years, 6 months ago.
In debugging with uVision, the current line stops automatically.
Hi, I am happy It is possible to debug mbed program.
I debugged this code with CMSIS-DAP in uVision. I started debugging, the current line stops automatically in fopen. I couldn't click both run button and step buttons, so I couldn't continue debugging.
debugging code
#include "mbed.h"
Serial uart(USBTX, USBRX); //USB uartSerialSerial uart(USBTX, USBRX);
DigitalOut myled(LED1);
// ***** local file read *****
bool usbFileRead(char *srcStr, char *readVal);// return 1:mormal, 0:error
LocalFileSystem local("local"); //local file system
short STR_SIZE = 64;
int main() {
char buffer[STR_SIZE];
if(usbFileRead((char*)"TEST", buffer))
uart.printf("true");
else
uart.printf("false");
while(1) {
myled = 1;
wait(0.2);
myled = 0;
wait(0.2);
}
}
short BUFFER_SIZE = 64;
bool usbFileRead(char *srcStr, char *readVal) // return true:normal, false:error
{
char readBuf[BUFFER_SIZE];
FILE* fp = fopen("/local/config.txt","r");
char *p;
while(fgets(readBuf, BUFFER_SIZE, fp)) {
if(*strstr(readBuf, srcStr)) // find srcStr from readBuf
{ //find srcStr
p = fgets(readBuf, BUFFER_SIZE, fp);
strcpy(readVal, p);
fclose(fp);
return true;
}
}
fclose(fp);
return false;
}
This program runs well in mbed. What should I do to continue debugging?
Thanks,