8
votes
Accepted
Can I force a function to live in the boot sector without overwriting the bootloader?
The Optiboot version 8 has a do_spm function which can be called from application. The Optiboot repository contains an example for the use of this function.
SPM is the AVR CPU instruction to write to ...
7
votes
Accepted
Executing machine code at runtime Uno
The microcontroller is executing one command at a time from..where?
Flash memory directly. The AVR core can only execute instructions from Flash memory. It uses a two-bus system known as Harvard ...
7
votes
Accepted
EEPROM.get returns bad data
You are saving a String object in EEPROM, which is useless. A string
object does not store the contents of your string. Instead, it just
stores:
the memory address where the actual contents (the ...
7
votes
How can a function/method determine if a const array passed in is PROGMEM (flash) or not (RAM)?
I am afraid there is no good solution to this problem. One option I do
like is to use the __flash qualifier instead of PROGMEM:
const uint8_t ram_array[] = { 1, 2, 3, 4 };
__flash const uint8_t ...
6
votes
Accepted
Extend program space by getting rid of bootloader on NANO
It's enforcing this line from the arduino:avr boards.txt
nano.menu.cpu.atmega328.upload.maximum_size=30720
To be clear, the board is assumed to have a bootloader, even if you're not using it to get ...
5
votes
What programming practices should be adopted while coding sketches for Arduino?
Paul covered the most important points. This answer is intended to be a
complement to his.
First, you should keep in mind the general rules, which are more
important than the more specific ones. The ...
5
votes
Is it possible to use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage?
Yes you can. This Arduino IDE add on lets you make calls to code store in the bootload of memory so you can make changes to the flash memory.
https://majek.sh/en/writing-to-internal-flash-on-arduino/
...
5
votes
Accepted
Is it possible to use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage?
The answer is "yes, you can use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage, very similar to an STM32 microcontroller."
One of these days I'm going to write an Arduino ...
4
votes
Accepted
Set EEPROM from PC before program
The simplest way would be to have two sketches.
One that will store all the strings into EEPROM.
After that you can upload the second actual sketch that uses the values stored in EEPROM.
You ...
4
votes
Accepted
Writing your own Arduino flashing tool
This application already exists. It's called AVRDUDE:
http://www.nongnu.org/avrdude/
You can download it compiled for Windows at the link above. This is the very flashing tool that the Arduino IDE ...
4
votes
How can a function/method determine if a const array passed in is PROGMEM (flash) or not (RAM)?
There is also an OO solution possible, using the strategy design pattern, but this comes with some (slight) memory and performance penalties. You need to use C++ for this.
Put each array you want to ...
4
votes
Accepted
How do I get the size of my program at runtime?
Just to warn you, I minimally tested this, but it seems to work.
In the Due's linker script there are these relevant lines, containing the named rom section.
MEMORY
{
rom (rx) : ORIGIN = ...
4
votes
How .data + .text section can be = How much flash the final program will consume
Just to expand on what JRobert said, variables which are initialized, and other literals (eg. the word "foo" in your example) have to come from somewhere, and thus are stored in program (...
3
votes
How to save a hex file into Arduino Flash to send it via Serial?
If I understand your question correctly, you need to integrate this data into a .ino script. Probably as a byte array. Then the script can read the array and Serial.write its content.
You could ...
3
votes
Set EEPROM from PC before program
I think here is a confusion about the three types of memory. EEPROM, FLASH and SRAM are completely separate. EEPROM is like your file storage. FLASH contains you program and static values. SRAM is the ...
3
votes
What programming practices should be adopted while coding sketches for Arduino?
Keep in mind that RAM is even less. 32KB is a fair lot of code, since C/C++ is highly efficient. "Don't save **** in RAM."
If you need to load images into a display, save the images on an SD card. ...
3
votes
Accepted
Flashing ESP8266 over WiFi whith samrtphone?
ESP8266 OTA can be performed through a web browser as detailed in the ESP8266 OTA information page.
Since a smartphone has a web browser I can see no reason why you can't use that.
3
votes
Trying to flash ESP8266 with Arduino UNO
You do not need the level shifter. The input pins of the ESP8266 contain over-voltage (though not over-current) protection. All you need to do is limit the current that can flow through the over-...
3
votes
Accepted
Flashing an ATtiny85 with a NodeMCU?
It can be done. Your Digispark has SPI pins, which are ISP pins. For the esp8266 there is an ESP8266AVRISP library for OTA upload to AVR. You can use the example of the library.
You must wire the SPI ...
3
votes
Accepted
AVR-GCC can't call function located on fixed address
I've tried this code with arduino and it worked (i taught, of course, i can't add the "-Wl,--section-start=.app_start=0xFA0" flag to the compilation process so the function not gonna be moved to other ...
3
votes
Can't flash ESP8266 anymore (NodeMCU)
The fix ended up being to use a 220ohm resistor between D3 and GND (It has been pointed out, though I haven't tested it, that just wiring D3 to ground on startup should have the same effect). Then ...
3
votes
Accepted
Reading contents of ESP8266 Flash from inside sketch
I think you're reading of flash is slightly wrong
while ESP.flashRead takes a unit32_t pointer for output data, the read "count" argument is in bytes - looking at Updater.cpp code it does this
...
3
votes
EEPROM.get returns bad data
Just to have the full working code, I ended up with this:
#include <EEPROM.h>
char serial_characters[] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"};
// 7 chars for serial and one for string end '...
3
votes
Accepted
ESP8266 OTA update with different flash size settings?
The basic problem is that when you upload over OTA you don't upload the partition structure.
The ESP32's flash is split into a number of "partitions" or areas. It might look something like:
...
3
votes
Accepted
ESP32: best way to embed certificates
I don't know what you need that Preferences thing for, but I would use SPIFFS/FAT anyway. Simply store the certificate in a file in flash and read that file when you need it. The required space is no ...
3
votes
D1 mini esp8266 error: esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
I'm not sure if this will help EVERYONE, but I hope it at least helps someone. I had the same issue with several different boards (3 Nano's, 2 NodeMCU ESP8266's, and 1 Uno). I searched and searched ...
3
votes
Reading & writing a configuration file on an Adafruit Circuit Playground Express
The problem was using the Arduino SAMD board core instead of the Adafruit SAMD board core. The Adafruit SAMD board core is not visible unless you add:
https://adafruit.github.io/arduino-board-index/...
2
votes
Accepted
Any way to use F macro with a passed variable?
There is a special type for just this occasion - the __FlashStringHelper type.
void displayMenu(const __FlashStringHelper *txt, byte var) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(txt);
...
2
votes
How to read/write variables persistenly on Arduino Due (no EEPROM/shield)?
This library called DueFlashStorage was created by Sebnil and is in the Arduino Library Database Tool!
It basically takes the EEPROM functionality and applies it to the Flash storage on the DUE. The ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
flash × 123esp8266 × 20
eeprom × 18
arduino-uno × 17
arduino-due × 10
arduino-ide × 9
esp32 × 9
bootloader × 9
memory-usage × 9
memory × 9
progmem × 9
programming × 8
arduino-nano × 8
avr × 7
nodemcu × 6
spi × 6
firmware × 6
serial × 5
attiny × 5
arduino-mega × 4
sd-card × 4
sketch × 4
uploading × 4
avrdude × 4
usb × 3