From c6952a48d52c4c7d1ef629570a98d8c06101a746 Mon Sep 17 00:00:00 2001 From: LayerDE Date: Thu, 10 Mar 2022 14:04:04 +0100 Subject: [PATCH 1/5] fixed buildproblems 2022 --- stack/bci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack/bci.c b/stack/bci.c index 334fffd..cc4d8cc 100644 --- a/stack/bci.c +++ b/stack/bci.c @@ -209,7 +209,7 @@ int8_t bci_ad_put(uint8_t *buffer, bci_ad_t type, ...) data++; *data = type; data++; - strncpy((char *) data, str, arglen); + memcpy(data, str, arglen); data += arglen; break; /* Fixed size array */ From 5c2d8dbbe3271e6fc69945b61cea140276609901 Mon Sep 17 00:00:00 2001 From: LayerDE Date: Thu, 10 Mar 2022 16:20:30 +0100 Subject: [PATCH 2/5] adding CPP support to blessed --- Makefile | 4 ++-- examples/Makefile.common | 19 +++++++++++++++---- platform/nrf51822/Makefile.platform | 14 +++++++++++++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 5f04476..7e6b5bf 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ LDFLAGS = $(PLATFORM_LDFLAGS) SOURCE_PATHS = $(PLATFORM_SOURCE_PATHS) \ stack -SOURCE_FILES = $(PLATFORM_SOURCE_FILES) \ +C_SOURCE_FILES = $(PLATFORM_SOURCE_FILES) \ ll.c \ bci.c @@ -39,7 +39,7 @@ ASM_PATHS = $(PLATFORM_ASM_PATHS) ASM_FILES = $(PLATFORM_ASM_FILES) -C_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(SOURCE_FILES:.c=.o)) +C_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(C_SOURCE_FILES:.c=.o)) ASM_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(ASM_FILES:.s=.o)) vpath %.c $(SOURCE_PATHS) diff --git a/examples/Makefile.common b/examples/Makefile.common index aab5d35..499967f 100644 --- a/examples/Makefile.common +++ b/examples/Makefile.common @@ -32,19 +32,26 @@ CFLAGS = -O2 -Wall $(PLATFORM_CFLAGS) \ $(PROJECT_CFLAGS) \ $(INCLUDES) +CPPFLAGS = O2 - Wall $(PLATFORM_CPPFLAGS) \ + $(PROJECT_CPPFLAGS) \ + $(INCLUDES) + LDFLAGS = $(PLATFORM_LDFLAGS) \ $(PROJECT_LDFLAGS) SOURCE_PATHS = $(PROJECT_SOURCE_PATHS) \ $(PLATFORM_SOURCE_PATHS) -SOURCE_FILES = $(PROJECT_SOURCE_FILES) +c_SOURCE_FILES = $(PROJECT_SOURCE_FILES) +CPP_SOURCE_FILES = $(PROJECT_CPP_SOURCE_FILES) ASM_PATHS = $(PROJECT_ASM_PATHS) ASM_FILES = $(PROJECT_ASM_FILES) -C_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(SOURCE_FILES:.c=.o)) +C_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(C_SOURCE_FILES:.c=.o)) +CPP_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(CPP_SOURCE_FILES:.c=.o)) ASM_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(ASM_FILES:.s=.o)) vpath %.c $(SOURCE_PATHS) +vpath %.cpp $(SOURCE_PATHS) vpath %.s $(ASM_PATHS) all: $(BUILD_PATH) $(BUILD_PATH)/$(PROJECT_TARGET).bin @@ -54,9 +61,9 @@ $(BUILD_PATH)/$(PROJECT_TARGET).bin: $(BUILD_PATH)/$(PROJECT_TARGET).out @$(OBJCOPY) -Obinary $(BUILD_PATH)/$(PROJECT_TARGET).out \ $(BUILD_PATH)/$(PROJECT_TARGET).bin -$(BUILD_PATH)/$(PROJECT_TARGET).out: $(C_OBJ_FILES) $(ASM_OBJ_FILES) +$(BUILD_PATH)/$(PROJECT_TARGET).out: $(C_OBJ_FILES) $(CPP_OBJ_FILES) $(ASM_OBJ_FILES) @echo -e "LD\t $@" - @$(LD) $(LDFLAGS) $(C_OBJ_FILES) $(ASM_OBJ_FILES) $(LIBBLESSED) -o $@ + @$(LD) $(LDFLAGS) $(C_OBJ_FILES) $(CPP_OBJ_FILES) $(ASM_OBJ_FILES) $(LIBBLESSED) -o $@ @echo -e "SIZE\t $@" @$(SIZE) $@ @@ -64,6 +71,10 @@ $(BUILD_PATH)/%.o: %.c @echo -e "CC\t $<" @$(CC) $(CFLAGS) -o $@ $< +$(BUILD_PATH)/%.o: %.cpp + @echo -e "CPP\t $<" + @$(CPP) $(CPPFLAGS) -o $@ $< + $(BUILD_PATH)/%.o: %.s @echo -e "CC\t $<" @$(CC) $(ASMFLAGS) -o $@ $< diff --git a/platform/nrf51822/Makefile.platform b/platform/nrf51822/Makefile.platform index 810ec51..b0c3fac 100644 --- a/platform/nrf51822/Makefile.platform +++ b/platform/nrf51822/Makefile.platform @@ -14,7 +14,8 @@ STACK_SIZE ?= 1024 CROSS_COMPILE ?= arm-none-eabi- CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)gcc +CPP = $(CROSS_COMPILE)g++ +LD = $(CROSS_COMPILE)g++ AR = $(CROSS_COMPILE)ar SIZE = $(CROSS_COMPILE)size OBJCOPY = $(CROSS_COMPILE)objcopy @@ -43,6 +44,17 @@ PLATFORM_CFLAGS = -mcpu=$(CPU) \ -Wall \ -c +PLATFORM_CPPFLAGS = -mcpu=$(CPU) \ + -D$(DEVICE_FAMILY) \ + -D$(BOARD) \ + -D$(SOC) \ + -mfloat-abi=soft \ + --std=c++03 \ + -mthumb \ + -Werror \ + -Wall \ + -c + PLATFORM_ASMFLAGS = $(PLATFORM_CFLAGS) \ -x assembler-with-cpp \ -D__HEAP_SIZE=$(HEAP_SIZE) \ From 63e119d9db7066eb280f67863dd8594206133162 Mon Sep 17 00:00:00 2001 From: LayerDE Date: Fri, 18 Mar 2022 02:54:19 +0100 Subject: [PATCH 3/5] fixed cpp --- examples/Makefile.common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Makefile.common b/examples/Makefile.common index 499967f..a4880fa 100644 --- a/examples/Makefile.common +++ b/examples/Makefile.common @@ -32,7 +32,7 @@ CFLAGS = -O2 -Wall $(PLATFORM_CFLAGS) \ $(PROJECT_CFLAGS) \ $(INCLUDES) -CPPFLAGS = O2 - Wall $(PLATFORM_CPPFLAGS) \ +CPPFLAGS = -O2 -Wall $(PLATFORM_CPPFLAGS) \ $(PROJECT_CPPFLAGS) \ $(INCLUDES) @@ -47,7 +47,7 @@ ASM_PATHS = $(PROJECT_ASM_PATHS) ASM_FILES = $(PROJECT_ASM_FILES) C_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(C_SOURCE_FILES:.c=.o)) -CPP_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(CPP_SOURCE_FILES:.c=.o)) +CPP_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(CPP_SOURCE_FILES:.cpp=.o)) ASM_OBJ_FILES = $(addprefix $(BUILD_PATH)/, $(ASM_FILES:.s=.o)) vpath %.c $(SOURCE_PATHS) From 86a0d96c1c2b112ca295e972a3efd0c4c8fd1557 Mon Sep 17 00:00:00 2001 From: LayerDE Date: Fri, 18 Mar 2022 03:01:00 +0100 Subject: [PATCH 4/5] Update Makefile.platform --- platform/nrf51822/Makefile.platform | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/nrf51822/Makefile.platform b/platform/nrf51822/Makefile.platform index b0c3fac..0c7e817 100644 --- a/platform/nrf51822/Makefile.platform +++ b/platform/nrf51822/Makefile.platform @@ -49,7 +49,7 @@ PLATFORM_CPPFLAGS = -mcpu=$(CPU) \ -D$(BOARD) \ -D$(SOC) \ -mfloat-abi=soft \ - --std=c++03 \ + --std=c++11 \ -mthumb \ -Werror \ -Wall \ From 2e4f9491d7202f631eb35f827ba437a8f6dc6076 Mon Sep 17 00:00:00 2001 From: LayerDE Date: Tue, 29 Mar 2022 13:26:16 +0200 Subject: [PATCH 5/5] rn --- platform/{nrf51822 => nRF51822}/Makefile.platform | 0 platform/{nrf51822 => nRF51822}/README.md | 0 platform/{nrf51822 => nRF51822}/delay.c | 0 platform/{nrf51822 => nRF51822}/evtloop.c | 0 platform/{nrf51822 => nRF51822}/ll-plat.c | 0 platform/{nrf51822 => nRF51822}/log.c | 0 platform/{nrf51822 => nRF51822}/nrf51822.h | 0 platform/{nrf51822 => nRF51822}/radio.c | 0 platform/{nrf51822 => nRF51822}/random.c | 0 platform/{nrf51822 => nRF51822}/timer.c | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename platform/{nrf51822 => nRF51822}/Makefile.platform (100%) rename platform/{nrf51822 => nRF51822}/README.md (100%) rename platform/{nrf51822 => nRF51822}/delay.c (100%) rename platform/{nrf51822 => nRF51822}/evtloop.c (100%) rename platform/{nrf51822 => nRF51822}/ll-plat.c (100%) rename platform/{nrf51822 => nRF51822}/log.c (100%) rename platform/{nrf51822 => nRF51822}/nrf51822.h (100%) rename platform/{nrf51822 => nRF51822}/radio.c (100%) rename platform/{nrf51822 => nRF51822}/random.c (100%) rename platform/{nrf51822 => nRF51822}/timer.c (100%) diff --git a/platform/nrf51822/Makefile.platform b/platform/nRF51822/Makefile.platform similarity index 100% rename from platform/nrf51822/Makefile.platform rename to platform/nRF51822/Makefile.platform diff --git a/platform/nrf51822/README.md b/platform/nRF51822/README.md similarity index 100% rename from platform/nrf51822/README.md rename to platform/nRF51822/README.md diff --git a/platform/nrf51822/delay.c b/platform/nRF51822/delay.c similarity index 100% rename from platform/nrf51822/delay.c rename to platform/nRF51822/delay.c diff --git a/platform/nrf51822/evtloop.c b/platform/nRF51822/evtloop.c similarity index 100% rename from platform/nrf51822/evtloop.c rename to platform/nRF51822/evtloop.c diff --git a/platform/nrf51822/ll-plat.c b/platform/nRF51822/ll-plat.c similarity index 100% rename from platform/nrf51822/ll-plat.c rename to platform/nRF51822/ll-plat.c diff --git a/platform/nrf51822/log.c b/platform/nRF51822/log.c similarity index 100% rename from platform/nrf51822/log.c rename to platform/nRF51822/log.c diff --git a/platform/nrf51822/nrf51822.h b/platform/nRF51822/nrf51822.h similarity index 100% rename from platform/nrf51822/nrf51822.h rename to platform/nRF51822/nrf51822.h diff --git a/platform/nrf51822/radio.c b/platform/nRF51822/radio.c similarity index 100% rename from platform/nrf51822/radio.c rename to platform/nRF51822/radio.c diff --git a/platform/nrf51822/random.c b/platform/nRF51822/random.c similarity index 100% rename from platform/nrf51822/random.c rename to platform/nRF51822/random.c diff --git a/platform/nrf51822/timer.c b/platform/nRF51822/timer.c similarity index 100% rename from platform/nrf51822/timer.c rename to platform/nRF51822/timer.c