Fixed Makefile, definitive Makefile using newlib
This commit is contained in:
parent
72ffb2bce3
commit
7431fc5abb
|
@ -6,11 +6,11 @@ CC = riscv32-unknown-elf-gcc
|
||||||
|
|
||||||
# compiling flags here
|
# compiling flags here
|
||||||
CFLAGS = -Wall -I. -O0 -static -march=rv32imac -mabi=ilp32 --specs=nosys.specs
|
CFLAGS = -Wall -I. -O0 -static -march=rv32imac -mabi=ilp32 --specs=nosys.specs
|
||||||
|
# CFLAGS = -Wall -I. -O0 -static -march=rv32imac -mabi=ilp32 --specs=nano.specs
|
||||||
|
|
||||||
|
LINKER = riscv32-unknown-elf-gcc
|
||||||
LINKER = riscv32-unknown-linux-gnu-gcc
|
|
||||||
# linking flags here
|
# linking flags here
|
||||||
LDFLAGS = -I. --entry main -L/opt/riscv/riscv32-unknown-elf/lib/ -T ld_script.ld
|
LDFLAGS = -I. -static
|
||||||
LIBS = $(EXTRA_LIBS)
|
LIBS = $(EXTRA_LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,15 +30,14 @@ rm = rm -f
|
||||||
|
|
||||||
|
|
||||||
$(BINDIR)/$(TARGET): $(OBJECTS)
|
$(BINDIR)/$(TARGET): $(OBJECTS)
|
||||||
# $(LINKER) $(OBJECTS) $(LDFLAGS) $(LIBS) $(LIBDIR) -o $@
|
$(LINKER) $(CFLAGS) $(LDFLAGS) $(LIBS) $(LIBDIR) $(OBJECTS) -o $@
|
||||||
riscv32-unknown-elf-objdump -d $< > dump
|
riscv32-unknown-elf-objdump -d $@ > dump
|
||||||
riscv32-unknown-elf-objcopy -Oihex $< $(TARGET).hex
|
riscv32-unknown-elf-objcopy -Oihex $@ $(TARGET).hex
|
||||||
# @echo "Linking complete!"
|
@echo "Linking complete!"
|
||||||
|
|
||||||
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
|
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
|
||||||
@echo "Compiling "$<" ..."
|
@echo "Compiling "$<" ..."
|
||||||
# $(CC) $(CFLAGS) $(INCDIR) -c $< -o $@
|
$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@
|
||||||
$(CC) $(CFLAGS) $(INCDIR) $< -o $@
|
|
||||||
@echo "Done!"
|
@echo "Done!"
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define TRACE (*(unsigned char *)0x40000000)
|
||||||
|
int _read(int file, char* ptr, int len) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _close(int fd){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _fstat_r(int fd) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _lseek_r(struct _reent *ptr, FILE *fp, long offset, int whence){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _isatty_r(struct _reent *ptr, int fd) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _write(int file, const char *ptr, int len) {
|
||||||
|
int x;
|
||||||
|
|
||||||
|
for (x = 0; x < len; x++) {
|
||||||
|
TRACE = *ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (len);
|
||||||
|
}
|
||||||
|
|
|
@ -1,36 +1,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define TRACE (*(unsigned char *)0x40000000)
|
|
||||||
int _read(int file, char* ptr, int len) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _close(int fd){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _fstat_r(int fd) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _lseek_r(struct _reent *ptr, FILE *fp, long offset, int whence){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _isatty_r(struct _reent *ptr, int fd) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _write(int file, const char *ptr, int len) {
|
|
||||||
int x;
|
|
||||||
|
|
||||||
for (x = 0; x < len; x++) {
|
|
||||||
TRACE = *ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (len);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue