Waf based upload of examples

Hi,

Its about a year since I tried any coding in ArduCopter and in the interim I see the master is now built using waf in place of make.
OK.
After a bit of fiddling about I have the waf build working.
I wanted to try some of the simple examples, specifically the HAL UART_test.
Waf compiled the examples OK.
But I am struggling to figure out how to upload the UART_test example to my test Pixhawk. (Via the USB as usual)
The --upload flag suggested by waf at the end of build appeared to start the full firmware build and upload cycle so I stopped that and tried to specify the particular example. That resulted in:

No function px4-v2/examples/UART_test defined in ~/ardupilot/wscript
After running the changes around the relative directories I stopped digging and tried the forums.

As I didn’t find any references to this problem it seemed prudent to ask as I’m sure the answer will be useful to many.

Thanks,

Martin

Hi,

After a bit more digging here’s a quick update.
According to this thread:

We can get a list of the available examples using:

./waf list | grep examples/

which (leaving out most of the list) reveals:


examples/StorageTest
examples/ToshibaLED_test
examples/UART_test
examples/eulers
examples/location

Smashing, and so following the instructions on thread 4931

I tried:

./waf --targets examples/UART_Test --upload

which revealed:

Waf: Entering directory /home/martin/ardupilot/build/px4-v2' Waf: Leaving directory/home/martin/ardupilot/build/px4-v2’
Could not find a task generator for the name ‘examples/UART_Test’

Next I tried another example:

./waf --targets examples/AHRS_Test --upload

This built and loaded OK ending with:

BUILD SUMMARY
Build directory: /home/martin/ardupilot/build/px4-v2
Target Text Data BSS Total

examples/AHRS_Test 551664 2764 49112 603540

PX4
The ELF files are pointed by the path in the “Target” column. The .px4 files are in
the same directory of their corresponding ELF files.

PX4IO
Binary Text Data BSS Total

px4-extra-files/px4io 41800 584 3018 45402

Build commands will be stored in build/px4-v2/compile_commands.json
’build’ finished successfully (22.999s)

So I’m off to figure out how to build the missing script.

Hope this is useful to someone.

Keep up the good work.

Martin

Hi,

Whoops.
A prize to anyone who spotted my dumb mistake. (Grep found it of course.)

It’s:
./waf --targets examples/UART_test --upload

Not:
./waf --targets examples/UART_Test --upload

Works perfectly. Easy when you know how.
Sorry.

Martin

HI,
I am trying using waf also, but the problem is I just can not upload to my pixhawk.
The reusult is like this.

ender-chen@ubuntu:~/ardupilot$ ./waf --targets bin/arducopter-quad --upload
Waf: Entering directory /home/ender-chen/ardupilot/build/linux' Waf: Leaving directory /home/ender-chen/ardupilot/build/linux’
BUILD SUMMARY
Build directory: /home/ender-chen/ardupilot/build/linux
Target Text Data BSS Total

bin/arducopter-quad 1194438 2232 37896 1234566

Build commands will be stored in build/linux/compile_commands.json
‘build’ finished successfully (1.439s)

Can you help me ?

You build linux binary so that can’t work on pixhawk
do ./waf configure --board px4-v2 and then ./waf --targets bin/arducopter-quad --upload

Thank you, It is really helpful. :slight_smile:

Hi everyone, when I try to upload the example I get this:

pi@navio:~/ardupilot $ ./waf --targets examples/UART_test --upload
Waf: Entering directory /home/pi/ardupilot/build/navio2' [438/873] Compiling libraries/AP_HAL/examples/UART_test/UART_test.cpp [586/873] Compiling libraries/AP_InertialSensor/AP_InertialSensor.cpp [873/873] Linking build/navio2/examples/UART_test Waf: Leaving directory/home/pi/ardupilot/build/navio2’

BUILD SUMMARY
Build directory: /home/pi/ardupilot/build/navio2
Target Text Data BSS Total

examples/UART_test 73678 1084 18620 93382

Build commands will be stored in build/navio2/compile_commands.json
’build’ finished successfully (29.731s)
Waf: Entering directory `/home/pi/ardupilot/build/navio2’
Destination for rsync not defined. Either pass --rsync-dest here or during configuration.

Would someone please explain me the last line. Thanx.