mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 12:51:47 +00:00
Use the proper "-Wl,--undefined=BootloaderAPI_JumpTable" linker command line parameter in the bootloaders to ensure that the API jump tables are not discarded, rather than the previous C volatile pointer hack (thanks to Opendous Inc.).
This commit is contained in:
parent
d619214854
commit
075538abb9
@ -43,9 +43,6 @@
|
|||||||
|
|
||||||
#include <LUFA/Common/Common.h>
|
#include <LUFA/Common/Common.h>
|
||||||
|
|
||||||
/* External Variables: */
|
|
||||||
extern uint8_t* BootloaderAPI_JumpTable;
|
|
||||||
|
|
||||||
/* Function Prototypes: */
|
/* Function Prototypes: */
|
||||||
void BootloaderAPI_ErasePage(uint32_t Address);
|
void BootloaderAPI_ErasePage(uint32_t Address);
|
||||||
void BootloaderAPI_WritePage(uint32_t Address);
|
void BootloaderAPI_WritePage(uint32_t Address);
|
||||||
|
@ -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 */
|
/* Setup hardware required for the bootloader */
|
||||||
SetupHardware();
|
SetupHardware();
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ EXTMEMOPTS =
|
|||||||
# -Map: create map file
|
# -Map: create map file
|
||||||
# --cref: add cross reference to map file
|
# --cref: add cross reference to map file
|
||||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
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,--relax
|
||||||
LDFLAGS += -Wl,--gc-sections
|
LDFLAGS += -Wl,--gc-sections
|
||||||
LDFLAGS += $(EXTMEMOPTS)
|
LDFLAGS += $(EXTMEMOPTS)
|
||||||
|
@ -43,9 +43,6 @@
|
|||||||
|
|
||||||
#include <LUFA/Common/Common.h>
|
#include <LUFA/Common/Common.h>
|
||||||
|
|
||||||
/* External Variables: */
|
|
||||||
extern uint8_t* BootloaderAPI_JumpTable;
|
|
||||||
|
|
||||||
/* Function Prototypes: */
|
/* Function Prototypes: */
|
||||||
void BootloaderAPI_ErasePage(uint32_t Address);
|
void BootloaderAPI_ErasePage(uint32_t Address);
|
||||||
void BootloaderAPI_WritePage(uint32_t Address);
|
void BootloaderAPI_WritePage(uint32_t Address);
|
||||||
|
@ -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 */
|
/* Configure hardware required by the bootloader */
|
||||||
SetupHardware();
|
SetupHardware();
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ EXTMEMOPTS =
|
|||||||
# -Map: create map file
|
# -Map: create map file
|
||||||
# --cref: add cross reference to map file
|
# --cref: add cross reference to map file
|
||||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
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,--relax
|
||||||
LDFLAGS += -Wl,--gc-sections
|
LDFLAGS += -Wl,--gc-sections
|
||||||
LDFLAGS += $(EXTMEMOPTS)
|
LDFLAGS += $(EXTMEMOPTS)
|
||||||
|
Loading…
Reference in New Issue
Block a user