queezythegreat / arduino-cmake

Arduino CMake Build system
644 stars 216 forks source link

Is SERIAL supposed to create another target? #51

Closed HappyHeyoka closed 11 years ago

HappyHeyoka commented 11 years ago

I'm using arduino-cmake in KDevelop and loving having a real editor etc... You all rock.

I don't seem to be getting the expected results for the SERIAL option with generate_arduino_firmware, for example, for a CMakeLists.txt containing:

generate_arduino_firmware(testblink SRCS testblink.cpp "source with spaces.cpp" PORT /dev/ttyACM1 SERIAL "microcom -p @INPUT_PORT@ -s 57600" BOARD ethernet)

I get four targets

but no target testblink-serial as I would have expected from the documentation. (It doesn't appear in the KDevelop project tab, nor does it work from the shell via make testblink-serial)

Am I missing something?

queezythegreat commented 11 years ago

Hi, I can confirm this bug, the PROGRAMMER option was being overwritten into the SERIAL option.

The latest version in the develop branch has the fix, could you please confirm that it works.

HappyHeyoka commented 11 years ago

Ok, thanks for having a look.

first, the good news is the target now appears to try and execute the file.

the bad news is the project still doesn't work as advertised in the documentation

(1) with the CMakeLists.txt line SERIAL "microcom -s 57600 -p @INPUT_PORT@"

the output of the build looks like this

    /bin/sh: 1: microcom  -s 57600 -p /dev/ttyACM1: not found

(2) with the CMakeLists.txt line (eg: same as above with no quotes) SERIAL microcom -s 57600 -p @INPUT_PORT@ or SERIAL microcom -s 57600 -p ${INPUT_PORT}

CMake fails:

    CMake Error at /home/dean/wip/arduino/arduino-cmake/cmake/Platform/Arduino.cmake:1586 (message): unparsed 

argument: -s;57600;-p;@INPUT_PORT@ or CMake Error at /home/dean/wip/arduino/arduino-cmake/cmake/Platform/Arduino.cmake:1586 (message): unparsed argument: -s;57600;-p

(3) with the CMakeLists.txt line SERIAL ${CMAKE_HOME_DIRECTORY}/run_serial.sh ${INPUT_PORT} where 'run_serial.sh' contains:

!/bin/bash

    echo 0=${0} 1=${1} 2=${2}
    microcom  -s 57600 -p /dev/ttyACM1
it works:
    0=../run_serial.sh 1= 2=
    [... output from serial ...]

but I note that the echo only shows the one parameter to the script (eg: ${INPUT_PORT} is not getting passed

So I'm thinking something is wrong with invoking the executable. I went trying the figure out how the process was launched but I'm not that expert with CMake yet.

queezythegreat commented 11 years ago

The serial command should now be fixed, the quoting caused problems. I have fixed the port variable (you can use INPUT_PORT or SERIAL_PORT. The documentation has been updated.

I still have to fix the generate_arduino_example command, as it has the same problem with the quoting.

Could you check the latest version, thanks.

HappyHeyoka commented 11 years ago

looks fixed, thanks.