Remove libc dependency

This commit is contained in:
iabdalkader 2014-03-03 16:24:50 +02:00
parent c75969a9e8
commit 70a5e45129
3 changed files with 8 additions and 49 deletions

View File

@ -28,7 +28,8 @@ CFLAGS += -I. -I../include/CMSIS -I../include/StdPeriph -I../include/USB_OTG -I.
# Linker Flags # Linker Flags
LDFLAGS = -mcpu=cortex-m4 -mabi=aapcs-linux -mthumb -mlittle-endian -mfloat-abi=hard -mfpu=fpv4-sp-d16 LDFLAGS = -mcpu=cortex-m4 -mabi=aapcs-linux -mthumb -mlittle-endian -mfloat-abi=hard -mfpu=fpv4-sp-d16
#LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(BIN).map -Tstm32f4xx.ld -L. -L../lib #LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(BIN).map -Tstm32f4xx.ld -L. -L../lib
LDFLAGS += -Tstm32f4xx.ld -L. -L../lib #LDFLAGS += -nostdlib -Tstm32f4xx.ld -L. -L../lib
LDFLAGS += -nostdlib -Tstm32f4xx.ld -L. -L../lib
# Sources # Sources
@ -37,9 +38,10 @@ OBJS = $(addprefix $(BUILD_DIR)/, $(SRCS:.c=.o))
# Libraries # Libraries
#LIB = -lmp -lc -lm -ldsp -lstdperiph -lusbcore -lusbdevcore #LIB = -lmp -lc -lm -ldsp -lstdperiph -lusbcore -lusbdevcore
LIB = -lmp -lc -lm -ldsp -lstdperiph LIB = -lmp -ldsp -lstdperiph
all:: $(BUILD_DIR) $(BUILD_DIR) $(BUILD_DIR)/$(BIN).bin all:: $(BUILD_DIR) $(BUILD_DIR) $(BUILD_DIR)/$(BIN).bin
$(SIZE) $(BUILD_DIR)/$(BIN).elf
$(BUILD_DIR): $(BUILD_DIR):
mkdir $@ mkdir $@
@ -53,7 +55,7 @@ $(BUILD_DIR)/$(BIN).elf: $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@ $(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@
stats: $(BIN).elf stats: $(BIN).elf
$(SIZE) $(BIN).elf $(SIZE) $(BUILD_DIR)/$(BIN).elf
clean: clean:
$(RM) -fr $(BUILD_DIR) $(RM) -fr $(BUILD_DIR)

View File

@ -101,6 +101,6 @@ void array_resize(struct array *array, int idx)
void array_sort(struct array *array, array_comp comp) void array_sort(struct array *array, array_comp comp)
{ {
qsort(array->data, array->index, sizeof(void*), comp); //qsort(array->data, array->index, sizeof(void*), comp);
} }

View File

@ -9,7 +9,7 @@ ENTRY(Reset_Handler)
MEMORY MEMORY
{ {
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K
FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 512K FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 896K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
CCM (w!rx) : ORIGIN = 0x10000000, LENGTH = 64K CCM (w!rx) : ORIGIN = 0x10000000, LENGTH = 64K
} }
@ -21,7 +21,7 @@ _ram_end = 0x10010000; /* 64KB CCM */
/* Generate a link error if heap and stack don't fit into RAM */ /* Generate a link error if heap and stack don't fit into RAM */
_stack_size = 0x1000; /* required amount of stack */ _stack_size = 0x1000; /* required amount of stack */
_heap_size = 0x8000; /* required amount of heap */ _heap_size = 0x8000; /* 0xC800 required amount of heap */
_cache_size = 0x4000; /* required amount of cache */ _cache_size = 0x4000; /* required amount of cache */
_main_ram_start = 0x20000000; _main_ram_start = 0x20000000;
@ -56,39 +56,6 @@ SECTIONS
_exit = .; _exit = .;
} >FLASH_TEXT } >FLASH_TEXT
.ARM.extab : {
*(.ARM.extab* .gnu.linkonce.armextab.*)
} >FLASH_TEXT
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH_TEXT
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >FLASH_TEXT
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >FLASH_TEXT
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(.fini_array*))
KEEP (*(SORT(.fini_array.*)))
PROVIDE_HIDDEN (__fini_array_end = .);
} >FLASH_TEXT
/* used by the startup to initialize data */ /* used by the startup to initialize data */
_sidata = .; _sidata = .;
@ -140,15 +107,5 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
} >CCM } >CCM
/* Remove information from the standard libraries */
/*
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
*/
.ARM.attributes 0 : { *(.ARM.attributes) } .ARM.attributes 0 : { *(.ARM.attributes) }
} }