From 99f9f7b5043dc93b98dadfd74be5a0a109e41952 Mon Sep 17 00:00:00 2001 From: Christina Quast Date: Sat, 13 Dec 2014 13:30:31 +0100 Subject: [PATCH] working printf --- sam3s_example/Makefile | 9 ++++--- .../libboard_sam3s-ek/include/uart_console.h | 2 ++ .../libboard_sam3s-ek/source/uart_console.c | 26 +++++++++++++++++++ .../libchip_sam3s/include/trace.h | 2 +- sam3s_example/include/board.h | 1 + 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/sam3s_example/Makefile b/sam3s_example/Makefile index 06867047..b5097bc3 100644 --- a/sam3s_example/Makefile +++ b/sam3s_example/Makefile @@ -72,7 +72,7 @@ LIBC_PATH=../Baselibc LIBS = -Wl,--start-group -lgcc -lc -Wl,--end-group #LIB_PATH+=-L=/lib/thumb2 #LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.4.1/thumb2 -LIB+=-L=$(LIBC_PATH) -lc +LIB += -L=$(LIBC_PATH)/include -lc # Compilation tools CC = $(CROSS_COMPILE)gcc @@ -84,7 +84,7 @@ GDB = $(CROSS_COMPILE)gdb NM = $(CROSS_COMPILE)nm # Flags -INCLUDES = -Iinclude -Isam3s_examples_include +INCLUDES = -Iinclude_board -Iinclude_sam3s -Iinclude -IBaselibcc/include INCLUDES += -Icmsis INCLUDES += -I$(LIBC_PATH)/include #INCLUDES += -I$(LIBRARIES) @@ -96,9 +96,10 @@ CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings CFLAGS += -Wsign-compare -Waggregate-return CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long +CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline #-Wlong-long CFLAGS += -Wunreachable-code CFLAGS += -Wcast-align +CFLAGS += -std=c11 #CFLAGS += -Wmissing-noreturn #CFLAGS += -Wconversion @@ -125,7 +126,7 @@ VPATH += src_board src_sam3s cmsis # Objects built from C source files C_CMSIS = core_cm3.o C_LOWLEVEL = board_cstartup_gnu.o board_lowlevel.o syscalls.o exceptions.o -C_LIBLEVEL = spi.o pio.o pmc.o usart.o +C_LIBLEVEL = spi.o pio.o pmc.o usart.o pio_it.o pio_capture.o uart_console.o iso7816_4.o wdt.o C_APPLEVEL = main.o C_OBJECTS = $(C_CMSIS) $(C_LOWLEVEL) $(C_LIBLEVEL) $(C_APPLEVEL) diff --git a/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/include/uart_console.h b/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/include/uart_console.h index c48c2c1a..28e7bc17 100644 --- a/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/include/uart_console.h +++ b/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/include/uart_console.h @@ -33,6 +33,8 @@ #include +extern int printf(const char *, ...); + extern void UART_Configure( uint32_t dwBaudrate, uint32_t dwMasterClock ) ; extern void UART_PutChar( uint8_t uc ) ; extern uint32_t UART_GetChar( void ) ; diff --git a/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/source/uart_console.c b/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/source/uart_console.c index 1c4cbd92..9fb7a4a6 100644 --- a/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/source/uart_console.c +++ b/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/source/uart_console.c @@ -63,6 +63,32 @@ /** Is Console Initialized. */ static uint8_t _ucIsConsoleInitialized=0 ; +extern void UART_PutString(const char *str, int len) { + int i; + for (i=0; i diff --git a/sam3s_example/include/board.h b/sam3s_example/include/board.h index d67a1cd2..2ddd2ff8 100644 --- a/sam3s_example/include/board.h +++ b/sam3s_example/include/board.h @@ -12,6 +12,7 @@ /** Highlevel */ #include "trace.h" #include "stdio.h" +#include "stdlib.h" #include "string.h" #ifdef __GNUC__