From 429d55769c3d9ade22d5727edae31fa15d5cc1da Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 30 Jun 2018 00:36:38 +0200 Subject: [PATCH] Revert "Remove -nostartfiles linker option from bootloader (#5996)" This reverts commit 17b4aa24668bc4b223dd0613a48d2cc050e39358. Removing the -nostartfiles caused the Taranis bootloader to include a number of strange functions. Instead define _fini to avoid the linker issues. --- .../targets/common/arm/stm32/bootloader/CMakeLists.txt | 3 ++- radio/src/targets/common/arm/stm32/bootloader/boot.cpp | 6 +++++- radio/src/targets/common/arm/stm32/bootloader/init.c | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 radio/src/targets/common/arm/stm32/bootloader/init.c diff --git a/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt b/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt index b1bc92ad8..c88ac1bb6 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt +++ b/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt @@ -73,6 +73,7 @@ set(BOOTLOADER_SRC ../usb_bsp.c ../usb_driver.cpp ../flash_driver.cpp + init.c boot.cpp bin_files.cpp ) @@ -111,7 +112,7 @@ remove_definitions(-DCLI) remove_definitions(-DUSB_SERIAL) add_definitions(-DBOOT) -set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -lm -T${RADIO_SRC_DIRECTORY}/targets/${TARGET_DIR}/stm32_ramboot.ld -Wl,-Map=bootloader.map,--cref,--no-warn-mismatch,--gc-sections") +set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -nostartfiles -lm -T${RADIO_SRC_DIRECTORY}/targets/${TARGET_DIR}/stm32_ramboot.ld -Wl,-Map=bootloader.map,--cref,--no-warn-mismatch,--gc-sections") add_executable(bootloader ${BOOTLOADER_SRC}) add_dependencies(bootloader ${BITMAPS_TARGET} firmware_translations) diff --git a/radio/src/targets/common/arm/stm32/bootloader/boot.cpp b/radio/src/targets/common/arm/stm32/bootloader/boot.cpp index 89e494ac0..48e42f342 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/boot.cpp +++ b/radio/src/targets/common/arm/stm32/bootloader/boot.cpp @@ -526,4 +526,8 @@ int main() } return 0; -} \ No newline at end of file +} + +#if defined(PCBHORUS) +void *__dso_handle = 0; +#endif diff --git a/radio/src/targets/common/arm/stm32/bootloader/init.c b/radio/src/targets/common/arm/stm32/bootloader/init.c new file mode 100644 index 000000000..16bee9834 --- /dev/null +++ b/radio/src/targets/common/arm/stm32/bootloader/init.c @@ -0,0 +1,9 @@ +void _init (void) +{ + +} + +void _fini(void) +{ + +}