forked from ArminJo/micronucleus-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.inc
64 lines (57 loc) · 3 KB
/
Makefile.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Name: Makefile
# Project: Micronucleus
# License: GNU GPL v2 (see License.txt)
# Controller type: ATtiny 85 - 16.5 MHz
# Configuration: Default + ENTRY_POWER_ON + FAST_EXIT_NO_USB_MS=300
# Last Change: Jun 16,2020
F_CPU = 16500000
DEVICE = attiny85
# hexadecimal address for bootloader section to begin. To calculate the best value:
# - make clean; make main.hex; ### output will list data: 2124 | 1624 (or something like that)
# - for the size of your device (8kb = 1024 * 8 = 8192) subtract above value = 6068 | 5668
# - How many pages in is that? 6068 / 64 (tiny85 page size in bytes) = 94.8125 | 102.625
# - round that down to 94 | 102
# - our new bootloader address is 94 | 102 * 64 = 6016 | 6528, in hex = 1780 | 1980
# - The available size for user program is (BOOTLOADER_ADDRESS - POSTSCRIPT_SIZE) with POSTSCRIPT_SIZE = 4 or 6
# - For data size from 1470 up to 1536 the address is 1A00 (6650 free),
# - for 1538 to 1600 it is 19C0 (6586 free), for 1602 to 1664 it is 1980 (6522 free)
BOOTLOADER_ADDRESS = 19C0
FUSEOPT = -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m
FUSEOPT_DISABLERESET = -U lfuse:w:0xe1:m -U efuse:w:0xfe:m -U hfuse:w:0x5d:m
#---------------------------------------------------------------------
# ATtiny85
#---------------------------------------------------------------------
# Fuse extended byte:
# 0xFE = - - - - - 1 1 0
# ^
# |
# +---- SELFPRGEN (enable self programming flash)
#
# Fuse high byte:
# 0xdd = 1 1 0 1 1 1 0 1
# ^ ^ ^ ^ ^ \-+-/
# | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V)
# | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved)
# | | | +-------------- WDTON (watchdog timer always on -> disable)
# | | +---------------- SPIEN (enable serial programming -> enabled)
# | +------------------ DWEN (debug wire enable)
# +-------------------- RSTDISBL (disable external reset -> enabled)
#
# Fuse high byte ("no reset": external reset disabled, can't program through SPI anymore)
# 0x5d = 0 1 0 1 1 1 0 1
# ^ ^ ^ ^ ^ \-+-/
# | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V)
# | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved)
# | | | +-------------- WDTON (watchdog timer always on -> disable)
# | | +---------------- SPIEN (enable serial programming -> enabled)
# | +------------------ DWEN (debug wire enable)
# +-------------------- RSTDISBL (disable external reset -> disabled!)
#
# Fuse low byte:
# 0xe1 = 1 1 1 0 0 0 0 1
# ^ ^ \+/ \--+--/
# | | | +------- CKSEL 3..0 (clock selection -> HF PLL)
# | | +--------------- SUT 1..0 (BOD enabled, fast rising power)
# | +------------------ CKOUT (clock output on CKOUT pin -> disabled)
# +-------------------- CKDIV8 (divide clock by 8 -> don't divide)
###############################################################################