1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-30 11:24:12 +01:00

[sam] fixing warning and doing cleanup of libsam build

This commit is contained in:
Thibaut VIARD 2012-03-27 12:03:40 +02:00
parent 042149a9b1
commit 3f1cdbaf5a
5 changed files with 32 additions and 30 deletions

View File

@ -17,21 +17,22 @@
#
# Tool suffix when cross-compiling
#CROSS_COMPILE = ../../CodeSourcery_arm/bin/arm-none-eabi-
#CROSS_COMPILE = C:/CodeSourcery_2011.03-42/bin/arm-none-eabi-
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
# Compilation tools
AR = $(CROSS_COMPILE)ar
CC = $(CROSS_COMPILE)gcc
AS = $(CROSS_COMPILE)as
#LD = $(CROSS_COMPILE)ld
#SIZE = $(CROSS_COMPILE)size
NM = $(CROSS_COMPILE)nm
#OBJCOPY = $(CROSS_COMPILE)objcopy
ifeq ($(OS),Windows_NT)
RM=cs-rm -Rf
else
RM=rm -Rf
endif
SEP=/
# Flags
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
@ -51,7 +52,7 @@ CFLAGS += -Wcast-align
# To reduce application size use only integer printf function.
CFLAGS += -Dprintf=iprintf
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -std=c99
CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -a -g $(INCLUDES)

View File

@ -23,6 +23,12 @@ SUB_MAKEFILES=debug.mk gcc.mk release.mk win.mk sam3s.mk
LIBNAME=libsam
TOOLCHAIN=gcc
ifeq ($(OS),Windows_NT)
DEV_NUL=NUL
else
DEV_NUL=/dev/null
endif
ifeq ($(CHIP),)
$(error CHIP not defined)
endif
@ -35,7 +41,6 @@ endif
#-------------------------------------------------------------------------------
# Output directories
#OUTPUT_BIN = ../lib
OUTPUT_BIN = ../../../cores/sam
# Libraries
@ -142,24 +147,24 @@ $(CHIP): create_output $(OUTPUT_LIB)
.PHONY: create_output
create_output:
@echo --- Preparing $(CHIP) files $(OUTPUT_PATH) $(OUTPUT_BIN)
@echo -------------------------
@echo *$(C_SRC)
@echo -------------------------
@echo *$(C_OBJ)
@echo -------------------------
@echo --- Preparing $(CHIP) files $(OUTPUT_PATH) to $(OUTPUT_BIN)
# @echo -------------------------
# @echo *$(C_SRC)
# @echo -------------------------
# @echo *$(C_OBJ)
# @echo -------------------------
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
# @echo -------------------------
# @echo *$(A_SRC)
# @echo -------------------------
-@mkdir $(subst /,$(SEP),$(OUTPUT_BIN)) 1>NUL 2>&1
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
-@mkdir $(subst /,$(SEP),$(OUTPUT_BIN)) 1>$(DEV_NUL) 2>&1
-@mkdir $(OUTPUT_PATH) 1>$(DEV_NUL) 2>&1
$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
# "$(CC)" -v -c $(CFLAGS) -Wa,aln=$(subst .o,.s,$@) $< -o $@
# @"$(CC)" -c $(CFLAGS) $< -o $@
"$(CC)" -c $(CFLAGS) $< -o $@
@"$(CC)" -c $(CFLAGS) $< -o $@
# "$(CC)" -c $(CFLAGS) $< -o $@
$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s
@"$(AS)" -c $(ASFLAGS) $< -o $@
@ -171,9 +176,9 @@ $(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)
.PHONY: clean
clean:
@echo --- Cleaning $(CHIP) files
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
-@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)) 1>NUL 2>&1
-@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)).txt 1>NUL 2>&1
-@$(RM) $(OUTPUT_PATH) 1>$(DEV_NUL) 2>&1
-@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)) 1>$(DEV_NUL) 2>&1
-@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)).txt 1>$(DEV_NUL) 2>&1
# dependencies
$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: $(PROJECT_BASE_PATH)/chip.h $(wildcard $(PROJECT_BASE_PATH)/include/*.h) $(wildcard $(CMSIS_BASE_PATH)/*.h)

View File

@ -48,7 +48,7 @@ extern "C" {
/**INDENT-ON**/
/// @endcond
#if SAM3U
#if SAM3U_SERIES
/**
* \brief Initializes the given ADC with the specified ADC clock and startup time.
@ -73,8 +73,6 @@ uint32_t adc_init(Adc *p_adc, uint32_t ul_mck, uint32_t ul_adc_clock, uint32_t u
p_adc->ADC_PTCR = (ADC_PTCR_RXTDIS | ADC_PTCR_TXTDIS);
p_adc->ADC_RCR = 0;
p_adc->ADC_RNCR = 0;
p_adc->ADC_TCR = 0;
p_adc->ADC_TNCR = 0;
uint32_t prescal = ul_mck/(2 * ul_adc_clock) - 1;
// check for rounding errors
if ( (ul_mck/((prescal+1)*2)) > ul_adc_clock ) {
@ -328,4 +326,4 @@ Pdc *adc_get_pdc_base(Adc *p_adc)
/**INDENT-ON**/
/// @endcond
#endif /* SAM3U */
#endif /* SAM3U_SERIES */

View File

@ -48,7 +48,7 @@ extern "C" {
/**INDENT-ON**/
/// @endcond
#if SAM3U
#if SAM3U_SERIES
/**
* \brief Initializes the given ADC with the specified ADC clock and startup time.
@ -73,8 +73,6 @@ uint32_t adc12_init(Adc12b *p_adc, uint32_t ul_mck, uint32_t ul_adc_clock, uint3
p_adc->ADC12B_PTCR = (ADC12B_PTCR_RXTDIS | ADC12B_PTCR_TXTDIS);
p_adc->ADC12B_RCR = 0;
p_adc->ADC12B_RNCR = 0;
p_adc->ADC12B_TCR = 0;
p_adc->ADC12B_TNCR = 0;
uint32_t prescal = ul_mck/(2 * ul_adc_clock) - 1;
// check for rounding errors
if ( (ul_mck/((prescal+1)*2)) > ul_adc_clock ) {
@ -376,4 +374,4 @@ Pdc *adc12_get_pdc_base(Adc12b *p_adc)
/**INDENT-ON**/
/// @endcond
#endif /* SAM3U */
#endif /* SAM3U_SERIES */

View File

@ -268,7 +268,7 @@ void adc_disable_channel(Adc *p_adc, adc_channel_num_t adc_ch)
* \retval 1 means the specified channel is enabled.
* 0 means the specified channel is disabled.
*/
uint32_t adc_get_channnel_status(Adc *p_adc, adc_channel_num_t adc_ch)
uint32_t adc_get_channel_status(Adc *p_adc, adc_channel_num_t adc_ch)
{
return p_adc->ADC_CHSR & (1 << adc_ch);
}
@ -672,6 +672,7 @@ uint32_t adc_get_writeprotect_status(Adc *p_adc)
return p_adc->ADC_WPSR & ADC_WPSR_WPVS;
}
#if 0
/**
* \brief calcul_startup
*/
@ -715,7 +716,6 @@ static uint32_t calcul_startup( uint32_t ul_startup )
return ul_startup_value;
}
#if 0
/**
* \brief Checks ADC configurations.
*