Skip to content

Commit

Permalink
fixed annoying off-by-one bug
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Oliver Moll <svolli@svolli.de>
  • Loading branch information
Sven Oliver Moll committed Aug 21, 2023
1 parent 90af92a commit bb367d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@ PICO_SDK_PATH_CMAKE ?= -DPICO_SDK_PATH=$(PICO_SDK_PATH)
RELEASE_ARCHIVE := SorbusComputerCores.zip

PICO_SDK_URL ?= https://github.com/raspberrypi/pico-sdk.git
PICO_BOARD ?= pico
BUILD_DIR ?= $(CURDIR)/build
SRC_DIR := $(CURDIR)/src
JOBS ?= 4

.PHONY: all clean distclean release setup-apt

all: $(PICO_SDK_PATH)/README.md
cmake -S $(CURDIR)/src -B $(CURDIR)/build $(PICO_SDK_PATH_CMAKE)
make -C $(CURDIR)/build
cmake -S $(SRC_DIR) -B $(BUILD_DIR) $(PICO_SDK_PATH_CMAKE) -DPICO_BOARD=$(PICO_BOARD)
make -C $(BUILD_DIR) -j$(JOBS)

clean:
make -C $(CURDIR)/build clean
make -C $(BUILD_DIR) clean
rm -f $(RELEASE_ARCHIVE)

distclean:
rm -rf $(RELEASE_ARCHIVE) $(CURDIR)/build
rm -rf $(RELEASE_ARCHIVE) $(BUILD_DIR)

$(PICO_SDK_PATH)/README.md:
mkdir -p $(PICO_SDK_PATH)
Expand All @@ -33,7 +37,7 @@ setup-apt:
sudo apt install gdb-multiarch cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib cc65 microcom p7zip-full

$(RELEASE_ARCHIVE): all
for i in $$(ls -1 build/rp2040/*.uf2|grep -v _test.uf2$$); do cp -v $${i} sorbus-computer-$$(basename $${i});done
for i in $$(ls -1 $(BUILD_DIR)/rp2040/*.uf2|grep -v _test.uf2$$); do cp -v $${i} sorbus-computer-$$(basename $${i});done
cp doc/README_release.txt README.txt
rm -f $@
7z a -mx=9 -bd -sdel $@ README.txt *.uf2
Expand Down
2 changes: 1 addition & 1 deletion src/rp2040/getaline.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const char *getaline()
/* only move history when required */
if( input[0][0] && strncmp( &input[0][0], &input[1][0], INPUT_SIZE ) )
{
for( int i = HISTORY_SIZE; i > 0; --i )
for( int i = HISTORY_SIZE-1; i > 0; --i )
{
memcpy( &input[i][0], &input[i-1][0], INPUT_SIZE );
}
Expand Down

0 comments on commit bb367d7

Please sign in to comment.