peplin / arduino.mk

DEPRECATED FORK: Arduino Makefile with chipKIT support
http://christopherpeplin.com/2011/12/chipkit-arduino-makefile/
GNU Lesser General Public License v2.1
11 stars 4 forks source link

Console Error stdin isn't a terminal #2

Closed rei-vilo closed 12 years ago

rei-vilo commented 12 years ago

Everything works fine for an Arduino Uno board, except a stty related error.

for STTYF in 'stty --file' 'stty -f' 'stty <' ; \ do $STTYF /dev/tty >/dev/null 2>/dev/null && break ; \ done ;\ $STTYF /dev/tty.usbmodem641 hupcl ;\ (sleep 0.1 || sleep 1) ;\ $STTYF /dev/tty.usbmodem641 -hupcl stty: stdin isn't a terminal stty: stdin isn't a terminal make: *\ [reset] Error 1

Arduino.mk stipulates

# stdin/out appears to work but generates a spurious error on MacOS at least.

Do you experience the same problem? Could we use screen instead?

Serial console parameters Makefile

MON_SPEED = 19200
MON_CMD   = screen 
MON_PORT  = $(wildcard /dev/tty.usbmodem*)

Close serial console before upload Makefile:

$(MON_CMD) -X kill
sleep 1

Result:

screen -X kill No screen session found. make: [upload] Error 1 (ignored) sleep 1

Open serial console after upload Makefile:

sleep 1
$(MON_CMD) $(MON_PORT) -b$(MON_SPEED)

Result:

screen /dev/tty.usbmodem641 -b19200 Must be connected to a terminal. make: [upload] Error 1 (ignored)

How to make the connection with the terminal?

rei-vilo commented 12 years ago

Here's the alternative solution I've found:

timKnapen try this in your makefile for opening a serial terminal from Xcode:

serial: 
    @echo " ---- open serial ---- "
    osascript -e 'tell application "Terminal" to do script "screen /dev/tty.usbmodem* 9600"'

killserial:
    @echo " ---- close serial ---- "
    osascript -e 'tell application "Terminal" to do script "screen -X quit"'

You can then add these rules after and before your upload if you want.

So I close the topic.

peplin commented 12 years ago

I believe you're running this through Xcode, correct? I'm not too familiar with it, but it sounds like when it runs "make" it doesn't use an interactive terminal. A lot of command line apps will complain about that, screen and stty included.

That workaround seem alright, it pops up a new interactive terminal to run these commands. Does that sound right? I'm not seeing either of the tty errors.

rei-vilo commented 12 years ago

Actually, I test both with Xcode and with the terminal because I suspect Xcode may have its idiosyncrasies.

I tested the osascript workaround with a target for Arduino UNO and it works fine.

The only caveat is that \n does only a line-feed but not a carriage-return!

The other issue seems more tricky to identify for me.

fatal error: Board_Defs.h: No such file or directory compilation terminated.

Have you experienced it?

peplin commented 12 years ago

The Board_Defs.h bug should be fixed - see #3 for the fix. Thanks for the help!