Browse Source

Fix sizeof(VERSION_STRING)

- sizeof(info) should not be increased (16->18) since the size is never
  exchanged with the I2C master. Also using a non 2^x size will result
  in bigger code since the compiler can no longer use a simple AND to
  implement the bcnt %= sizeof(info).

- when using a info[16] the firmware is small enough to fit in a 512
  word bootloader again :)
master
Olaf Rempel 4 years ago
parent
commit
bc5d45359a
2 changed files with 4 additions and 4 deletions
  1. 2
    2
      Makefile
  2. 2
    2
      main.c

+ 2
- 2
Makefile View File

@@ -42,9 +42,9 @@ endif
42 42
 ifeq ($(MCU), atmega328p)
43 43
 # (8Mhz internal RC-Osz., 2.7V BOD)
44 44
 AVRDUDE_MCU=m328p -F
45
-AVRDUDE_FUSES=lfuse:w:0xc2:m hfuse:w:0xda:m efuse:w:0xfd:m
45
+AVRDUDE_FUSES=lfuse:w:0xc2:m hfuse:w:0xdc:m efuse:w:0xfd:m
46 46
 
47
-BOOTLOADER_START=0x7800
47
+BOOTLOADER_START=0x7C00
48 48
 endif
49 49
 
50 50
 # ---------------------------------------------------------------------------

+ 2
- 2
main.c View File

@@ -55,7 +55,7 @@
55 55
 #define SIGNATURE_BYTES		0x1E, 0x94, 0x06
56 56
 
57 57
 #elif defined (__AVR_ATmega328P__)
58
-#define VERSION_STRING		"TWIBOOT m328pv2.1"
58
+#define VERSION_STRING		"TWIBOOTm328pv2.1"
59 59
 #define SIGNATURE_BYTES		0x1E, 0x95, 0x0F
60 60
 
61 61
 #else
@@ -154,7 +154,7 @@
154 154
  *   SLA+W, 0x02, 0x02, addrh, addrl, {* bytes}, STO
155 155
  */
156 156
 
157
-const static uint8_t info[18] = VERSION_STRING;
157
+const static uint8_t info[16] = VERSION_STRING;
158 158
 const static uint8_t chipinfo[8] = {
159 159
 	SIGNATURE_BYTES,
160 160
 

Loading…
Cancel
Save