Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Can anybody help me to get my ELF to contain fuses and lock bits? (Read 2074 times)
MayleeQ
Newbies
*
Offline


Posts: 1
Joined: Apr 10th, 2018
Can anybody help me to get my ELF to contain fuses and lock bits?
Apr 10th, 2018 at 3:47am
Print Post  
I am trying to embed code in my Attiny4 project that will set fuses and lock bits(In AtmelStudio 7). I copy/pasted the code that Atmel suggests here:
Code
Select All
#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,
}; 



Then i try to compile and it directly fails with the following errors:
Code
Select All
attiny4-fan.elf section `.config' will not fit in region `config'
region `config' overflowed by 1 bytes
ld returned 1 exit status
recipe for target 'attiny4-fan.elf' failed 



I can't seem to find any other information on how to do this for an ATTiny4/5/9/10. The Datasheet of ATTiny4/5/9/10 seems to mention something about the locations but since i have never done this before, especially not for the Attiny4 i'm playing with here, i have no idea on how to proceed.


This is the output of
Code
Select All
avr-objdump --section-headers


Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000000c8  00000000  00000000  00000074  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00800040  00800040  0000013c  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000003  00800040  00800040  0000013c  2**0
                  ALLOC
  3 .comment      00000030  00000000  00000000  0000013c  2**0
                  CONTENTS, READONLY
  4 .note.gnu.avr.deviceinfo 0000003c  00000000  00000000  0000016c  2**2
                  CONTENTS, READONLY
  5 .debug_info   000002ab  00000000  00000000  000001a8  2**0
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_abbrev 00000284  00000000  00000000  00000453  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_line   000000d3  00000000  00000000  000006d7  2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_str    000000f6  00000000  00000000  000007aa  2**0
                  CONTENTS, READONLY, DEBUGGING 



In the mean time, i also found out that in the ATtiny DFP header file for the Attiny4/5/9/10, the following macros are defined(ATtiny9 as example):
Code
Select All
/* Fuses */
#define FUSE_MEMORY_SIZE 0
/* Lock Bits */
#define __LOCK_BITS_EXIST
/* Signature */
#define SIGNATURE_0 0x1E
#define SIGNATURE_1 0x90
#define SIGNATURE_2 0x08 



Why would FUSE_MEMORY_SIZE be defined as 0?

Can anybody help me to get my ELF to contain fuses and lock bits?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can anybody help me to get my ELF to contain fuses and lock bits?
Reply #1 - Apr 10th, 2018 at 10:50am
Print Post  
Hi,

You are using Arduino code not Atmel code so please ask on the arduino.cc/forum

Atmel will not give you a useful answer.

Thanks
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint