vv

  • *
  • 20
How to upload firmware using terminal in linux?
« on: April 14, 2016, 02:35:23 pm »
I have built the uploader, it connects to the serial port but does nothing. What am I doing wrong?

f5soh

  • *****
  • 4572
    • LibrePilot
Re: How to upload firmware using terminal in linux?
« Reply #1 on: April 14, 2016, 02:45:34 pm »
Hi, welcome.

What are you trying to do, and which board do you use ?
You cannot use GCS ?

vv

  • *
  • 20
Re: How to upload firmware using terminal in linux?
« Reply #2 on: April 14, 2016, 03:04:17 pm »
I am using cc3d. I have Succesfully built the firmware, bootlaoder, uploader. Thats all I need to build, right? Then I try to uplaod to the board using the command
Code: [Select]
OPUploaderTool -p build/firmware/fw_coptercontrol/fw_coptercontrol.opfw -v -t /dev/ttyACM0And all I get is
Code: [Select]
librepilot git:(develop) ✗ OPUploaderTool -p build/firmware/fw_coptercontrol/fw_coptercontrol.opfw -v -t /dev/ttyACM0
OpenPilot serial firmware uploader tool.
Connect the board
[==================================================] 100%     
Connect the board NOW

Uplaoding works fine using librepilot and bootloader is version 4.

Thanks!

f5soh

  • *****
  • 4572
    • LibrePilot
Re: How to upload firmware using terminal in linux?
« Reply #3 on: April 14, 2016, 03:11:41 pm »
Quote
Thats all I need to build, right?

Not sure... how do you configure the board ?
You may need the GCS.

Re: How to upload firmware using terminal in linux?
« Reply #4 on: April 14, 2016, 03:20:52 pm »
Uploader is not indended to be used on anything but OP Gps V9.
Other boards does not supports serial updating right now.

vv

  • *
  • 20
Re: How to upload firmware using terminal in linux?
« Reply #5 on: April 14, 2016, 03:47:10 pm »
The configuration stays in the EEPROM, unless deleted manualy? How does one setup the development environment then?

f5soh

  • *****
  • 4572
    • LibrePilot
Re: How to upload firmware using terminal in linux?
« Reply #6 on: April 14, 2016, 04:04:44 pm »
You can ask erase after a rescue or simply Upgrade&Erase
On next boot, flash/config is erased. It take some time with CC3D, maybe around 20s

Take a look here:
https://librepilot.atlassian.net/wiki/display/LPDOC/Firmware+Tab

Quote
How does one setup the development environment then?

Can you explain what you ask please ?

vv

  • *
  • 20
Re: How to upload firmware using terminal in linux?
« Reply #7 on: April 14, 2016, 04:34:05 pm »
To create a development environment you need to know the basics of how to compile, build, debug, upload the program. I haven't stumbled upon an open source project that didn't have these capabilities using command line tools. I am sure LibrePilot is no different.

A typical procedure to build the project is by running
Code: [Select]
make, or making a target, which in my case is
Code: [Select]
make fw_coptercontrol. This builds the binary/hex files that are later uploaded to the cc3d board.

A typycal command to uplaod the firmware (binary/hex files from the step above) is
Code: [Select]
make uplaod. In this project I found that the upload procedure isn't implemented in the Makfile (did I miss it?). Later I found out that there is an uploader tool that I can build called OPUploderTool, that is supposed to do the job. Unfortunately it gets stuck for some reason, thats why I came for your help.  @a_morale Says it is not intended to be used on anything but OP Gps V9. So how do I upload using the command line tools?

For a developer debugging is a very big of a deal and it is important to document how it is done. How does one output some debug data to a PC. That would be other question.

Where and/or is there documentation written on how to compile, build upload/run and debug the firmware? If not, can someone please explain?

Here is an example from ArduPilot's documentation on how to do it http://copter.ardupilot.org/dev/docs/building-px4-for-linux-with-make.html. Dev's don't use GUI tools to flash firmware, which is where you pointed me. Just like any other open source project, it needs absolutely no GUI tools to develop, especially flash firmware.

