Hi,
I think current firmware compile and update procedure is too complex. I don't care to lost 1K flash in order to have Arduino UART bootloader.
So, I've tried to compile 1.43m firmware with Arduino tools and after a few modifications compilation succeeds.
What I did:
- Created the empty ComponentTester.ino within ComponentTester folder (in that case Arduino should use existing main() from main.c)
- replaced check for ATmega328 to #if defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) in config
- replaced include paths for fonts to include bitmap in include path
- run arduino-cli compile --verbose --fqbn arduino:avr:pro ComponentTester
Of course, nothing works after upload
I've checked some obvious things.
First of all, compilation flags a little different,
Makefile:
avr-gcc -mmcu=atmega328 -Wall -I. -Ibitmaps -DF_CPU=16000000UL -DOSC_STARTUP=16384 -gdwarf-2 -std=gnu99 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT main.o -MF dep/main.o.d -c main.c
Arduino:
avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR -I/Users/apla/Library/Arduino15/packages/arduino/hardware/avr/1.8.3/cores/arduino -I/Users/apla/Library/Arduino15/packages/arduino/hardware/avr/1.8.3/variants/eightanaloginputs main.c -o main.c.o
Makefile have -DOSC_STARTUP=16384 -gdwarf-2 -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums and some -M flags for Makefile rules
Arduino have -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects and includes cores, which is not used anyway.
Some I don't understand, will they affect resulting code or no. If someone can tell me which flag to add, I would be very grateful. Or what I should inspect.
Maybe it's not working because Arduino and TransistorTester have different entry points in flash. I spend some time reading about it, but didn't find good clear explanation.
My next problem can be with the SH1106 screen I've used. With Arduino screen runs fine, but for TransistorTester I opted for hardware I2C and maybe I have working device, but screen not works.
Maybe someone willing to help?