So far I got my board programmable but I still run into issues with PSTR.
I cannot get text displayed on screen if I use PSTR macros.
When I was using Arduino Nano it did work.
I believe there is something related to how memory gets organized.
[plaformio]
env_default = atmega1284
[env:atmega1284]
platform = atmelavr
board = 1284p16m
framework = arduino
board_build.mcu = atmega1284p
board_build.f_cpu = 16000000L
lib_extra_dirs = ~/Documents/Arduino/libraries
upload_protocol = avrispmkII
build_flags = -Wl,-Map,output.map
This is how PSTR is being used in context nanodds/screen.h at master · zoonman/nanodds · GitHub
After digging through all that stuff I ended up with firmware.lst which I got using following command ~/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-objdump -h -S firmware.elf > firmware.lst
firmware.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000122 00800100 00008abe 00008b52 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 00008abe 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00001eea 00800222 00800222 00008c74 2**0
ALLOC
3 .comment 00000011 00000000 00000000 00008c74 2**0
CONTENTS, READONLY
4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00008c88 2**2
CONTENTS, READONLY
5 .debug_aranges 00000380 00000000 00000000 00008cc8 2**3
CONTENTS, READONLY, DEBUGGING
6 .debug_info 00001ab6 00000000 00000000 00009048 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_abbrev 00000959 00000000 00000000 0000aafe 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 0000148c 00000000 00000000 0000b457 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_str 00000296 00000000 00000000 0000c8e3 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
.......
00000302 <_ZZ16displayFrequencyvE3__c>:
302: 46 72 65 71 75 65 6e 63 79 3a 00 Frequency:.
........
To the best of my knowledge it looks like it places the data into correct place. I assume .text supposed to store program text which is exactly what we have.
But I don’t understand why it doesn’t get displayed.
My guesses - compiler doesn’t place static address back or this address is wrong or something prevents/doesn’t do pgm_read.