mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-25 01:38:33 +03:00
working printf
This commit is contained in:
@@ -72,7 +72,7 @@ LIBC_PATH=../Baselibc
|
|||||||
LIBS = -Wl,--start-group -lgcc -lc -Wl,--end-group
|
LIBS = -Wl,--start-group -lgcc -lc -Wl,--end-group
|
||||||
#LIB_PATH+=-L=/lib/thumb2
|
#LIB_PATH+=-L=/lib/thumb2
|
||||||
#LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.4.1/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
|
# Compilation tools
|
||||||
CC = $(CROSS_COMPILE)gcc
|
CC = $(CROSS_COMPILE)gcc
|
||||||
@@ -84,7 +84,7 @@ GDB = $(CROSS_COMPILE)gdb
|
|||||||
NM = $(CROSS_COMPILE)nm
|
NM = $(CROSS_COMPILE)nm
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
INCLUDES = -Iinclude -Isam3s_examples_include
|
INCLUDES = -Iinclude_board -Iinclude_sam3s -Iinclude -IBaselibcc/include
|
||||||
INCLUDES += -Icmsis
|
INCLUDES += -Icmsis
|
||||||
INCLUDES += -I$(LIBC_PATH)/include
|
INCLUDES += -I$(LIBC_PATH)/include
|
||||||
#INCLUDES += -I$(LIBRARIES)
|
#INCLUDES += -I$(LIBRARIES)
|
||||||
@@ -96,9 +96,10 @@ CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
|||||||
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
|
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
|
||||||
CFLAGS += -Wsign-compare -Waggregate-return
|
CFLAGS += -Wsign-compare -Waggregate-return
|
||||||
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
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 += -Wunreachable-code
|
||||||
CFLAGS += -Wcast-align
|
CFLAGS += -Wcast-align
|
||||||
|
CFLAGS += -std=c11
|
||||||
#CFLAGS += -Wmissing-noreturn
|
#CFLAGS += -Wmissing-noreturn
|
||||||
#CFLAGS += -Wconversion
|
#CFLAGS += -Wconversion
|
||||||
|
|
||||||
@@ -125,7 +126,7 @@ VPATH += src_board src_sam3s cmsis
|
|||||||
# Objects built from C source files
|
# Objects built from C source files
|
||||||
C_CMSIS = core_cm3.o
|
C_CMSIS = core_cm3.o
|
||||||
C_LOWLEVEL = board_cstartup_gnu.o board_lowlevel.o syscalls.o exceptions.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_APPLEVEL = main.o
|
||||||
C_OBJECTS = $(C_CMSIS) $(C_LOWLEVEL) $(C_LIBLEVEL) $(C_APPLEVEL)
|
C_OBJECTS = $(C_CMSIS) $(C_LOWLEVEL) $(C_LIBLEVEL) $(C_APPLEVEL)
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
extern int printf(const char *, ...);
|
||||||
|
|
||||||
extern void UART_Configure( uint32_t dwBaudrate, uint32_t dwMasterClock ) ;
|
extern void UART_Configure( uint32_t dwBaudrate, uint32_t dwMasterClock ) ;
|
||||||
extern void UART_PutChar( uint8_t uc ) ;
|
extern void UART_PutChar( uint8_t uc ) ;
|
||||||
extern uint32_t UART_GetChar( void ) ;
|
extern uint32_t UART_GetChar( void ) ;
|
||||||
|
|||||||
@@ -63,6 +63,32 @@
|
|||||||
/** Is Console Initialized. */
|
/** Is Console Initialized. */
|
||||||
static uint8_t _ucIsConsoleInitialized=0 ;
|
static uint8_t _ucIsConsoleInitialized=0 ;
|
||||||
|
|
||||||
|
extern void UART_PutString(const char *str, int len) {
|
||||||
|
int i;
|
||||||
|
for (i=0; i<len; i++) {
|
||||||
|
UART_PutChar(*str++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int printf(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
char *cmdp;
|
||||||
|
size_t ret = 0;
|
||||||
|
|
||||||
|
va_list va;
|
||||||
|
va_start(va, fmt);
|
||||||
|
ret = vasprintf(&cmdp, fmt, va);
|
||||||
|
va_end(va);
|
||||||
|
|
||||||
|
if (ret == strlen(cmdp)) {
|
||||||
|
UART_PutString(cmdp, strlen(cmdp));
|
||||||
|
free(cmdp);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Configures an USART peripheral with the specified parameters.
|
* \brief Configures an USART peripheral with the specified parameters.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
/*
|
/*
|
||||||
* Headers
|
* Headers
|
||||||
*/
|
*/
|
||||||
|
#include "board.h"
|
||||||
#include "pio.h"
|
#include "pio.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
/** Highlevel */
|
/** Highlevel */
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
#include "stdlib.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|||||||
Reference in New Issue
Block a user