I have an arduino file, which has a .ino extension. Is there a way to make this into an executable file with .exe extension? I want to be able to call it to execute from a TCL program.
EDIT:: Or, how would one run an Arduino .ino file from a TCL program?
You seem to be misunderstanding what the Arduino is about. The code in your .ino file gets uploaded to and executed on the Arduino microcontroller. The code does not run (execute) on the computer where you write your code.
If you want to communicate with the Arduino from your PC, you would typically do it through a serial or wifi connection. Do some searches on that (if that is what you are trying to do). There is a great deal of information and tutorials on that.
Related
I have a nodemcu v3 and I'm trying some basic stuff
I installed the esp8266 board in Arduino IDE and then I uploaded a blink example.
But now I'm trying to upload Lua code using ESPLorer but I doesn't work properly. I press in open and set the baud rate to 115200 but I just get some infinite Chinese letters.
Should I reinstall the firmare or something?
There is a very good answers at https://stackoverflow.com/a/43509569/131929 and https://stackoverflow.com/a/47510019/131929.
Should I reinstall the firmare or something?
First you should make up your mind whether you want to conveniently program in Lua or whether you want to stick with Arduino (running on the NodeMCU-clone board). It is an either-or question. Flashing on of them to the module will erase the respective other.
And no, in case you want to use the NodeMCU firmware, you should not use those outdates binaries from 2015. Build a recent version conveniently in the cloud: https://nodemcu.readthedocs.io/en/latest/en/build/.
P.S. if you're interested why I call yours a clone board you may want to read https://frightanic.com/iot/comparison-of-esp8266-nodemcu-development-boards/ from yours truly.
You must erase the flash of your NodeMCU before a new upload. If you ignore that, your software don't run appropriately. To do that, I'm using esptool:
python esptool.py --port COM9: erase_flash
In that example COM9: is the name of my USB/serial interface.
After that you can flash for example your ESP8266 with that line of code to add a boot part:
python esptool.py --port COM9: write_flash -fm dout 0x00000 boot_v1.5.bin
Use the preview line of code and adapt it to upload other parts of the map of the flash memory.
I am using Arduino IDE 1.6.9 and board manager as "Node MCU 0.9 (ESP-12 Module). When I compile the program using the verify button. It creates a .bin file and my expectation is a .hex file.
I went through earlier posts and all suggested me to look for a .hex file using these options:
Look for the hex file path in the black screen
Look for the hex file under C:\Users\simbu\AppData\Local\Temp\buildXXXX.tmp
folder
Sketch => Export compiled Library
Unfortunately all the above options are creating a .bin file for my program. I am expecting a file with the .hex extension. Are .bin and .hex files the same?
I have three questions here.
If .bin and .hex are different files, how can I generate a .hex file ?
Can I use the .bin file (Size 228Kb) to upload into my AtMega MicroController using AVRDude commands?
Can I use ESP8266 as a programmer interface to upload the program/bin file into ATMega MicroController?
If .bin and .hex are different files, how can i generate .hex file ?
Can i use the .bin file (Size 228Kb) to upload into my AtMega MicroController using AVRDude commands?
You compiled for ESP8266 so of course you can't use that file with an ATmega microcontroller. You need to compile for the board you're going to upload to. When you do that you will indeed get the .hex file you are expecting.
Can I use ESP8266 as a programmer interface to upload the program/bin file into ATMega MicroController ?
Yes, you can use the ESP8266 as an ISP (in-system programming) programmer for AVR microcontrollers:
Connect the ESP8266 to your computer.
Select the appropriate ESP8266 board from the Tools > Board menu.
File > Examples > ESP8266AVRISP > Arduino_Wifi_AVRISP
Upload the sketch to your ESP8266. You can now use it as an ISP programmer. For more information see https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266AVRISP/README.rst
Similar to an .exe file, is there a way to make a 'distributable' of an Arduino program? Some sort of ready-to-upload file... I'd like to share the program but the code should be kept the most secret as possible, or at least make it hard to know.
You can distribute the .hex binary file, and then let the users upload the binary on the Arduino themselves.
The ordinary Arduino IDE already does that for you when you click on the button verify & upload, so you simply have to take the generated .hex file and give it away.
Or you can use Arduino Makefile to get your .hex binaries using any other development environment.
Note: even though the source code is not included nor displayed, it is possible to reverse engineer an .hex binary as much as it is possible to do it with an .exe binary.
I have a sketch for a mega2560 board that I can upload successfully using the Arduino IDE using the upload button but I would prefer to use a script using avrdude. The only problem is if I try to run avrdude more than once to flash the board it get's a stk500v2_ReceivedMessage(): timeout. It doesn't happen every time but enough. The only way the avrdude seems to work again is if I update the same sketch using the Arduino IDE.
I was having trouble finding what the Arduino IDE does to upload a file but all the settings I could find suggest that avrdude is doing it the same way.
Verbose compilation and upload can be enabled in Arduino IDE Settings:
File->Preferences->Show verbose output during: [] compilation [x] upload.
It will show complete commands used for upload and the avrdude should be same or you can use the same avrdude.exe. You should see something like:
C:\arduino\hardware\tools\avr/bin/avrdude -CC:\arduino\hardware\tools\avr/etc/avrdude.conf -v -V -patmega2560 -cwiring -PCOM17 -b115200 -D -Uflash:w:C:\Users\kiiv\AppData\Local\Temp\build658cdf44885ca2a8676f164a933c092f.tmp/MAX7219_4x4x4.ino.hex:i
BTW: I've just started with PlatformIO CLI (command line tool) and I'm loving it.
PlatformIO IDE didn't work well for me, as I'm using czech keyboard layout and keystrokes prevents me to write all essential characters like []{}#& without switching it to english one.
I'm currently reading a Japanese book on embedded OS/RTOS es except that I am not using the recommended hardware as I already had a seeeduino microcontroller.(atmega328p) The book is about KOZOS "12 steps to making your own embedded OS" by Sakai Hiroaki(It's hiro-something)
I'm stuck at the part where I need to write into the flash ROM of the atmega328p because the author is using a different chip called H8. He uses a software called h8write and uses that in his OS, but I honestly have no idea what is going on at this point, and what the avr replacement for h8write would be. I've looked around to no avail as there is minimal documentation on what h8write does aside from the "it helps you write to flash ROM" that shows up in the book.
This is the first time I'm doing lower layer stuff and it's frankly terrifying...
I'm using ubuntu 14.04 if that helps.
If I understand correctly, the h8write program is supposed to run on your computer and transfer the compiled to the microcontroller. You are using a seeeduino, which is an Arduino compatible board, with Ubuntu. The standard way of programming on this environment is with the arduino software:
install the arduino package (sudo apt-get install aruino)
type the command arduino from a terminal emulator: this brings an IDE where you can type your code
connect the seeeduino to an USB port
click on the button with a right-pointing arrow: this will take care of everything (compiling, linking and uploading to the seeeduino)
Once you are comfortable with this workflow, you can try to get your hands dirty with low-level stuff. The Arduino IDE is built on top of smaller utilities like avr-gcc, avr-libc, avr-as and avrdude. Avrdude is the program used to transfer the compiled program to the Arduino/seeeduino, i.e. write to the flash. You can use these utilities directly, from the command line. This is however complicated by the fact that you will need to pass many command-line arguments, so I recommend you automate the process using a Makefile. Thankfully there is a generic Arduino Makefile available that makes this quite easy:
install the generic Arduino Makefile: sudo apt-get install arduino-mk
read the instructions in the comments at the top (the Makefile is at /usr/share/arduino/Arduino.mk)
write your own project-specific Makefile as per these instructions
type make to compile your program
type make upload to upload to the seeeduino (i.e. write the flash).
This application note tells you how to write the flash memory during program run.
A very good tutorial on how to use the PROGMEM attribute in AVR microcontrollers can be found here