IntruderChronB doesn't verify

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
fovea1959
 
Posts: 26
Joined: Tue Jan 29, 2013 2:39 pm

IntruderChronB doesn't verify

Post by fovea1959 »

firstly: I'm happy with my MonoChron. Haven't done a kit in decades, twas a Father's Day present, had it functioning in under 2 hours, and worked perfectly the first time.

just tried my first firmware loads on my MonoChron this morning. XDaliChron loaded fine, and was able to load MultiChron after fixing the provided download script to account for using a FTDI friend instead of a USBTiny.

I can't load MultiChronB. Keep getting a verify error at x7800 on the flash. Is MultiChronB too big to be loaded with an FTDI Friend (failing on a x200 boundary looks suspicious), do I have bad flash there, am I doing something wrong?

Code: Select all

C:\Users\wegscd\Documents\MultiChron>avrdude -P com9 -p m328p -c arduino -b 5760
0 -U flash:w:MultiChronB.hex -U eeprom:w:MultiChronB.eep

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "MultiChronB.hex"
avrdude: input file MultiChronB.hex auto detected as Intel Hex
avrdude: writing flash (30776 bytes):

Writing | ################################################## | 100% 16.86s

avrdude: 30776 bytes of flash written
avrdude: verifying flash memory against MultiChronB.hex:
avrdude: load data flash data from input file MultiChronB.hex:
avrdude: input file MultiChronB.hex auto detected as Intel Hex
avrdude: input file MultiChronB.hex contains 30776 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 14.29s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x7800
         0x03 != 0x0c
avrdude: verification error; content mismatch

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: IntruderChronB doesn't verify

Post by adafruit2 »

ooh yeah it looks like its too big to fit with the bootloader. you may have to use an ISP programmer :(

User avatar
fovea1959
 
Posts: 26
Joined: Tue Jan 29, 2013 2:39 pm

Re: IntruderChronB doesn't verify

Post by fovea1959 »

the limit is x7800 if using bootloader, and 0x8000 if using ISP programmer?

What is an appropriate ISP Programmer? I know almost nothing on embedded (am learning with Arduinos, this, and Trinkets...)

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: IntruderChronB doesn't verify

Post by adafruit_support_bill »

The USBTinyISP is what most people use.

af3556
 
Posts: 17
Joined: Sat Jul 11, 2009 3:46 am

Re: IntruderChronB doesn't verify

Post by af3556 »

The size of the space reserved for the bootloader is configurable via fuses, from 128 to 1k of flash; ref BOOTSZ flags. e.g. for an ATMega328p with 32k flash, and BOOTSZ flags set to 01 (512 words), the maximum program size is something like 0x7dff (32255) bytes.

ISP Programmer: the usbasp - an open design authored by www.fischl.de/usbasp/ - is really cheaply and commonly available and works well. There are a few variants around, most any/all will work on 5V but if you want to do 3V stuff make sure to check the board you buy has a jumper for selecting the voltage (for many, including mine, you need to bridge solder pads or remove a resistor, not so convenient for a quick change).

User avatar
fovea1959
 
Posts: 26
Joined: Tue Jan 29, 2013 2:39 pm

Re: IntruderChronB doesn't verify

Post by fovea1959 »

ok...

so to make this fit, I need to scrap the bootloader?

af3556
 
Posts: 17
Joined: Sat Jul 11, 2009 3:46 am

Re: IntruderChronB doesn't verify

Post by af3556 »

[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;

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”