I'm trying to use gcc in MDK-ARM.In CubeMX I generated a simple project for STM32F407.I generate project for MDK-ARK and SW4STM32 too.In MDK-ARM I switch complier on gcc and install last Gcc for ARM.In first step I replace keil strtup assembler file startup_STM32F407.,s with same files form project for SW4STM32 which is in the assembeller for gccIn second step I use Linker scipt file STM32F407VETx_FLASH.ld from project SW4STM32.
All files will be compiled OK, but linke ld end with error
Where is the problem?
c:/gcc/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/keil/gcc/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/nofp\libc.a(lib_a-init.o): in function `__libc_init_array': init.c:(.text.__libc_init_array+0x20): undefined reference to `_init' collect2.exe: error: ld returned 1 exit status ".\STM32F407.elf" - 1 Error(s), 0 Warning(s).
try adding this to one of your C files
void _init() {}
That will fix your current issue.