Software

Creating ELF Files for ATtiny4/5/9/10

This code shows how to add memory sections for ATtiny10.

#include <avr/io.h>

typedef struct _tagConfig
{
    unsigned char f1;
} Config;

typedef struct _tagLock
{
    unsigned char f1;
} Lock;

typedef struct _tagSig
{
    unsigned char f1;
    unsigned char f2;
    unsigned char f3;
} Signature;

Config __config __attribute__((section(".config"))) =
{
    f1 : 0xfb, // Set CKOUT
};

Lock __lock __attribute__((section(".lock"))) =
{
    f1 : 0xfc, // Further programming and verification disabled
};

Signature __sig __attribute__((section(".signature"))) =
{
    f1 : 0x03,
    f2 : 0x90,
    f3 : 0x1e,
};

int main(void)
{
    while(1)
    {
        // TODO:: Write your application code
    }
}