mirror of
https://gitee.com/openharmony/third_party_littlefs
synced 2024-11-24 07:20:45 +00:00
fd1da602d7
This provides a limited form of wear leveling. While wear is not actually balanced across blocks, the filesystem can recover from corrupted blocks and extend the lifetime of a device nearly as much as dynamic wear leveling. For use-cases where wear is important, it would be better to use a full form of dynamic wear-leveling at the block level. (or consider a logging filesystem). Corrupted block handling was simply added on top of the existing logic in place for the filesystem, so it's a bit more noodly than it may have to be, but it gets the work done.
58 lines
804 B
Makefile
58 lines
804 B
Makefile
TARGET = lfs
|
|
|
|
CC = gcc
|
|
AR = ar
|
|
SIZE = size
|
|
|
|
SRC += $(wildcard *.c emubd/*.c)
|
|
OBJ := $(SRC:.c=.o)
|
|
DEP := $(SRC:.c=.d)
|
|
ASM := $(SRC:.c=.s)
|
|
|
|
TEST := $(patsubst tests/%.sh,%,$(wildcard tests/test_*))
|
|
|
|
ifdef DEBUG
|
|
CFLAGS += -O0 -g3
|
|
else
|
|
CFLAGS += -Os
|
|
endif
|
|
ifdef WORD
|
|
CFLAGS += -m$(WORD)
|
|
endif
|
|
CFLAGS += -I.
|
|
CFLAGS += -std=c99 -Wall -pedantic
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
asm: $(ASM)
|
|
|
|
size: $(OBJ)
|
|
$(SIZE) -t $^
|
|
|
|
.SUFFIXES:
|
|
test: test_format test_dirs test_files test_seek test_parallel \
|
|
test_alloc test_paths test_orphan test_corrupt
|
|
test_%: tests/test_%.sh
|
|
./$<
|
|
|
|
-include $(DEP)
|
|
|
|
$(TARGET): $(OBJ)
|
|
$(CC) $(CFLAGS) $^ $(LFLAGS) -o $@
|
|
|
|
%.a: $(OBJ)
|
|
$(AR) rcs $@ $^
|
|
|
|
%.o: %.c
|
|
$(CC) -c -MMD $(CFLAGS) $< -o $@
|
|
|
|
%.s: %.c
|
|
$(CC) -S $(CFLAGS) $< -o $@
|
|
|
|
clean:
|
|
rm -f $(TARGET)
|
|
rm -f $(OBJ)
|
|
rm -f $(DEP)
|
|
rm -f $(ASM)
|