I have an Arduino device witch has a sketch loaded on it. My question is can I read the sketch from the memory (hex file) and the dissansamble it ?
Yes. I would recommend you use ReAVR:
http://www.avrfreaks.net/index.php?func=viewItem&item_id=272&module=Freaks%20Tools
To get the HEX file, use an in system programmer like the AVR ISP MKII and use AVR Studio to read the hex directly.
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
I guess I'm having a basic understanding issue regarding the nodemcu/ESP8266 when it is used with the Arduino IDE and/or visual micro (for MS Visual Studio).
Everytime I upload a program/sketch which is obviously written in C in this case, it is compiling and uploading a binary of about 280kb, even if it is only a simple "blink" example.
Is it some kind of firmware being uploaded everytime or is it just monsterious libraries needed for the ESP to work with the Arduino IDE?
If it is firmware, do you normally "update" the firmware to a more recent build when working with the Arduino IDE? When using the nodemcu LUA firmware, there are periodic updates.
Thanks!
Basically, you build the firmware, which is a combination of your own code, and lots of other code/libraries.
All the other parts are part of the Arduino ESP8266 core, which does indeed get updates (it lives here: https://github.com/esp8266/Arduino). And it itself contains the Espressif SDK, which also gets updates (https://github.com/esp8266/Arduino/tree/master/tools/sdk).
Like NodeMCU you can get periodic updates, but they are of the core, and the only way to get them into your firmware is to recompile your sketch.
This is completely normal - When writing code for an interpreted language like Lua for the ESP/NodeMCU, you're just uploading what is a relatively small text file(s), as the code needed to run it is already on the chip, and doesn't change.
However, when you start working with compiled languages like C (With the Espressif SDK only, for example), or C++ with the Arduino IDE, you are replacing the entire firmware each time your code changes. This includes the TCP/IP stack, WiFi management, the logic controlling the PHY/MAC interface, the mini OS, and a host of other bits to make your ESP8266 work. Even if your code appears to be just a simple "blink" sequence, there's a lot of code running behind the scenes to make it possible, leading to the large sketch size.
Generally, every change to your sketch code will produce a complete copy of everything needed to create a bootable, runnable binary for the ESP8266. This is what is causing the 280KiB file. Since each copy of your code includes the newest (Or at least whatever is in your IDE at the time) copy of the system level code, there is no separate update process - Each time you upload your sketch, the system code is updated too.
Additionally, there is some extra overhead from the Arduino abstraction on the Espressif SDK, leading to a larger resulting binary size.
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.
I have a arduino Duemilanove and an atmega8 chip. The arduino board is having Atmega328 on it. I have written a code that works fine on arduino. Now I want to transfer that code from arduino to my atmega8 chip. Can I use arduino bootloader to do that?
Thanks in advance.
In theory you can, but there are some things missing at Atmega8, like Timer2 hardware, for example.
So it is possible use the Atmega8, but you need to upload Arduino NG or older w/ ATmega8 bootloader to the chip and check your code (mind the libraries!) for use of hardware that is not present at Atmega8.
To burn the bootloader I am using a Parallel Cabe, like this:
http://arduino.cc/en/Hacking/ParallelProgrammer
And follow the sequence below to burn it:
Choose menu Tools > Boards > Arduino NG or older w/ ATmega8
Choose menu Tools > Programmer > Parallel Programmer
Menu Tools > Burn Bootloader
That's it!
Regards
Renato Aloi
You Can use the old files from arduino for sure and (probably also the newer builds)
But keep in mind that you have only ~7Kb(after the 1K bootloader)
you will need to compile the code as "Arduino NG or older w/ Atmega8"
You can find instructions on how to burn a boot loader here
http://arduino.cc/en/Hacking/Bootloader
And a reference schematics here
http://arduino.cc/en/uploads/Main/arduino_NG_schematic.png