The following resources should help you get started with an eclipse toolchain. I didn’t try coocox because it is way too shady and I wanted to learn some stuff. Also, these aren’t targeted at .netmf porting, so you may need to adapt.
Setting up an Eclipse-based IDE (updated)- ChibiOS free embedded RTOS - This topic does not exist yet
Using an Eclipse-based IDE (updated)
The makefile i use on my toolchain(based on Yagarto’s):
#
# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
#
##############################################################################################
#
# On command line:
#
# make all = Create project
#
# make clean = Clean project files.
#
# To rebuild project do "make clean" and "make all".
#
##############################################################################################
# Start of default section
#
TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CPP = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
LD = $(CC)
BIN = $(CP) -O ihex
MCU = cortex-m4
# List all default C defines here, like -D_DEBUG=1
DDEFS =
# List all default ASM defines here, like -D_DEBUG=1
DADEFS =
# List all default directories to look for include files here
DINCDIR = ../..\Libraries\CMSIS\Include \
../..\Libraries\CMSIS\ST\STM32F4xx\Include \
../..\Libraries\STM32F4xx_StdPeriph_Driver\inc \
../..\Libraries\STM32_USB_OTG_Driver\inc \
../..\Libraries\STM32_USB_Device_Library\Core\inc \
../..\Libraries\STM32_USB_Device_Library\Class\audio\inc \
../..\Libraries\STM32_USB_Device_Library\Class\cdc\inc \
../..\Libraries\STM32_USB_Device_Library\Class\dfu\inc \
../..\Libraries\STM32_USB_Device_Library\Class\hid\inc \
../..\Libraries\STM32_USB_Device_Library\Class\msc\inc \
../..\Libraries\STM32_USB_HOST_Library\Core\inc \
../..\Libraries\STM32_USB_HOST_Library\Class\MSC\inc \
../..\Libraries\STM32_USB_HOST_Library\Class\HID\inc \
../..\Utilities\STM32F4-Discovery \
../..\Utilities\Third_Party\fat_fs\inc
# List the default directory to look for the libraries here
DLIBDIR =
# List all default libraries here
DLIBS = -lc -lm -lgcc -lstdc++
#
# End of default section
##############################################################################################
##############################################################################################
# Start of user section
#
#
# Define project name and Ram/Flash mode here
PROJECT = template
#
# Define linker script file here(OVERRIDES DEFAULT)
#
LDSCRIPT =
FULL_PRJ = $(PROJECT)
# List all user C define here, like -D_DEBUG=1
UDEFS = -DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DHSE_VALUE=8000000
# Define ASM defines here
UADEFS =
# List C source files here
CSRC = ./src/stm32f4xx_it.c \
./src/system_stm32f4xx.c \
./src/main.c
# List Cpp source files here
CPPSRC =
# List ASM source files here
ASRC = ./src/startup_stm32f4xx.S
# List all user directories here
UINCDIR = ./inc
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS =
#
# End of user defines
##############################################################################################
ifndef LDSCRIPT
ifdef CPPSRC
LDSCRIPT = ./LinkerScripts/stm32f4xx_flash_cpp.ld
DADEFS+= -DCPPMAKE
LD = $(CPP)
else
LDSCRIPT = ./LinkerScripts/stm32f4xx_flash.ld
endif
endif
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS)
OBJS = $(CSRC:.c=.o) $(CPPSRC:.cpp=.o) $(ASRC:.S=.o)
LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mthumb -mcpu=$(MCU) -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
GFLAGS = -O0 -gdwarf-2 -Wall -ffunction-sections -fdata-sections -fomit-frame-pointer -fverbose-asm
ASFLAGS = $(MCFLAGS) -gdwarf-2 -Wa,-amhls=$(<:.S=.lst) $(ADEFS)
CFLAGS = $(MCFLAGS) $(GFLAGS) -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
CPPFLAGS = $(MCFLAGS) $(GFLAGS) -fno-rtti -fno-exceptions -Wa,-ahlms=$(<:.cpp=.lst) $(DEFS)
LDFLAGS = $(MCFLAGS) -T$(LDSCRIPT) -Wl,-Map=$(FULL_PRJ).map,--cref,--no-warn-mismatch,--gc-sections $(LIBDIR)
# Generate dependency information
CFLAGS += -MD -MP -MF .dep/$(@ F).d
CPPFLAGS += -MD -MP -MF .dep/$(@ F).d
#
# makefile rules
#
all: $(OBJS) $(FULL_PRJ).elf $(FULL_PRJ).hex
%.o : %.c
$(CC) -c $(CFLAGS) -I . $(INCDIR) $< -o $@
%.o : %.cpp
$(CPP) -c $(CPPFLAGS) -I . $(INCDIR) $< -o $@
%.o : %.S
$(AS) -c $(ASFLAGS) $< -o $@
%elf: $(OBJS)
$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
%hex: %elf
$(BIN) $< $@
clean:
-rm -f $(OBJS)
-rm -f $(FULL_PRJ).elf
-rm -f $(FULL_PRJ).map
-rm -f $(FULL_PRJ).hex
-rm -f $(CSRC:.c=.c.bak)
-rm -f $(CSRC:.c=.lst)
-rm -f $(CPPSRC:.cpp=.cpp.bak)
-rm -f $(CPPSRC:.cpp=.lst)
-rm -f $(ASRC:.S=.S.bak)
-rm -f $(ASRC:.S=.lst)
-rm -fR .dep
#
# Include the dependency files, should be the last of the makefile
#
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# *** EOF ***
my linker scripts(based on Atollic, Yagarto, ARM, etc ;)):
stm32f4xx_flash.ld
/*
**
** Standard linking descriptor for arm-none-eabi-gcc
**
*/
/* Entry Point */
ENTRY(Reset_Handler)
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 112K
}
_estack = ORIGIN(RAM) + LENGTH(RAM); /*0x2001c000 end of 112K RAM */
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
.isr_vector :
{
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
*(.eh_frame)
_etext = ALIGN(4);
} >FLASH
/* used by the startup to initialize data */
_sidata = .;
/* Initialized data sections goes into RAM, load LMA copy after code */
.data : AT ( _sidata )
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM
/* Uninitialized data section */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
}
stm32f4_flash_cpp.ld
/*
**
** Standard linking descriptor for arm-none-eabi-gcc
**
*/
GROUP(libgcc.a libc.a libm.a)
/* Entry Point */
ENTRY(Reset_Handler)
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 112K
}
HEAP_SIZE = 0;
STACK_MAX_SIZE = LENGTH(RAM);
_estack = ORIGIN(RAM) + LENGTH(RAM); /*0x2001c000 end of 112K RAM */
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
.isr_vector :
{
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
*(.text .text.* .gnu.linkonce.t.*)
*(.plt)
*(.gnu.warning)
*(.vfp11_veneer)
*(.ARM.extab* .gnu.linkonce.armextab.*)
*(.gcc_except_table)
. = ALIGN(4);
KEEP (*(.eh_frame_hdr))
. = ALIGN(4);
KEEP(*(.eh_frame))
} >FLASH
__exidx_start = .;
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > FLASH
__exidx_end = .;
.rodata : ALIGN (4)
{
*(.rodata .rodata.* .gnu.linkonce.r.*)
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
. = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
. = ALIGN(0x4);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
. = ALIGN(0x4);
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
. = ALIGN (8);
*(.rom)
*(.rom.b)
_etext = .;
} >FLASH
/* used by the startup to initialize data */
_sidata = .;
/* Initialized data sections goes into RAM, load LMA copy after code */
.data : AT ( _sidata )
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
KEEP(*(.jcr))
*(.got.plt) *(.got)
*(.shdata)
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM
/* Uninitialized data section */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.shbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
PROVIDE ( end = _ebss );
PROVIDE ( _end = _ebss );
PROVIDE ( __end__ = _ebss );
.heap : {
__heap_start__ = . ;
. = . + HEAP_SIZE;
. = ALIGN(4);
__heap_end__ = . ;
} >RAM
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
}
ASSERT((_estack - __heap_end__)<STACK_MAX_SIZE,"Heap and stack overlap.")