diff options
| author | Selene ToyKeeper | 2023-11-07 08:09:10 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2023-11-07 08:09:10 -0700 |
| commit | e00326a6db6671414b43ee15e092c57ea976102f (patch) | |
| tree | 314608a1c7ba0d0177cab6ead8186638aa8a7e64 /arch/mcu.h | |
| parent | memes (diff) | |
| download | anduril-e00326a6db6671414b43ee15e092c57ea976102f.tar.gz anduril-e00326a6db6671414b43ee15e092c57ea976102f.tar.bz2 anduril-e00326a6db6671414b43ee15e092c57ea976102f.zip | |
made build fail if eeprom data bigger than MCU's eeprom size
Based on techniques suggested by DurvalMenezes here:
https://github.com/ToyKeeper/anduril/pull/4
Diffstat (limited to '')
| -rw-r--r-- | arch/mcu.h | 24 |
1 files changed, 8 insertions, 16 deletions
@@ -5,14 +5,18 @@ // This helps abstract away the differences between various attiny MCUs. -// Choose your MCU here, or in the main .c file, or in the build script -//#define ATTINY 13 -//#define ATTINY 25 +// auto-detect eeprom size from avr-libc headers +#ifndef EEPROM_SIZE + #ifdef E2SIZE + #define EEPROM_SIZE E2SIZE + #elif defined(E2END) + #define EEPROM_SIZE (E2END+1) + #endif +#endif /******************** hardware-specific values **************************/ #if (ATTINY == 13) #define F_CPU 4800000UL - //#define EEPSIZE 64 #define V_REF REFS0 #define BOGOMIPS 950 #define ADMUX_VCC 0b00001100 @@ -22,7 +26,6 @@ #elif (ATTINY == 25) // TODO: Use 6.4 MHz instead of 8 MHz? #define F_CPU 8000000UL - //#define EEPSIZE 128 #define V_REF REFS1 #define BOGOMIPS (F_CPU/4000) #define ADMUX_VCC 0b00001100 @@ -33,7 +36,6 @@ #elif (ATTINY == 85) // TODO: Use 6.4 MHz instead of 8 MHz? #define F_CPU 8000000UL - //#define EEPSIZE 512 #define V_REF REFS1 #define BOGOMIPS (F_CPU/4000) // (1 << V_REF) | (0 << ADLAR) | (VCC_CHANNEL) @@ -59,21 +61,11 @@ #define AVRXMEGA3 #define F_CPU 10000000UL #define BOGOMIPS (F_CPU/4700) - #define EEPSIZE 128 #define DELAY_ZERO_TIME 1020 #else #error Hey, you need to define ATTINY. #endif -// auto-detect eeprom size from avr-libc headers -#ifndef EEPSIZE -#ifdef E2SIZE -#define EEPSIZE E2SIZE -#else -#define EEPSIZE (E2END+1) -#endif -#endif - #include <avr/interrupt.h> |
