Use the proper "-Wl,--undefined=BootloaderAPI_JumpTable" linker command line paramete...
authorDean Camera <dean@fourwalledcubicle.com>
Wed, 23 Nov 2011 14:09:01 +0000 (14:09 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Wed, 23 Nov 2011 14:09:01 +0000 (14:09 +0000)
Bootloaders/CDC/BootloaderAPI.h
Bootloaders/CDC/BootloaderCDC.c
Bootloaders/CDC/makefile
Bootloaders/DFU/BootloaderAPI.h
Bootloaders/DFU/BootloaderDFU.c
Bootloaders/DFU/makefile

index 9c9d5a4..e970912 100644 (file)
@@ -43,9 +43,6 @@
                
                #include <LUFA/Common/Common.h>
        
                
                #include <LUFA/Common/Common.h>
        
-       /* External Variables: */
-               extern uint8_t* BootloaderAPI_JumpTable;
-       
        /* Function Prototypes: */
                void    BootloaderAPI_ErasePage(uint32_t Address);
                void    BootloaderAPI_WritePage(uint32_t Address);
        /* Function Prototypes: */
                void    BootloaderAPI_ErasePage(uint32_t Address);
                void    BootloaderAPI_WritePage(uint32_t Address);
index f336a13..7695e33 100644 (file)
@@ -63,10 +63,6 @@ static bool RunBootloader = true;
  */
 int main(void)
 {
  */
 int main(void)
 {
-       /* Force a reference to the API jump table to prevent the linker from discarding it */
-       uint8_t* volatile Dummy = BootloaderAPI_JumpTable;
-       (void)Dummy;
-
        /* Setup hardware required for the bootloader */
        SetupHardware();
 
        /* Setup hardware required for the bootloader */
        SetupHardware();
 
index 6598226..f98372d 100644 (file)
@@ -340,7 +340,7 @@ EXTMEMOPTS =
 #    -Map:      create map file
 #    --cref:    add cross reference to  map file
 LDFLAGS  = -Wl,-Map=$(TARGET).map,--cref
 #    -Map:      create map file
 #    --cref:    add cross reference to  map file
 LDFLAGS  = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--section-start=.text=$(BOOT_START) -Wl,--section-start=.apitable=$(BOOT_API_TABLESTART)
+LDFLAGS += -Wl,--section-start=.text=$(BOOT_START) -Wl,--section-start=.apitable=$(BOOT_API_TABLESTART) -Wl,--undefined=BootloaderAPI_JumpTable
 LDFLAGS += -Wl,--relax
 LDFLAGS += -Wl,--gc-sections
 LDFLAGS += $(EXTMEMOPTS)
 LDFLAGS += -Wl,--relax
 LDFLAGS += -Wl,--gc-sections
 LDFLAGS += $(EXTMEMOPTS)
index 9c9d5a4..e970912 100644 (file)
@@ -43,9 +43,6 @@
                
                #include <LUFA/Common/Common.h>
        
                
                #include <LUFA/Common/Common.h>
        
-       /* External Variables: */
-               extern uint8_t* BootloaderAPI_JumpTable;
-       
        /* Function Prototypes: */
                void    BootloaderAPI_ErasePage(uint32_t Address);
                void    BootloaderAPI_WritePage(uint32_t Address);
        /* Function Prototypes: */
                void    BootloaderAPI_ErasePage(uint32_t Address);
                void    BootloaderAPI_WritePage(uint32_t Address);
index 078d59d..6e0c95d 100644 (file)
@@ -99,10 +99,6 @@ static uint16_t EndAddr = 0x0000;
  */
 int main(void)
 {
  */
 int main(void)
 {
-       /* Force a reference to the API jump table to prevent the linker from discarding it */
-       uint8_t* volatile Dummy = BootloaderAPI_JumpTable;
-       (void)Dummy;
-
        /* Configure hardware required by the bootloader */
        SetupHardware();
 
        /* Configure hardware required by the bootloader */
        SetupHardware();
 
index bd7120d..87cfd07 100644 (file)
@@ -335,7 +335,7 @@ EXTMEMOPTS =
 #    -Map:      create map file
 #    --cref:    add cross reference to  map file
 LDFLAGS  = -Wl,-Map=$(TARGET).map,--cref
 #    -Map:      create map file
 #    --cref:    add cross reference to  map file
 LDFLAGS  = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--section-start=.text=$(BOOT_START) -Wl,--section-start=.apitable=$(BOOT_API_TABLESTART)
+LDFLAGS += -Wl,--section-start=.text=$(BOOT_START) -Wl,--section-start=.apitable=$(BOOT_API_TABLESTART) -Wl,--undefined=BootloaderAPI_JumpTable
 LDFLAGS += -Wl,--relax
 LDFLAGS += -Wl,--gc-sections
 LDFLAGS += $(EXTMEMOPTS)
 LDFLAGS += -Wl,--relax
 LDFLAGS += -Wl,--gc-sections
 LDFLAGS += $(EXTMEMOPTS)