12 years, 5 months ago.

Hostserial_HelloWorld problem

A newbie question:

I can compile the simple serial program that displays "Hello World" then repeats the characters on the terminal OK. It functions correctly on the terminal program.

I try to compile the HostSerial_HelloWorld program and it will not compile...even after I downoad the revisions. The error I get is " Statement is unavailable" Then I receive a whole list of similar statements, and finally I get one that says "Cannot open Source input fuile " core_cm0.h

I think those errors are enough of a clue for you experienced users to be able to immediately guess what I am doing wrong.

Should not this program work with the same serial/usb configuration as I had on the simple serial program mentioned above?

I'm sure it is something simple.

3 Answers

12 years, 5 months ago.

Hi, Tom can you put the code of the HostSerial_HelloWorld program to try to help you (use <<code>> your code <</code>> tag)

Greetings

Accepted Answer

Or link to the program.

posted by Erik - 28 Mar 2013
12 years, 5 months ago.

I have just compiled for LPC1768, and it works,
but lots of errors with LPC11U24 and KL25Z.

But I havent had a lot of joy in getting the functionality working :(

Cheers

Ceri

12 years, 5 months ago.

Here is the code that I downloaded from the mbed website into my compiler:

  1. include "mbed.h"
  2. include "USBHostSerial.h"

DigitalOut led(LED1); Serial pc(USBTX, USBRX);

void serial_task(void const*) { USBHostSerial serial;

while(1) {

try to connect a serial device while(!serial.connect()) Thread::wait(500);

in a loop, print all characters received if the device is disconnected, we try to connect it again while (1) {

if device disconnected, try to connect it again if (!serial.connected()) break;

print characters received while (serial.available()) { printf("%c", serial.getc()); }

Thread::wait(50); } } }

int main() { Thread serialTask(serial_task, NULL, osPriorityNormal, 256 * 4); while(1) { led=!led; Thread::wait(500); } }

(end of the code).

Errors reported during compile:

"statement is unreachable" in file "USBHost/FATFileSystem/ChaNff.cpp", Line: 1689, Col: 12 "identifier "USB_IRQn" is undefined" in file "USBHost/USBHostUSBHALHost.cpp", Line: 59, Col: 20 "identifier "LPC_SC" is undefined" in file "USBHost/USBHostUSBHALHost.cpp", Line: 62, Col: 4 "identifier "LPC_USB" is undefined" in file "USBHost/USBHostUSBHALHost.cpp", Line: 69, Col: 4 (Many others just like the above) Finally the errors: "cannot open source input file "core_cm0.h": No such file or directory" in file "USBHost/mbed-rtos/rtxrt_CMSIS.c", Line: 42, Col: 23 "Unable to download. Fix the reported errors..." in file "/"

It is like the files called for in the include are not in the correct directory or something.

Hi, Tom what mbed board are you using? i compile the example for the MBED LPC1768 board and compiles fine, except for the warning:

  • "statement is unreachable" in file "USBHost/FATFileSystem/ChaNff.cpp"

No errors to compile

Greetings

posted by Ney Palma 28 Mar 2013

Hi Tom checking the code of files in the library USBHost i think this library is design for LPC1768 boards only. Maybe i am wrong, but that is my guess

Greetings

posted by Ney Palma 28 Mar 2013