If there is anything else unclear, please let me know. I am just trying to contribute to the open source community, free of charge, so that everyone can benefit from it. It is really hard to do without a decent documentation or some help from the devs.

@marc

  • *
  • 152
  • Ask me about LibrePilot2Go on Android.
Re: How to upload firmware using terminal in linux?
« Reply #8 on: April 14, 2016, 04:54:30 pm »
Have you checked the developer section in the wiki?

This gives detailed instructions on how to build:

https://librepilot.atlassian.net/wiki/display/LPDOC/Linux+-+Building+and+Packaging

The firmware upload is made via the firmware Tab in GCS, as stated above.

You need X for that.

vv

  • *
  • 20
Re: How to upload firmware using terminal in linux?
« Reply #9 on: April 14, 2016, 04:59:23 pm »
This is where instructions/documentation for my question is supposed to be  https://librepilot.atlassian.net/wiki/display/LPDOC/Firmware+development . The page is empty. The link you gave me, I know about it, but it has almost nothing to do with what I am asking for. The link you gave me is for building and packaging the GCS, not flashing firmware.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: How to upload firmware using terminal in linux?
« Reply #10 on: April 14, 2016, 05:17:09 pm »
Some sort of command line programming can be done using dfu-util, but not for CC3D.
Code: [Select]
make ef_revolution_dfu
There is no command line for flashing firmware.
Maybe your first contribution to matches other projects ? You're welcome :)

See files attached, maybe you got help here.

You can also use the debug console and output messages to one port set as DebugConsole (main, flexi or VCP)
look at ./flight/targets/boards/coptercontrol/firmware/inc/pios_config.h for DEBUG_CONSOLE and DEBUG_LEVEL

vv

  • *
  • 20
Re: How to upload firmware using terminal in linux?
« Reply #11 on: April 14, 2016, 07:11:50 pm »
Thanks, this info helps. I will be definitely creating a CLI tool for flashing firmware. I can't have GCS runnign and going through 50 clicks to upload a firmware. It has to be done with a single command in the terminal! :)

Why I started to want to contribute to the project is because I realized there is a significant lag in the outputs from RC commands, like .2 - .4 secs. Even manual too! I think I already know where the problem is.  I know that the CPU is more than powerful enough to do it without lag. Any other advice to start developing for librepilot?

I still find it hard to accept that the only way to flash firmware is using the GUI tool. How do devs develop for cc3d?

m_thread

  • *****
  • 87
  • GCS is my home
    • LibrePilot
Re: How to upload firmware using terminal in linux?
« Reply #12 on: April 14, 2016, 07:27:19 pm »
I can't have GCS runnign and going through 50 clicks to upload a firmware.


It takes at most four clicks to upload firmware if I count the double click to start the app ;)


/F

f5soh

  • *****
  • 4572
    • LibrePilot
Re: How to upload firmware using terminal in linux?
« Reply #13 on: April 14, 2016, 07:44:54 pm »
0.2s is a pretty important lag for RC input.
How/Where do you measure this value, which RC input do you use ?

If you want to contribute start with a fork from here:
https://bitbucket.org/librepilot

Next, add a JIRA here:
https://librepilot.atlassian.net/issues/

Look also the .commit-template and finally create a pull request from your bitbucket repo after you pushed a branch / fix

More details here:
https://github.com/librepilot/LibrePilot/wiki/Git-Workflow
« Last Edit: April 14, 2016, 07:52:55 pm by f5soh »

m_thread

  • *****
  • 87
  • GCS is my home
    • LibrePilot
Re: How to upload firmware using terminal in linux?
« Reply #14 on: April 14, 2016, 08:39:31 pm »
I still find it hard to accept that the only way to flash firmware is using the GUI tool. How do devs develop for cc3d?


The best is to use SWD since you can debug the board directly from gdb/eclipse as well as upload new firmware.