ATtiny13A vs ATtiny212 massive used Flash and SRAM difference

I am utterly confused by the following results, tiny13a 0 bytes of SRAM & 88 bytes of flash, tiny212 69 bytes of SRAM & 1754 bytes of flash! anyone got any ideas?
Code being compiled is as follows

#include <Arduino.h>

void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.print('A');
}

Output from compilation for AT tiny 13a is:

Processing attiny13a (platform: atmelavr; board: attiny13a; framework: arduino)
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
    CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/attiny13a.html
    PLATFORM: Atmel AVR (3.3.0) > ATtiny13A
    HARDWARE: ATTINY13A 9MHz, 64B RAM, 1KB Flash
    DEBUG: Current (simavr) On-board (simavr)
    PACKAGES:
     - framework-arduino-avr-microcore 2.0.3
     - toolchain-atmelavr 1.70300.191015 (7.3.0)
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 4 compatible libraries
    Scanning dependencies...
    No dependencies
    Building in release mode
    Compiling .pio\build\attiny13a\src\main.cpp.o
    Linking .pio\build\attiny13a\firmware.elf
    Checking size .pio\build\attiny13a\firmware.elf
    Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
    RAM:   [          ]   0.0% (used 0 bytes from 64 bytes)
    Flash: [=         ]   8.6% (used 88 bytes from 1024 bytes)
    Building .pio\build\attiny13a\firmware.hex
    ============================================================================================ [SUCCESS] Took 1.15 seconds

Output from AT tiny 212 is

Processing ATtiny212 (platform: atmelmegaavr; board: ATtiny212; framework: arduino)
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
    CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/ATtiny212.html
    PLATFORM: Atmel megaAVR (1.4.0) > ATtiny212
    HARDWARE: ATTINY212 16MHz, 128B RAM, 2KB Flash
    PACKAGES:
     - framework-arduino-megaavr-megatinycore 2.1.5
     - toolchain-atmelavr 2.70300.201015 (7.3.0)
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 12 compatible libraries
    Scanning dependencies...
    No dependencies
    Building in release mode
    Compiling .pio\build\ATtiny212\src\main.cpp.o
    Linking .pio\build\ATtiny212\firmware.elf
    Checking size .pio\build\ATtiny212\firmware.elf
    Building .pio\build\ATtiny212\firmware.hex
    Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
    RAM:   [=====     ]  53.9% (used 69 bytes from 128 bytes)
    Flash: [========= ]  85.6% (used 1754 bytes from 2048 bytes)
    ============================================================================================ [SUCCESS] Took 1.42 seconds

Does seem to be a difference in the way the serial port implementation is handled, for the tiny13a the picoUART is used and a different package i.e. the avr-microcore as opposed to the tiny 212 which is using megatinycore with vastly different implementations, 1.8k to send a char over a hardware serial port vs 88 bytes to software bit bang it.

So the question is how to make it compile for my 212 using the microcore if that is even possible.
¯_(ツ)_/¯

This release is quite old, via the Arduino IDE you can get 2.3.1, via the github release page though… 2.3.0.

In any case, when using 2.3.1, via the Arduino IDE, the sketch outright does not compile.

c:/[…]avr/bin/ld.exe: address 0x850 of C:\Users\Max\AppData\Local\Temp\arduino_build_888528/sketch_may10a.ino.elf section .text' is not within region text’
c:/[…]avr/bin/ld.exe: region `text’ overflowed by 124 bytes
collect2.exe: error: ld returned 1 exit status
exit status 1

The sketch would take up 2172 bytes of flash of the available 2048 bytes.

I see you’ve already opened Confused about SRAM and Flash usage between ATtiny13a and ATtiny212 · Issue #415 · SpenceKonde/megaTinyCore · GitHub – that’s the right place for it.

1 Like

Thanks for the double check and new version test, I reckon my current project will end up being a hard coded collection of bits from the microcore!