Based on the Limifrog STM32L board examples, I am trying to setup my own toolchain for ARM development (STM32F40x based).
I get an error:
C:\Users\pmu\embedded\empty_stm32>make arm-none-eabi-gcc -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -I ./inc -I./../Libraries/CMSIS/Device/ST/STM32F4xx/Include -I./../Libraries/CMSIS/ Include -Os -Wall -ffunction-sections -fdata-sections -fno-exceptions -Wno-write -strings -o main src/main.c c:/program files (x86)/gnu tools arm embedded/4.9 2015q3/bin/../lib/gcc/arm-none -eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc.a(lib_a-exit.o): In function `exit': exit.c:(.text.exit+0x16): undefined reference to `_exit' collect2.exe: error: ld returned 1 exit status make: *** [main] Error 1
when compiling:
#include "My_Globals.h"
int main(void) {
  while(1) {
  }
  return 0;
}
What does this error mean? Why does it not occur in the Board examples above?
The Makefile
# Compilation Tools
CC      = arm-none-eabi-gcc
LD      = arm-none-eabi-ld
CP      = arm-none-eabi-objcopy
OD      = arm-none-eabi-objdump
SIZE    = arm-none-eabi-size
# Optimization (ß,1,2,s)
OPT = s
ROOT        = ./..
CMSIS_DIR   = $(ROOT)/Libraries/CMSIS
HAL_DIR     = $(ROOT)/Libraries/CMSIS/Include
SRC         = ./src
INC_LOCAL  = ./inc
INCLUDES   =  \
    $(INC_LOCAL) \
    $(CMSIS_DIR)/Device/ST/STM32F4xx/Include \
    $(CMSIS_DIR)/Include
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
LD_FLAGS   = 
# Compiler flags
CFLAGS =  \
    $(ARCH_FLAGS) \
    $(addprefix -I,$(INCLUDES)) \
    -O$(OPT) \
    -Wall \
    -ffunction-sections \
    -fdata-sections \
    -fno-exceptions \
    -Wno-write-strings
main:
    @echo "start"
    @echo $@
    $(CC) $(LDFLAGS) $(CFLAGS) -o $@ src/main.c
Now, what libraries can be used to re-use the implementation of _exit() from elsewhere?
 
    
Refer to https://stackoverflow.com/questions/19419782/exit-c-text0x18-undefined-reference-to-exit-when-using-arm-none-eabi-gcc – Lak Fu Aug 21 '17 at 03:09