console: Move console files

console.c goes to a new lib/ where we'll store other general utilities
and console.h goes to include/

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
jtag-port
Benjamin Herrenschmidt 5 years ago
parent a87b86e54f
commit 7bc118c7db

@ -15,6 +15,9 @@ LDFLAGS = -T powerpc.lds

all: hello_world.hex

console.o: ../lib/console.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

hello_world.elf: hello_world.o head.o console.o
$(LD) $(LDFLAGS) -o $@ $^


@ -4,6 +4,7 @@ void potato_uart_init(void);
void potato_uart_irq_en(void);
void potato_uart_irq_dis(void);
int getchar(void);
void putchar(unsigned char c);
int putchar(int c);
void putstr(const char *str, unsigned long len);
int puts(const char *str);
size_t strlen(const char *s);

@ -4,7 +4,7 @@ include variables.mak
OBJ = $(BUILD_DIR)/obj

PROGRAM = sdram_init
OBJECTS = $(OBJ)/head.o $(OBJ)/main.o $(OBJ)/sdram.o
OBJECTS = $(OBJ)/head.o $(OBJ)/main.o $(OBJ)/sdram.o $(OBJ)/console.o

#### Compiler

@ -50,10 +50,12 @@ all: objdir $(OBJ)/$(PROGRAM).hex

$(OBJ)/sdram.o: $(LXSRC_DIR)/sdram.c
$(call Q,CC, $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@, $@)
$(OBJ)/%.o : $(SRC_DIR)/%.S
$(call Q,AS, $(CC) $(ASFLAGS) -c $< -o $@, $@)
$(OBJ)/console.o: $(SRC_DIR)/../../../lib/console.c
$(call Q,CC, $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@, $@)
$(OBJ)/%.o : $(SRC_DIR)/%.c
$(call Q,CC, $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@, $@)
$(OBJ)/%.o : $(SRC_DIR)/%.S
$(call Q,AS, $(CC) $(ASFLAGS) -c $< -o $@, $@)
$(OBJ)/%.o : $(SRC_DIR)/libc/src/%.c
$(call Q,CC, $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@, $@)


@ -1 +1 @@
../hello_world/console.c
../lib/console.c

@ -1 +1 @@
../hello_world/console.h
../include/console.h

@ -9,14 +9,17 @@ CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
OBJCOPY = $(CROSS_COMPILE)objcopy

CFLAGS = -Os -g -Wall -std=c99 -msoft-float -mno-string -mno-multiple -mno-vsx -mno-altivec -mlittle-endian -fno-stack-protector -mstrict-align -ffreestanding -fdata-sections -ffunction-sections -I ../../hello_world -I ../../include
CFLAGS = -Os -g -Wall -std=c99 -msoft-float -mno-string -mno-multiple -mno-vsx -mno-altivec -mlittle-endian -fno-stack-protector -mstrict-align -ffreestanding -fdata-sections -ffunction-sections -I ../../include
ASFLAGS = $(CFLAGS)
LDFLAGS = -T powerpc.lds

all: $(TEST).hex

$(TEST).elf: $(TEST).o head.o ../../hello_world/console.o
$(LD) $(LDFLAGS) -o $(TEST).elf $(TEST).o head.o ../../hello_world/console.o
console.o: ../../lib/console.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

$(TEST).elf: $(TEST).o head.o console.o
$(LD) $(LDFLAGS) -o $(TEST).elf $(TEST).o head.o console.o

$(TEST).bin: $(TEST).elf
$(OBJCOPY) -O binary $(TEST).elf $(TEST).bin

Loading…
Cancel
Save