I have a Raspberry Pi at a remote location. I have attempted to run the Arduino IDE on that system but it doesn't have enough memory. I would like to compile some code on my Ubuntu desktop, copy the executable file to the Pi and use some utility to load it to an ESP8266 running the OTA software. What I need is to know where the executable is after an IDE compile step and what utility might be used to transfer the file from the Pi to the ESP8266 over the lan.
Any ideas?
Thanks,
Jim.
in arduino ide,
go to, File-> Preferences. Tick mark the boxes for compilation “Show verbose output during: ☑ compilation"
Now You will get the location of all the files generated in arduino console.
See answer by Kinaly Jain. If you upload your code to a local esp, verbose mode will also show you the commands it used to do the upload. You can gather these commands into a script or a makefile to run on the remote Pi.
Thanks to both of the responders. I wanted to try to describe a possible scenario to satisfy my needs. I found out from another post that the "Sketch/Export compiled binary" menu selection will produce a bin file that can be uploaded using a script similar to the one in this page https://github.com/esp8266/Arduino/issues/3553
The script finds the available OTA ports in the network and then uses espota.py to upload the .bin file to the port that you select. I suggest slight update to that script. On my system, espota is in ~/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/espota.py and it is now a python3 script. It is executable so you don't need to explicity execute python.
/home/$USER/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/espota.py -i $ip -p 8266 --auth="$password" -f "$path" 2> /dev/null && echo -e "Success:\t$ip" || echo -e "Fail: \t$ip" &
I've not tested it yet but I think it'll work with maybe some small tweaks. The avahi-browse utility is in the avahi-utils package on the Raspberry Pi OS. It was not installed by default on RPi OS but it appears to have been on Linux Mint.
To summarize I will run the Arduino IDE on my desktop using the "Export ..." menu, then I'll find the .bin file in the sketch directory and copy it to the Pi. Then I'll use the script mentioned before to hopefully write the bin file to the esp8266 via OTA. I hope this will help someone else with a similar problem.
Thanks again,
Jim.
Related
I'm writing scripts to automate some task to be executed from windows machine to remote ubuntu server, which uses putty-tools like plink.exe, pscp.exe and psftp.exe.
My python program is able to run successfully but I'm trying to build a single independent standalone file which can be run in another PC even if that PC do not have these putty tools available.
I'm using below commands
python -m nuitka --enable-plugin=tk-inter --windows-disable-console --onefile --standalone my_program.py
I'also found related question here but it was not answered
Bundle third party .exe in Python code and produce another portable .exe
Can someone please help me on this.
Fortunately I found answer for my question by reading the nuitka user manual, we need to use one of the below format based on the requirement. In my case I used second one.
# This will find a file near your onefile.exe
open(os.path.join(os.path.dirname(sys.argv[0]), "user-provided-file.txt"))
# This will find a file inside your onefile.exe
open(os.path.join(os.path.dirname(__file__), "user-provided-file.txt"))
And while packing my command become something like below,here it will include all the files available in source directory to target directory in "onefile.exe"
python -m nuitka --enable-plugin=tk-inter --windows-disable-console --onefile
--include-data-dir=<source>=<target> --standalone my_program.py
Whenever I try to run any Arduino CLI commands, I am always getting a popup saying "MainClassNameRequired". What is going on and what do I need to do to be able to run arduino CLI commands?
I found the following JA.SO question and answer: https://ja.stackoverflow.com/q/20667.
My Japanese is terrible, and Google Translate didn't help too much, but the paths in the answer were correct and I was able to get the gist & get it working.
It turns out that, for whatever reason, the Arduino symbolic link created in /usr/local/bin, even though it is linked to the correct executable, doesn't actually pass the parameters through.
The Japanese answer suggested two solutions, both of which work. Firstly, remove the existing symlink from /usr/local/bin, then you can either:
Create a shell script wrapper to call the Arduino executable that will pass parameters through and then link create a symlink to that (or just make it executable and place it in /usr/local/bin):
#!/bin/bash
exec /Applications/Arduino.app/Contents/MacOS/Arduino "$#"
ln -s /usr/local/bin/arduino arduino.sh
Create an alias
alias arduino='/Applications/Arduino.app/Contents/MacOS/Arduino
Now when you execute arduino from your command prompt, your parameters are correctly passed to the program.
I am a new user of Arduino boards. I have an Arduino mega ADK and I have to extract the code that was downloaded on it, because I don't find the source code.
Is there a way to extract the code on Arduino board (such as the .hex file reading the flash memory) without having the source code ?
I use Windows 8.
Thank you very much.
Enrico
Generally, you can find the hex file in a temp directory on your windows machine (assuming it is the machine used to build the code. From the official Arduino docuemntation:
"Only the parts of the library needed for your sketch are included in the final .hex file, reducing the size of most sketches.
The .hex file is the final output of the compilation which is then uploaded to the board. During a "Verify" the .hex file is written to /tmp (on Mac and Linux) or \Documents and Settings\\Local Settings\Temp (on Windows). During upload, it's written to the applet sub-directory of the sketch directory (which you can open with the "Show Sketch Folder" item in the Sketch menu)."
In my experience, I had a bunch of randomly named directories in the location specified above and I had to sort them by date/time and find the one that had my hex file.
Hope that helps!
In Linux this worked for me in Mega 1280:
avrdude -p m1280 -c arduino -P /dev/ttyACM0 -b57600 -U flash:r:flash_backup_file.hex:r
change the baudrate and arduino type.
Hello there I am a newbie working on the SMARTRF-05EB - Evaluation Board, I have installed SDCC and Contiki-2.6 in the Linux Virtual Machine. I am able to build all the examples present in this directory contiki-2.6/contiki/examples/cc2530dk , but I am clueless as to how to flash the final .hex image file on EB.
Is there a way to burn it from Linux directly using some command or do I have to switch back to Windows and use TI's Flash Programmer to burn the application image. When I try to flash the application using the Flash Programmer I get this message highlighted in RED : "Flash Image overlaps with the bootloader"
Can someone please let me know about how to correctly place the application code on a particular address so that I can save the bootloader from being corrupted by my application .hex file.
I would like to flash say for example the simple "hello world" .hex file.
Thanks
Hello there I had to figure it out by going through the documentation..so the commmand that I used in getting a successful output on the hardware was this
1) root#ubuntu:/home/contiki/contiki-2.6/examples/cc2530dk# make TARGET=cc2530dk clean
2) root#ubuntu:/home/contiki/contiki-2.6/examples/cc2530dk# make TARGET=cc2530dk
also in the previous directory, cd to hello-world and execute the 2 commands as below:
1) root#ubuntu:/home/contiki/contiki-2.6/examples/hello-world# make TARGET=cc2530dk clean
2) root#ubuntu:/home/contiki/contiki-2.6/examples/hello-world# make TARGET=cc2530dk
These 2 commands help in building the .hex for the SMART05-EB and then use the TI's SMARTRF STUDIO software or TI's Flash Programmer for burning the hex image on the SoC. Open up TeraTerm or anyother Serial Communication software and then choose the port with settings 115200 8-N-1 and you should be able to get the output on screen. I have issues in building the other examples in other directory - for eg ping-ipv6, so would be posting a new question regarding such examples.
Thanks
After compiling the code for the example you are working with it 'll create a platform specific file Ex. for sky (hello-world.sky) in you case it 'll be hello-world.cc2538dk. Just use the following command to convert it to ihex file
msp430-objcopy udp-multicast.exp2420 -O ihex udp-multicast.ihex
You can now rename the ihex file to hex file and upload the hex file to your mote using TI flash program (http://processors.wiki.ti.com/index.php/MSP430_Flasher_-_Command_Line_Programmer). From windows use the following command to upload the file.
MSP430Flasher.exe -n "MSP430F5438A" -m SBW4 -w your_hex_file.hex -i COMxx [VCC]
Where does the Arduino IDE save the binaries on Mac OS X?
In the Arduino software: go to File -> Preferences and then select Show verbose output during -> compilation.
Finally, when you are compiling, the program will show you lots of data. At the last lines, you will find the path1 to the .hex file.
1Every time the path changes!
Arduino 1.6.5 has a new command: Under the Sketch menu, select Export compiled Binary, then Show Sketch Folder. There it is.
Arduino IDE uses the mktemp command to create the temp directory on Mac and Linux. However, on Mac the default $TMPDIR env var is not /tmp/ as it is on Linux. On Mac it's under /var/folders and it is randomly generated on boot. That complicates things a little, but here are tricks you can add to your toolkit (as aliases, functions, shell scripts, etc.) to help you find what you need.
To find the hex files
find $TMPDIR -name \*.hex -exec ls -lrt {} \; #<-- you need that backslash before and space after the semicolon
To find build directories
ls -ldrt $TMPDIR/build*
NOTE: The ls flags of r and t cause the listing to be "reverse" sorted by "time" respectively. This means that the newest will be on the bottom.
What UDalillu said. The trick also works on Windows. On XP it ended up in C:\Documents and Settings\Your_User_Name\Local Settings\Temp\buildxxxxx\ (the xxx number changes for each build, pick the most recent).
The arduino web page http://arduino.cc/en/Hacking/BuildProcess
described
During a "Verify" the .hex file is written to /tmp (on Mac and Linux) or \Documents and Settings\\Local Settings\Temp (on Windows)
I am using fedora19 64bit, and when i check my /tmp the build directory created is
/tmp/build8102....tmp/
I made a simple tutorial here with images
It is very beautifully explained in the following blog
Where to find Arduino Hex files or Output Binaries
I hope this helps :)