[update: I'd previously implied the flash required is just the .text section, but as
http://www.nongnu.org/avr-libc/user-man ... tions.html notes "in order to know how much flash the final program will consume, one needs to add the values for both, .text and .data (but not .bss)"]
It should fit as-is (i.e. with the 512B reserved for the bootloader). I'd played with multichron from
https://github.com/BANNED/monochron.git earlier - with at least recent avr-gcc versions the 'MultichronB' config comes out to about 29612+306=29918 bytes, which should fit no problems. I just flashed this MultichronB build, using a usbasp, and it wrote without error (.hex and .eep:
https://dl.dropboxusercontent.com/u/914 ... chronB.zip).
Code: Select all
MultiChronB.elf :
section size addr
.data 306 8388864
.text 29612 0
.bss 344 8389170
.eeprom 1006 8454144
... (.debug sections trimmed)
The above is with avr-gcc 4.8.1; 4.7.2 gives slightly smaller .text size of 29600 bytes. The code needs to be patched to build with more recent GCC versions that insist on PROGMEM being const:
Code: Select all
diff --git a/firmware/anim_abo.c b/firmware/anim_abo.c
index 60fa69c..5e2e29d 100644
--- a/firmware/anim_abo.c
+++ b/firmware/anim_abo.c
@@ -18,7 +18,7 @@ extern volatile uint8_t time_s;
#ifdef DEATHCHRON
extern const uint8_t adafruit[];
-PGM_P logo_p PROGMEM = (prog_char *) adafruit;
+PGM_P const logo_p PROGMEM = (PGM_P) adafruit;
void death_blitsegs_rom(int16_t x_origin, uint8_t y_origin, PGM_P bitmap_p, uint8_t width, uint8_t height, uint8_t inverted);
#endif
diff --git a/firmware/anim_death.c b/firmware/anim_death.c
index 3e381d5..f2c5477 100755
--- a/firmware/anim_death.c
+++ b/firmware/anim_death.c
@@ -54,9 +54,9 @@ extern const uint8_t rip_on_white[];
// special pointer for reading from ROM memory
-PGM_P skull0_p PROGMEM = (prog_char *) skull_on_white;
-PGM_P reaper0_p PROGMEM = (prog_char *) reaper_on_white;
-PGM_P rip0_p PROGMEM = (prog_char *) rip_on_white;
+PGM_P const skull0_p PROGMEM = (PGM_P) skull_on_white;
+PGM_P const reaper0_p PROGMEM = (PGM_P) reaper_on_white;
+PGM_P const rip0_p PROGMEM = (PGM_P) rip_on_white;
void death_blitsegs_rom(int16_t x_origin, uint8_t y_origin, PGM_P bitmap_p, uint8_t width, uint8_t height, uint8_t inverted);
void drawdisplay_death(uint8_t inverted);
diff --git a/firmware/anim_gps.c b/firmware/anim_gps.c
index 38ad502..766d7d2 100644
--- a/firmware/anim_gps.c
+++ b/firmware/anim_gps.c
@@ -20,7 +20,7 @@ extern volatile uint8_t just_pressed;
extern volatile uint8_t displaystyle;
extern volatile uint8_t displaymode;
-uint8_t GPS_Text[] PROGMEM = "\x0A" "GPS Setup\0"
+const uint8_t GPS_Text[] PROGMEM = "\x0A" "GPS Setup\0"
"\x01" "\0"
"\x0B" "Offset : \0"
"\x11" "Status : NOLOCK\0"
diff --git a/firmware/anim_xda.c b/firmware/anim_xda.c
index ab6d494..cabcc08 100755
--- a/firmware/anim_xda.c
+++ b/firmware/anim_xda.c
@@ -43,8 +43,8 @@ extern const uint8_t zero_seg[];
extern const uint8_t one_seg[];
// special pointer for reading from ROM memory
-PGM_P zero_p PROGMEM = (prog_char *) zero_seg;
-PGM_P one_p PROGMEM = (prog_char *) one_seg;
+PGM_P const zero_p PROGMEM = (PGM_P) zero_seg;
+PGM_P const one_p PROGMEM = (PGM_P) one_seg;
// Protypes
// Called from dispatcher:
@@ -354,7 +354,7 @@ void read_line(uint8_t d, uint8_t line, uint8_t *lineinfo, uint8_t *segs)
#else // read compressed
#define SEG_TERM 31
- uint16_t x = zero_p +
+ uint16_t x = (uint16_t) zero_p +
((uint16_t) d) * ((DIGIT_HEIGHT/2)*5) // 5 bytes per 2 lines
+(line/2)*5; // x is same for odd & even lines
if(line & 1) { // phase 1
diff --git a/firmware/config.c b/firmware/config.c
index b79d5ae..236897f 100644
--- a/firmware/config.c
+++ b/firmware/config.c
@@ -395,9 +395,9 @@ void set_backlight(void) {
#ifdef OPTION_DOW_DATELONG
-uint8_t region_setting_table[12][13] PROGMEM = {
+const char region_setting_table[12][13] PROGMEM = {
#else
-uint8_t region_setting_table[4][13] PROGMEM = {
+const char region_setting_table[4][13] PROGMEM = {
#endif
" US 12hr",
" US 24hr",
@@ -636,7 +636,7 @@ void print_alarmhour(uint8_t h, uint8_t inverted) {
}
}
-uint8_t style_setting_str[] PROGMEM = {
+const char style_setting_str[] PROGMEM = {
#ifdef RATTCHRON
STYLE_RAT,'R','A','T','T','C','h','r','o','n',0,
#endif
diff --git a/firmware/eeprom.c b/firmware/eeprom.c
index 09a4b3b..9295249 100644
--- a/firmware/eeprom.c
+++ b/firmware/eeprom.c
@@ -28,7 +28,7 @@
#define EE_INITIALIZED 0xC3
#define EE_VERSION 2
-uint8_t PROGMEM EE_DATA[1] = { (uint8_t)(EE_INITIALIZED + EE_VERSION + STYLE_ABOUT) };
+const uint8_t PROGMEM EE_DATA[] = { (uint8_t)(EE_INITIALIZED + EE_VERSION + STYLE_ABOUT) };
uint8_t EEMEM EE_INIT=(uint8_t)(EE_INITIALIZED + EE_VERSION + STYLE_ABOUT);
uint8_t EEMEM EE_ALARM_HOUR=7;
uint8_t EEMEM EE_ALARM_MIN=30;
@@ -186,7 +186,7 @@ unsigned char EEMEM Font5x7[] = {
-unsigned char PROGMEM FontGr[] =
+const unsigned char PROGMEM FontGr[] =
{
// format is one character per line:
// length, byte array[length]
diff --git a/firmware/ratt.h b/firmware/ratt.h
index eb325af..f8415da 100755
--- a/firmware/ratt.h
+++ b/firmware/ratt.h
@@ -343,7 +343,7 @@ enum {
#define EE_TIME_FORMAT 6
#define EE_SNOOZE 7*/
-extern uint8_t EE_DATA[];
+extern const uint8_t EE_DATA[];
extern uint8_t EE_INIT;
extern uint8_t EE_ALARM_HOUR;
extern uint8_t EE_ALARM_MIN;